Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/ClosingStructuresFailureMechanismSection2aAssessmentResultExtensions.cs
===================================================================
diff -u
--- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/ClosingStructuresFailureMechanismSection2aAssessmentResultExtensions.cs (revision 0)
+++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/ClosingStructuresFailureMechanismSection2aAssessmentResultExtensions.cs (revision e1a93747d105f27392f4bc0655694810c7d29f4d)
@@ -0,0 +1,74 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.Probability;
+using Ringtoets.Common.Data.Structures;
+
+namespace Ringtoets.ClosingStructures.Data
+{
+ ///
+ /// Extension methods for obtaining level 2a results from output for an assessment of the
+ /// closing structures failure mechanism.
+ ///
+ public static class ClosingStructuresFailureMechanismSection2aAssessmentResultExtensions
+ {
+ ///
+ /// Gets the value for the detailed assessment of safety per failure mechanism section as a probability.
+ ///
+ /// The section result to get the assessment layer 2A for.
+ /// The failure mechanism the calculations belong to.
+ /// The assessment section the calculations belong to.
+ /// The calculated assessment layer 2A; or when there is no
+ /// calculation assigned to the section result or the calculation is not performed.
+ /// Thrown when any parameter is null.
+ public static double GetAssessmentLayerTwoA(this StructuresFailureMechanismSectionResult sectionResult,
+ ClosingStructuresFailureMechanism failureMechanism,
+ IAssessmentSection assessmentSection)
+ {
+ if (sectionResult == null)
+ {
+ throw new ArgumentNullException(nameof(sectionResult));
+ }
+
+ if (failureMechanism == null)
+ {
+ throw new ArgumentNullException(nameof(failureMechanism));
+ }
+
+ if (assessmentSection == null)
+ {
+ throw new ArgumentNullException(nameof(assessmentSection));
+ }
+
+ if (sectionResult.Calculation == null || !sectionResult.Calculation.HasOutput)
+ {
+ return double.NaN;
+ }
+
+ ProbabilityAssessmentOutput derivedOutput = ClosingStructuresProbabilityAssessmentOutputFactory.Create(sectionResult.Calculation.Output,
+ failureMechanism, assessmentSection);
+
+ return derivedOutput.Probability;
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag e1a93747d105f27392f4bc0655694810c7d29f4d refers to a dead (removed) revision in file `Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/ClosingStructuresfailureMechanismSection2aAssessmentResultExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresFailureMechanismSection2aAssessmentResultExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresFailureMechanismSection2aAssessmentResultExtensionsTest.cs (revision 0)
+++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresFailureMechanismSection2aAssessmentResultExtensionsTest.cs (revision e1a93747d105f27392f4bc0655694810c7d29f4d)
@@ -0,0 +1,158 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.ClosingStructures.Data.TestUtil;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.Data.Structures;
+using Ringtoets.Common.Data.TestUtil;
+
+namespace Ringtoets.ClosingStructures.Data.Test
+{
+ [TestFixture]
+ public class ClosingStructuresFailureMechanismSection2aAssessmentResultExtensionsTest
+ {
+ [Test]
+ public void GetAssessmentLayerTwoA_SectionResultNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ // Call
+ TestDelegate call = () => ClosingStructuresFailureMechanismSection2aAssessmentResultExtensions.GetAssessmentLayerTwoA(null,
+ new ClosingStructuresFailureMechanism(),
+ assessmentSection);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("sectionResult", exception.ParamName);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void GetAssessmentLayerTwoA_FailureMechanismNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var failureMechanismSectionResult = new StructuresFailureMechanismSectionResult(section);
+
+ // Call
+ TestDelegate call = () => failureMechanismSectionResult.GetAssessmentLayerTwoA(null, assessmentSection);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("failureMechanism", exception.ParamName);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void GetAssessmentLayerTwoA_AssessmentSectionNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var failureMechanismSectionResult = new StructuresFailureMechanismSectionResult(section);
+
+ // Call
+ TestDelegate call = () => failureMechanismSectionResult.GetAssessmentLayerTwoA(new ClosingStructuresFailureMechanism(), null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("assessmentSection", exception.ParamName);
+ }
+
+ [Test]
+ public void GetAssessmentLayerTwoA_SectionResultWithoutCalculation_ReturnsNaN()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var failureMechanismSectionResult = new StructuresFailureMechanismSectionResult(section);
+
+ // Call
+ double assessmentLayerTwoA = failureMechanismSectionResult.GetAssessmentLayerTwoA(new ClosingStructuresFailureMechanism(), assessmentSection);
+
+ // Assert
+ Assert.IsNaN(assessmentLayerTwoA);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void GetAssessmentLayerTwoA_CalculationWithoutOutput_ReturnsNaN()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var failureMechanismSectionResult = new StructuresFailureMechanismSectionResult(section)
+ {
+ Calculation = new TestClosingStructuresCalculation()
+ };
+
+ // Call
+ double assessmentLayerTwoA = failureMechanismSectionResult.GetAssessmentLayerTwoA(new ClosingStructuresFailureMechanism(), assessmentSection);
+
+ // Assert
+ Assert.IsNaN(assessmentLayerTwoA);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void GetAssessmentLayerTwoA_CalculationWithOutput_ReturnsDerivedProbability()
+ {
+ // Setup
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+
+ var mocks = new MockRepository();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
+ mocks.ReplayAll();
+
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var failureMechanismSectionResult = new StructuresFailureMechanismSectionResult(section)
+ {
+ Calculation = new TestClosingStructuresCalculation
+ {
+ Output = new TestStructuresOutput(new Random(39).NextDouble())
+ }
+ };
+
+ // Call
+ double assessmentLayerTwoA = failureMechanismSectionResult.GetAssessmentLayerTwoA(new ClosingStructuresFailureMechanism(), assessmentSection);
+
+ // Assert
+ Assert.AreEqual(0.45984249809357164, assessmentLayerTwoA);
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresProbabilityAssessmentOutputFactoryTest.cs
===================================================================
diff -u -raee2e55bc9dbf0bbe1fac86898575c7faa33162c -re1a93747d105f27392f4bc0655694810c7d29f4d
--- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresProbabilityAssessmentOutputFactoryTest.cs (.../ClosingStructuresProbabilityAssessmentOutputFactoryTest.cs) (revision aee2e55bc9dbf0bbe1fac86898575c7faa33162c)
+++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresProbabilityAssessmentOutputFactoryTest.cs (.../ClosingStructuresProbabilityAssessmentOutputFactoryTest.cs) (revision e1a93747d105f27392f4bc0655694810c7d29f4d)
@@ -110,6 +110,7 @@
Assert.AreEqual(expectedProbabilityOutput.Reliability, probabilityOutput.Reliability);
Assert.AreEqual(expectedProbabilityOutput.RequiredProbability, probabilityOutput.RequiredProbability);
Assert.AreEqual(expectedProbabilityOutput.RequiredReliability, probabilityOutput.RequiredReliability);
+ mocks.VerifyAll();
}
}
}
\ No newline at end of file
Fisheye: Tag e1a93747d105f27392f4bc0655694810c7d29f4d refers to a dead (removed) revision in file `Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresfailureMechanismSection2aAssessmentResultExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/PresentationObjects/ClosingStructuresOutputContextTest.cs
===================================================================
diff -u -rb08299f5057df68faf4b166a7b438e275339e02f -re1a93747d105f27392f4bc0655694810c7d29f4d
--- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/PresentationObjects/ClosingStructuresOutputContextTest.cs (.../ClosingStructuresOutputContextTest.cs) (revision b08299f5057df68faf4b166a7b438e275339e02f)
+++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/PresentationObjects/ClosingStructuresOutputContextTest.cs (.../ClosingStructuresOutputContextTest.cs) (revision e1a93747d105f27392f4bc0655694810c7d29f4d)
@@ -71,6 +71,7 @@
// Assert
var exception = Assert.Throws(call);
Assert.AreEqual("failureMechanism", exception.ParamName);
+ mocks.VerifyAll();
}
}
}
\ No newline at end of file
Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/PropertyClasses/ClosingStructuresOutputPropertiesTest.cs
===================================================================
diff -u -raee2e55bc9dbf0bbe1fac86898575c7faa33162c -re1a93747d105f27392f4bc0655694810c7d29f4d
--- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/PropertyClasses/ClosingStructuresOutputPropertiesTest.cs (.../ClosingStructuresOutputPropertiesTest.cs) (revision aee2e55bc9dbf0bbe1fac86898575c7faa33162c)
+++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/PropertyClasses/ClosingStructuresOutputPropertiesTest.cs (.../ClosingStructuresOutputPropertiesTest.cs) (revision e1a93747d105f27392f4bc0655694810c7d29f4d)
@@ -94,10 +94,8 @@
mocks.ReplayAll();
var random = new Random(39);
- double reliability = random.NextDouble();
+ var structuresOutput = new TestStructuresOutput(random.NextDouble());
- var structuresOutput = new TestStructuresOutput(reliability);
-
// Call
var properties = new ClosingStructuresOutputProperties(structuresOutput, failureMechanism, assessmentSection);
@@ -109,7 +107,7 @@
Assert.AreEqual(ProbabilityFormattingHelper.Format(expectedProbabilityAssessmentOutput.Probability), properties.Probability);
Assert.AreEqual(expectedProbabilityAssessmentOutput.Reliability, properties.Reliability, properties.Reliability.GetAccuracy());
Assert.AreEqual(expectedProbabilityAssessmentOutput.FactorOfSafety, properties.FactorOfSafety, properties.FactorOfSafety.GetAccuracy());
- mocks.ReplayAll();
+ mocks.VerifyAll();
}
}
}
\ No newline at end of file
Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Views/ClosingStructuresFailureMechanismResultViewTest.cs
===================================================================
diff -u -rbdfc832a125e7fac88579677e784a29a7ca1340b -re1a93747d105f27392f4bc0655694810c7d29f4d
--- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Views/ClosingStructuresFailureMechanismResultViewTest.cs (.../ClosingStructuresFailureMechanismResultViewTest.cs) (revision bdfc832a125e7fac88579677e784a29a7ca1340b)
+++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Views/ClosingStructuresFailureMechanismResultViewTest.cs (.../ClosingStructuresFailureMechanismResultViewTest.cs) (revision e1a93747d105f27392f4bc0655694810c7d29f4d)
@@ -25,7 +25,6 @@
using System.Globalization;
using System.Linq;
using System.Windows.Forms;
-using Core.Common.Base.Data;
using Core.Common.Base.Geometry;
using Core.Common.TestUtil;
using NUnit.Extensions.Forms;
@@ -261,17 +260,17 @@
var result1 = new StructuresFailureMechanismSectionResult(section1)
{
AssessmentLayerOne = AssessmentLayerOneState.Sufficient,
- AssessmentLayerThree = (RoundedDouble) random.NextDouble()
+ AssessmentLayerThree = random.NextRoundedDouble()
};
var result2 = new StructuresFailureMechanismSectionResult(section2)
{
AssessmentLayerOne = AssessmentLayerOneState.NotAssessed,
- AssessmentLayerThree = (RoundedDouble) random.NextDouble()
+ AssessmentLayerThree = random.NextRoundedDouble()
};
var result3 = new StructuresFailureMechanismSectionResult(section3)
{
AssessmentLayerOne = AssessmentLayerOneState.NoVerdict,
- AssessmentLayerThree = (RoundedDouble) random.NextDouble()
+ AssessmentLayerThree = random.NextRoundedDouble()
};
using (ClosingStructuresFailureMechanismResultView view = CreateConfiguredFailureMechanismResultsView())
@@ -340,7 +339,7 @@
var result = new StructuresFailureMechanismSectionResult(section)
{
AssessmentLayerOne = assessmentLayerOneState,
- AssessmentLayerThree = (RoundedDouble) random.NextDouble()
+ AssessmentLayerThree = random.NextRoundedDouble()
};
using (ClosingStructuresFailureMechanismResultView view = CreateConfiguredFailureMechanismResultsView())
{
Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/Ringtoets.ClosingStructures.Plugin.Test.csproj
===================================================================
diff -u -r3e93a96d301c2a3171f68bddd01a0436ebcf74c4 -re1a93747d105f27392f4bc0655694810c7d29f4d
--- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/Ringtoets.ClosingStructures.Plugin.Test.csproj (.../Ringtoets.ClosingStructures.Plugin.Test.csproj) (revision 3e93a96d301c2a3171f68bddd01a0436ebcf74c4)
+++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/Ringtoets.ClosingStructures.Plugin.Test.csproj (.../Ringtoets.ClosingStructures.Plugin.Test.csproj) (revision e1a93747d105f27392f4bc0655694810c7d29f4d)
@@ -41,7 +41,7 @@
-
+
Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/TreeNodeInfos/ClosingStructuresProbabilityFailureMechanismSectionResultContextTreeNodeInfoTest.cs
===================================================================
diff -u
--- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/TreeNodeInfos/ClosingStructuresProbabilityFailureMechanismSectionResultContextTreeNodeInfoTest.cs (revision 0)
+++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/TreeNodeInfos/ClosingStructuresProbabilityFailureMechanismSectionResultContextTreeNodeInfoTest.cs (revision e1a93747d105f27392f4bc0655694810c7d29f4d)
@@ -0,0 +1,147 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System.Drawing;
+using System.Linq;
+using Core.Common.Controls.TreeView;
+using Core.Common.Gui;
+using Core.Common.Gui.ContextMenu;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.ClosingStructures.Data;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.Structures;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Forms.PresentationObjects;
+using Ringtoets.Common.Forms.Properties;
+
+namespace Ringtoets.ClosingStructures.Plugin.Test.TreeNodeInfos
+{
+ [TestFixture]
+ public class ClosingStructuresProbabilityFailureMechanismSectionResultContextTreeNodeInfoTest
+ {
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Setup
+ using (var plugin = new ClosingStructuresPlugin())
+ {
+ TreeNodeInfo info = GetInfo(plugin);
+
+ // Assert
+ Assert.IsNotNull(info.Text);
+ Assert.IsNull(info.ForeColor);
+ Assert.IsNotNull(info.Image);
+ Assert.IsNotNull(info.ContextMenuStrip);
+ Assert.IsNull(info.EnsureVisibleOnCreate);
+ Assert.IsNull(info.ExpandOnCreate);
+ Assert.IsNull(info.ChildNodeObjects);
+ Assert.IsNull(info.CanRename);
+ Assert.IsNull(info.OnNodeRenamed);
+ Assert.IsNull(info.CanRemove);
+ Assert.IsNull(info.OnNodeRemoved);
+ Assert.IsNull(info.CanCheck);
+ Assert.IsNull(info.IsChecked);
+ Assert.IsNull(info.OnNodeChecked);
+ Assert.IsNull(info.CanDrag);
+ Assert.IsNull(info.CanDrop);
+ Assert.IsNull(info.CanInsert);
+ Assert.IsNull(info.OnDrop);
+ }
+ }
+
+ [Test]
+ public void Text_Always_ReturnsName()
+ {
+ // Setup
+ using (var plugin = new ClosingStructuresPlugin())
+ {
+ TreeNodeInfo info = GetInfo(plugin);
+
+ // Call
+ string text = info.Text(null);
+
+ // Assert
+ Assert.AreEqual("Resultaat", text);
+ }
+ }
+
+ [Test]
+ public void Image_Always_ReturnsGenericInputOutputIcon()
+ {
+ // Setup
+ using (var plugin = new ClosingStructuresPlugin())
+ {
+ TreeNodeInfo info = GetInfo(plugin);
+
+ // Call
+ Image image = info.Image(null);
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(Resources.FailureMechanismSectionResultIcon, image);
+ }
+ }
+
+ [Test]
+ public void ContextMenuStrip_Always_CallsBuilder()
+ {
+ // Setup
+ var mockRepository = new MockRepository();
+ var assessmentSection = mockRepository.Stub();
+ var menuBuilder = mockRepository.StrictMock();
+ menuBuilder.Expect(mb => mb.AddOpenItem()).Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.Build()).Return(null);
+
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+ var sectionResult = new StructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
+ var sectionResultContext = new ProbabilityFailureMechanismSectionResultContext>(new[]
+ {
+ sectionResult
+ }, failureMechanism, assessmentSection);
+
+ var gui = mockRepository.Stub();
+ gui.Stub(g => g.Get(sectionResultContext, treeViewControl)).Return(menuBuilder);
+ mockRepository.ReplayAll();
+
+ using (var plugin = new ClosingStructuresPlugin())
+ {
+ TreeNodeInfo info = GetInfo(plugin);
+
+ plugin.Gui = gui;
+
+ // Call
+ info.ContextMenuStrip(sectionResultContext, null, treeViewControl);
+ }
+ }
+
+ // Assert
+ mockRepository.VerifyAll();
+ }
+
+ private static TreeNodeInfo GetInfo(ClosingStructuresPlugin plugin)
+ {
+ return plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(ProbabilityFailureMechanismSectionResultContext>));
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag e1a93747d105f27392f4bc0655694810c7d29f4d refers to a dead (removed) revision in file `Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/TreeNodeInfos/ProbabilityFailureMechanismSectionResultContextTreeNodeInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/ViewInfos/ClosingStructuresFailureMechanismResultViewInfoTest.cs
===================================================================
diff -u -r560ea9f96409cc65f4666adf212a1c135c5e626f -re1a93747d105f27392f4bc0655694810c7d29f4d
--- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/ViewInfos/ClosingStructuresFailureMechanismResultViewInfoTest.cs (.../ClosingStructuresFailureMechanismResultViewInfoTest.cs) (revision 560ea9f96409cc65f4666adf212a1c135c5e626f)
+++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/ViewInfos/ClosingStructuresFailureMechanismResultViewInfoTest.cs (.../ClosingStructuresFailureMechanismResultViewInfoTest.cs) (revision e1a93747d105f27392f4bc0655694810c7d29f4d)
@@ -301,8 +301,9 @@
view.Expect(v => v.FailureMechanism = failureMechanism);
mocks.ReplayAll();
- var context = new ProbabilityFailureMechanismSectionResultContext>(failureMechanism.SectionResults, failureMechanism,
- assessmentSection);
+ var context = new ProbabilityFailureMechanismSectionResultContext>(
+ failureMechanism.SectionResults, failureMechanism,
+ assessmentSection);
// Call
info.AfterCreate(view, context);
@@ -318,9 +319,10 @@
var failureMechanism = new ClosingStructuresFailureMechanism();
IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
- var context = new ProbabilityFailureMechanismSectionResultContext>(failureMechanism.SectionResults,
- failureMechanism,
- assessmentSection);
+ var context = new ProbabilityFailureMechanismSectionResultContext>(
+ failureMechanism.SectionResults,
+ failureMechanism,
+ assessmentSection);
// Call
IView view = info.CreateInstance(context);
Index: Ringtoets/Common/src/Ringtoets.Common.Data/Probability/ProbabilityAssessmentOutput.cs
===================================================================
diff -u -r07f3d67fe9512b3c8303ff09398b0a234900d546 -re1a93747d105f27392f4bc0655694810c7d29f4d
--- Ringtoets/Common/src/Ringtoets.Common.Data/Probability/ProbabilityAssessmentOutput.cs (.../ProbabilityAssessmentOutput.cs) (revision 07f3d67fe9512b3c8303ff09398b0a234900d546)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/Probability/ProbabilityAssessmentOutput.cs (.../ProbabilityAssessmentOutput.cs) (revision e1a93747d105f27392f4bc0655694810c7d29f4d)
@@ -20,16 +20,14 @@
// All rights reserved.
using System;
-using Core.Common.Base;
using Core.Common.Base.Data;
-using Ringtoets.Common.Data.Calculation;
namespace Ringtoets.Common.Data.Probability
{
///
/// This class contains the results of a probabilistic assessment calculation.
///
- public class ProbabilityAssessmentOutput : CloneableObservable, ICalculationOutput
+ public class ProbabilityAssessmentOutput
{
private double requiredProbability;
private double probability;
Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Probability/ProbabilityAssessmentOutputTest.cs
===================================================================
diff -u -r339e1d134a2208f180b9f369d275cb98f9736a7c -re1a93747d105f27392f4bc0655694810c7d29f4d
--- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Probability/ProbabilityAssessmentOutputTest.cs (.../ProbabilityAssessmentOutputTest.cs) (revision 339e1d134a2208f180b9f369d275cb98f9736a7c)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Probability/ProbabilityAssessmentOutputTest.cs (.../ProbabilityAssessmentOutputTest.cs) (revision e1a93747d105f27392f4bc0655694810c7d29f4d)
@@ -20,11 +20,8 @@
// All rights reserved.
using System;
-using Core.Common.Base;
-using Core.Common.Data.TestUtil;
using Core.Common.TestUtil;
using NUnit.Framework;
-using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.Probability;
using Ringtoets.Common.Data.TestUtil;
@@ -48,8 +45,6 @@
var probabilityAssessmentOutput = new ProbabilityAssessmentOutput(requiredProbability, requiredReliability, probability, reliability, factorOfSafety);
// Assert
- Assert.IsInstanceOf(probabilityAssessmentOutput);
- Assert.IsInstanceOf(probabilityAssessmentOutput);
Assert.AreEqual(requiredProbability, probabilityAssessmentOutput.RequiredProbability);
Assert.AreEqual(5, probabilityAssessmentOutput.RequiredReliability.NumberOfDecimalPlaces);
Assert.AreEqual(requiredReliability, probabilityAssessmentOutput.RequiredReliability, probabilityAssessmentOutput.RequiredReliability.GetAccuracy());
Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/CommonCloneAssert.cs
===================================================================
diff -u -r339e1d134a2208f180b9f369d275cb98f9736a7c -re1a93747d105f27392f4bc0655694810c7d29f4d
--- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/CommonCloneAssert.cs (.../CommonCloneAssert.cs) (revision 339e1d134a2208f180b9f369d275cb98f9736a7c)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/CommonCloneAssert.cs (.../CommonCloneAssert.cs) (revision e1a93747d105f27392f4bc0655694810c7d29f4d)
@@ -287,6 +287,7 @@
/// are not clones.
public static void AreClones(StructuresOutput original, StructuresOutput clone)
{
+ Assert.AreEqual(original.Reliability, clone.Reliability);
CoreCloneAssert.AreObjectClones(original.GeneralResult, clone.GeneralResult, AreClones);
}
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/Ringtoets.GrassCoverErosionInwards.Plugin.Test.csproj
===================================================================
diff -u -r3855e6511c947aa38a6e2b4454c1e6aa5b2bd3dc -re1a93747d105f27392f4bc0655694810c7d29f4d
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/Ringtoets.GrassCoverErosionInwards.Plugin.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Plugin.Test.csproj) (revision 3855e6511c947aa38a6e2b4454c1e6aa5b2bd3dc)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/Ringtoets.GrassCoverErosionInwards.Plugin.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Plugin.Test.csproj) (revision e1a93747d105f27392f4bc0655694810c7d29f4d)
@@ -42,7 +42,7 @@
-
+
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionInwardsProbabilityFailureMechanismSectionResultContextTreeNodeInfoTest.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionInwardsProbabilityFailureMechanismSectionResultContextTreeNodeInfoTest.cs (revision 0)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionInwardsProbabilityFailureMechanismSectionResultContextTreeNodeInfoTest.cs (revision e1a93747d105f27392f4bc0655694810c7d29f4d)
@@ -0,0 +1,143 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System.Drawing;
+using System.Linq;
+using Core.Common.Controls.TreeView;
+using Core.Common.Gui;
+using Core.Common.Gui.ContextMenu;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Forms.PresentationObjects;
+using Ringtoets.GrassCoverErosionInwards.Data;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.GrassCoverErosionInwards.Plugin.Test.TreeNodeInfos
+{
+ [TestFixture]
+ public class GrassCoverErosionInwardsProbabilityFailureMechanismSectionResultContextTreeNodeInfoTest
+ {
+ private MockRepository mocks;
+ private GrassCoverErosionInwardsPlugin plugin;
+ private TreeNodeInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ mocks = new MockRepository();
+ plugin = new GrassCoverErosionInwardsPlugin();
+ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(ProbabilityFailureMechanismSectionResultContext));
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ plugin.Dispose();
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Setup
+ mocks.ReplayAll();
+
+ // Assert
+ Assert.IsNotNull(info.Text);
+ Assert.IsNull(info.ForeColor);
+ Assert.IsNotNull(info.Image);
+ Assert.IsNotNull(info.ContextMenuStrip);
+ Assert.IsNull(info.EnsureVisibleOnCreate);
+ Assert.IsNull(info.ExpandOnCreate);
+ Assert.IsNull(info.ChildNodeObjects);
+ Assert.IsNull(info.CanRename);
+ Assert.IsNull(info.OnNodeRenamed);
+ Assert.IsNull(info.CanRemove);
+ Assert.IsNull(info.OnNodeRemoved);
+ Assert.IsNull(info.CanCheck);
+ Assert.IsNull(info.IsChecked);
+ Assert.IsNull(info.OnNodeChecked);
+ Assert.IsNull(info.CanDrag);
+ Assert.IsNull(info.CanDrop);
+ Assert.IsNull(info.CanInsert);
+ Assert.IsNull(info.OnDrop);
+ }
+
+ [Test]
+ public void Text_Always_ReturnsName()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
+ var context = new ProbabilityFailureMechanismSectionResultContext(failureMechanism.SectionResults,
+ failureMechanism,
+ assessmentSection);
+
+ // Call
+ string text = info.Text(context);
+
+ // Assert
+ Assert.AreEqual("Resultaat", text);
+ }
+
+ [Test]
+ public void Image_Always_ReturnsGenericInputOutputIcon()
+ {
+ // Setup
+ mocks.ReplayAll();
+
+ // Call
+ Image image = info.Image(null);
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.FailureMechanismSectionResultIcon, image);
+ }
+
+ [Test]
+ public void ContextMenuStrip_Always_CallsBuilder()
+ {
+ // Setup
+ var menuBuilder = mocks.StrictMock();
+ menuBuilder.Expect(mb => mb.AddOpenItem()).Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.Build()).Return(null);
+
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var gui = mocks.Stub();
+ gui.Stub(g => g.Get(null, treeViewControl)).Return(menuBuilder);
+
+ mocks.ReplayAll();
+
+ plugin.Gui = gui;
+
+ // Call
+ info.ContextMenuStrip(null, null, treeViewControl);
+ }
+ // Assert
+ // Assert expectancies are called in TearDown()
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag e1a93747d105f27392f4bc0655694810c7d29f4d refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/TreeNodeInfos/ProbabilityFailureMechanismSectionResultContextTreeNodeInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresFailureMechanismSection2aAssessmentResultExtensions.cs
===================================================================
diff -u
--- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresFailureMechanismSection2aAssessmentResultExtensions.cs (revision 0)
+++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresFailureMechanismSection2aAssessmentResultExtensions.cs (revision e1a93747d105f27392f4bc0655694810c7d29f4d)
@@ -0,0 +1,74 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.Probability;
+using Ringtoets.Common.Data.Structures;
+
+namespace Ringtoets.HeightStructures.Data
+{
+ ///
+ /// Extension methods for obtaining level 2a results from output for an assessment of the
+ /// height structures failure mechanism.
+ ///
+ public static class HeightStructuresFailureMechanismSection2aAssessmentResultExtensions
+ {
+ ///
+ /// Gets the value for the detailed assessment of safety per failure mechanism section as a probability.
+ ///
+ /// The section result to get the assessment layer 2A for.
+ /// The failure mechanism the calculations belong to.
+ /// The assessment section the calculations belong to.
+ /// The calculated assessment layer 2A; or when there is no
+ /// calculation assigned to the section result or the calculation is not performed.
+ /// Thrown when any parameter is null.
+ public static double GetAssessmentLayerTwoA(this StructuresFailureMechanismSectionResult sectionResult,
+ HeightStructuresFailureMechanism failureMechanism,
+ IAssessmentSection assessmentSection)
+ {
+ if (sectionResult == null)
+ {
+ throw new ArgumentNullException(nameof(sectionResult));
+ }
+
+ if (failureMechanism == null)
+ {
+ throw new ArgumentNullException(nameof(failureMechanism));
+ }
+
+ if (assessmentSection == null)
+ {
+ throw new ArgumentNullException(nameof(assessmentSection));
+ }
+
+ if (sectionResult.Calculation == null || !sectionResult.Calculation.HasOutput)
+ {
+ return double.NaN;
+ }
+
+ ProbabilityAssessmentOutput derivedOutput = HeightStructuresProbabilityAssessmentOutputFactory.Create(sectionResult.Calculation.Output,
+ failureMechanism, assessmentSection);
+
+ return derivedOutput.Probability;
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag e1a93747d105f27392f4bc0655694810c7d29f4d refers to a dead (removed) revision in file `Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresfailureMechanismSection2aAssessmentResultExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresFailureMechanismSection2aAssessmentResultExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresFailureMechanismSection2aAssessmentResultExtensionsTest.cs (revision 0)
+++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresFailureMechanismSection2aAssessmentResultExtensionsTest.cs (revision e1a93747d105f27392f4bc0655694810c7d29f4d)
@@ -0,0 +1,158 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.Data.Structures;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.HeightStructures.Data.TestUtil;
+
+namespace Ringtoets.HeightStructures.Data.Test
+{
+ [TestFixture]
+ public class HeightStructuresFailureMechanismSection2aAssessmentResultExtensionsTest
+ {
+ [Test]
+ public void GetAssessmentLayerTwoA_SectionResultNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ // Call
+ TestDelegate call = () => HeightStructuresFailureMechanismSection2aAssessmentResultExtensions.GetAssessmentLayerTwoA(null,
+ new HeightStructuresFailureMechanism(),
+ assessmentSection);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("sectionResult", exception.ParamName);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void GetAssessmentLayerTwoA_FailureMechanismNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var failureMechanismSectionResult = new StructuresFailureMechanismSectionResult(section);
+
+ // Call
+ TestDelegate call = () => failureMechanismSectionResult.GetAssessmentLayerTwoA(null, assessmentSection);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("failureMechanism", exception.ParamName);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void GetAssessmentLayerTwoA_AssessmentSectionNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var failureMechanismSectionResult = new StructuresFailureMechanismSectionResult(section);
+
+ // Call
+ TestDelegate call = () => failureMechanismSectionResult.GetAssessmentLayerTwoA(new HeightStructuresFailureMechanism(), null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("assessmentSection", exception.ParamName);
+ }
+
+ [Test]
+ public void GetAssessmentLayerTwoA_SectionResultWithoutCalculation_ReturnsNaN()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var failureMechanismSectionResult = new StructuresFailureMechanismSectionResult(section);
+
+ // Call
+ double assessmentLayerTwoA = failureMechanismSectionResult.GetAssessmentLayerTwoA(new HeightStructuresFailureMechanism(), assessmentSection);
+
+ // Assert
+ Assert.IsNaN(assessmentLayerTwoA);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void GetAssessmentLayerTwoA_CalculationWithoutOutput_ReturnsNaN()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var failureMechanismSectionResult = new StructuresFailureMechanismSectionResult(section)
+ {
+ Calculation = new TestHeightStructuresCalculation()
+ };
+
+ // Call
+ double assessmentLayerTwoA = failureMechanismSectionResult.GetAssessmentLayerTwoA(new HeightStructuresFailureMechanism(), assessmentSection);
+
+ // Assert
+ Assert.IsNaN(assessmentLayerTwoA);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void GetAssessmentLayerTwoA_CalculationWithOutput_ReturnsDerivedProbability()
+ {
+ // Setup
+ var failureMechanism = new HeightStructuresFailureMechanism();
+
+ var mocks = new MockRepository();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
+ mocks.ReplayAll();
+
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var failureMechanismSectionResult = new StructuresFailureMechanismSectionResult(section)
+ {
+ Calculation = new TestHeightStructuresCalculation
+ {
+ Output = new TestStructuresOutput(new Random(39).NextDouble())
+ }
+ };
+
+ // Call
+ double assessmentLayerTwoA = failureMechanismSectionResult.GetAssessmentLayerTwoA(new HeightStructuresFailureMechanism(), assessmentSection);
+
+ // Assert
+ Assert.AreEqual(0.45984249809357164, assessmentLayerTwoA);
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag e1a93747d105f27392f4bc0655694810c7d29f4d refers to a dead (removed) revision in file `Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresfailureMechanismSection2aAssessmentResultExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PresentationObjects/HeightStructuresOutputContextTest.cs
===================================================================
diff -u -r78c111ebbe15d17e3a54a3910642f520b593586d -re1a93747d105f27392f4bc0655694810c7d29f4d
--- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PresentationObjects/HeightStructuresOutputContextTest.cs (.../HeightStructuresOutputContextTest.cs) (revision 78c111ebbe15d17e3a54a3910642f520b593586d)
+++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PresentationObjects/HeightStructuresOutputContextTest.cs (.../HeightStructuresOutputContextTest.cs) (revision e1a93747d105f27392f4bc0655694810c7d29f4d)
@@ -71,6 +71,7 @@
// Assert
var exception = Assert.Throws(call);
Assert.AreEqual("failureMechanism", exception.ParamName);
+ mocks.VerifyAll();
}
}
}
\ No newline at end of file
Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/Ringtoets.HeightStructures.Plugin.Test.csproj
===================================================================
diff -u -r41864fb27f6bb9d542e5775f998f6802c4b42247 -re1a93747d105f27392f4bc0655694810c7d29f4d
--- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/Ringtoets.HeightStructures.Plugin.Test.csproj (.../Ringtoets.HeightStructures.Plugin.Test.csproj) (revision 41864fb27f6bb9d542e5775f998f6802c4b42247)
+++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/Ringtoets.HeightStructures.Plugin.Test.csproj (.../Ringtoets.HeightStructures.Plugin.Test.csproj) (revision e1a93747d105f27392f4bc0655694810c7d29f4d)
@@ -34,7 +34,7 @@
-
+
Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructuresProbabilityFailureMechanismResultContextTreeNodeInfoTest.cs
===================================================================
diff -u
--- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructuresProbabilityFailureMechanismResultContextTreeNodeInfoTest.cs (revision 0)
+++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructuresProbabilityFailureMechanismResultContextTreeNodeInfoTest.cs (revision e1a93747d105f27392f4bc0655694810c7d29f4d)
@@ -0,0 +1,145 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System.Drawing;
+using System.Linq;
+using Core.Common.Controls.TreeView;
+using Core.Common.Gui;
+using Core.Common.Gui.ContextMenu;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.Structures;
+using Ringtoets.Common.Forms.PresentationObjects;
+using Ringtoets.HeightStructures.Data;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.HeightStructures.Plugin.Test.TreeNodeInfos
+{
+ [TestFixture]
+ public class HeightStructuresProbabilityFailureMechanismResultContextTreeNodeInfoTest
+ {
+ private MockRepository mocks;
+ private HeightStructuresPlugin plugin;
+ private TreeNodeInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ mocks = new MockRepository();
+ plugin = new HeightStructuresPlugin();
+ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(ProbabilityFailureMechanismSectionResultContext>));
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ plugin.Dispose();
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Setup
+ mocks.ReplayAll();
+
+ // Assert
+ Assert.IsNotNull(info.Text);
+ Assert.IsNull(info.ForeColor);
+ Assert.IsNotNull(info.Image);
+ Assert.IsNotNull(info.ContextMenuStrip);
+ Assert.IsNull(info.EnsureVisibleOnCreate);
+ Assert.IsNull(info.ExpandOnCreate);
+ Assert.IsNull(info.ChildNodeObjects);
+ Assert.IsNull(info.CanRename);
+ Assert.IsNull(info.OnNodeRenamed);
+ Assert.IsNull(info.CanRemove);
+ Assert.IsNull(info.OnNodeRemoved);
+ Assert.IsNull(info.CanCheck);
+ Assert.IsNull(info.IsChecked);
+ Assert.IsNull(info.OnNodeChecked);
+ Assert.IsNull(info.CanDrag);
+ Assert.IsNull(info.CanDrop);
+ Assert.IsNull(info.CanInsert);
+ Assert.IsNull(info.OnDrop);
+ }
+
+ [Test]
+ public void Text_Always_ReturnsFailureMechanismSectionResultDisplayName()
+ {
+ // Setup
+ mocks.ReplayAll();
+
+ // Call
+ string text = info.Text(null);
+
+ // Assert
+ Assert.AreEqual(RingtoetsCommonFormsResources.FailureMechanism_AssessmentResult_DisplayName, text);
+ }
+
+ [Test]
+ public void Image_Always_ReturnsFailureMechanismSectionResultIcon()
+ {
+ // Setup
+ mocks.ReplayAll();
+
+ // Call
+ Image image = info.Image(null);
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.FailureMechanismSectionResultIcon, image);
+ }
+
+ [Test]
+ public void ContextMenuStrip_Always_CallsContextMenuBuilderMethods()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ var menuBuilder = mocks.StrictMock();
+ using (mocks.Ordered())
+ {
+ menuBuilder.Expect(mb => mb.AddOpenItem()).Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.Build()).Return(null);
+ }
+
+ var failureMechanism = new HeightStructuresFailureMechanism();
+ var context = new ProbabilityFailureMechanismSectionResultContext>(
+ Enumerable.Empty>(), failureMechanism, assessmentSection);
+
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var gui = mocks.Stub();
+ gui.Stub(cmp => cmp.Get(context, treeViewControl)).Return(menuBuilder);
+
+ mocks.ReplayAll();
+
+ plugin.Gui = gui;
+
+ // Call
+ info.ContextMenuStrip(context, null, treeViewControl);
+ }
+ // Assert
+ // Assert expectancies are called in TearDown()
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag e1a93747d105f27392f4bc0655694810c7d29f4d refers to a dead (removed) revision in file `Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/ProbabilityFailureMechanismResultContextTreeNodeInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/Ringtoets.MacroStabilityInwards.Plugin.Test.csproj
===================================================================
diff -u -rfb3c4216478c0f072cf2f1a94053e81756ced5c7 -re1a93747d105f27392f4bc0655694810c7d29f4d
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/Ringtoets.MacroStabilityInwards.Plugin.Test.csproj (.../Ringtoets.MacroStabilityInwards.Plugin.Test.csproj) (revision fb3c4216478c0f072cf2f1a94053e81756ced5c7)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/Ringtoets.MacroStabilityInwards.Plugin.Test.csproj (.../Ringtoets.MacroStabilityInwards.Plugin.Test.csproj) (revision e1a93747d105f27392f4bc0655694810c7d29f4d)
@@ -53,7 +53,7 @@
-
+
Fisheye: Tag e1a93747d105f27392f4bc0655694810c7d29f4d refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsFailureMechanismSectionResultContextTreeNodeInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsProbabilityFailureMechanismSectionResultContextTreeNodeInfoTest.cs
===================================================================
diff -u
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsProbabilityFailureMechanismSectionResultContextTreeNodeInfoTest.cs (revision 0)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsProbabilityFailureMechanismSectionResultContextTreeNodeInfoTest.cs (revision e1a93747d105f27392f4bc0655694810c7d29f4d)
@@ -0,0 +1,140 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System.Drawing;
+using System.Linq;
+using Core.Common.Controls.TreeView;
+using Core.Common.Gui;
+using Core.Common.Gui.ContextMenu;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Forms.PresentationObjects;
+using Ringtoets.MacroStabilityInwards.Data;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.MacroStabilityInwards.Plugin.Test.TreeNodeInfos
+{
+ [TestFixture]
+ public class MacroStabilityInwardsProbabilityFailureMechanismSectionResultContextTreeNodeInfoTest
+ {
+ private MockRepository mocks;
+ private MacroStabilityInwardsPlugin plugin;
+ private TreeNodeInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ mocks = new MockRepository();
+ plugin = new MacroStabilityInwardsPlugin();
+ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(ProbabilityFailureMechanismSectionResultContext));
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ plugin.Dispose();
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Setup
+ mocks.ReplayAll();
+
+ // Assert
+ Assert.IsNotNull(info.Text);
+ Assert.IsNull(info.ForeColor);
+ Assert.IsNotNull(info.Image);
+ Assert.IsNotNull(info.ContextMenuStrip);
+ Assert.IsNull(info.EnsureVisibleOnCreate);
+ Assert.IsNull(info.ExpandOnCreate);
+ Assert.IsNull(info.ChildNodeObjects);
+ Assert.IsNull(info.CanRename);
+ Assert.IsNull(info.OnNodeRenamed);
+ Assert.IsNull(info.CanRemove);
+ Assert.IsNull(info.OnNodeRemoved);
+ Assert.IsNull(info.CanCheck);
+ Assert.IsNull(info.IsChecked);
+ Assert.IsNull(info.OnNodeChecked);
+ Assert.IsNull(info.CanDrag);
+ Assert.IsNull(info.CanDrop);
+ Assert.IsNull(info.CanInsert);
+ Assert.IsNull(info.OnDrop);
+ }
+
+ [Test]
+ public void Text_Always_ReturnsName()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var mechanism = new MacroStabilityInwardsFailureMechanism();
+ var context = new ProbabilityFailureMechanismSectionResultContext(mechanism.SectionResults, mechanism, assessmentSection);
+
+ // Call
+ string text = info.Text(context);
+
+ // Assert
+ Assert.AreEqual("Resultaat", text);
+ }
+
+ [Test]
+ public void Image_Always_ReturnsGenericInputOutputIcon()
+ {
+ // Setup
+ mocks.ReplayAll();
+
+ // Call
+ Image image = info.Image(null);
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.FailureMechanismSectionResultIcon, image);
+ }
+
+ [Test]
+ public void ContextMenuStrip_Always_CallsBuilder()
+ {
+ // Setup
+ var menuBuilder = mocks.StrictMock();
+ menuBuilder.Expect(mb => mb.AddOpenItem()).Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.Build()).Return(null);
+
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var gui = mocks.Stub();
+ gui.Stub(g => g.Get(null, treeViewControl)).Return(menuBuilder);
+
+ mocks.ReplayAll();
+
+ plugin.Gui = gui;
+
+ // Call
+ info.ContextMenuStrip(null, null, treeViewControl);
+ }
+ // Assert
+ // Assert expectancies are called in TearDown()
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/Ringtoets.Piping.Plugin.Test.csproj
===================================================================
diff -u -r5b421f80047c5b98776fb1c6f4a216775066e805 -re1a93747d105f27392f4bc0655694810c7d29f4d
--- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/Ringtoets.Piping.Plugin.Test.csproj (.../Ringtoets.Piping.Plugin.Test.csproj) (revision 5b421f80047c5b98776fb1c6f4a216775066e805)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/Ringtoets.Piping.Plugin.Test.csproj (.../Ringtoets.Piping.Plugin.Test.csproj) (revision e1a93747d105f27392f4bc0655694810c7d29f4d)
@@ -54,7 +54,7 @@
-
+
Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/PipingProbabilityFailureMechanismSectionResultContextTreeNodeInfoTest.cs
===================================================================
diff -u
--- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/PipingProbabilityFailureMechanismSectionResultContextTreeNodeInfoTest.cs (revision 0)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/PipingProbabilityFailureMechanismSectionResultContextTreeNodeInfoTest.cs (revision e1a93747d105f27392f4bc0655694810c7d29f4d)
@@ -0,0 +1,140 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System.Drawing;
+using System.Linq;
+using Core.Common.Controls.TreeView;
+using Core.Common.Gui;
+using Core.Common.Gui.ContextMenu;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Forms.PresentationObjects;
+using Ringtoets.Piping.Data;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.Piping.Plugin.Test.TreeNodeInfos
+{
+ [TestFixture]
+ public class PipingProbabilityFailureMechanismSectionResultContextTreeNodeInfoTest
+ {
+ private MockRepository mocks;
+ private PipingPlugin plugin;
+ private TreeNodeInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ mocks = new MockRepository();
+ plugin = new PipingPlugin();
+ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(ProbabilityFailureMechanismSectionResultContext));
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ plugin.Dispose();
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Setup
+ mocks.ReplayAll();
+
+ // Assert
+ Assert.IsNotNull(info.Text);
+ Assert.IsNull(info.ForeColor);
+ Assert.IsNotNull(info.Image);
+ Assert.IsNotNull(info.ContextMenuStrip);
+ Assert.IsNull(info.EnsureVisibleOnCreate);
+ Assert.IsNull(info.ExpandOnCreate);
+ Assert.IsNull(info.ChildNodeObjects);
+ Assert.IsNull(info.CanRename);
+ Assert.IsNull(info.OnNodeRenamed);
+ Assert.IsNull(info.CanRemove);
+ Assert.IsNull(info.OnNodeRemoved);
+ Assert.IsNull(info.CanCheck);
+ Assert.IsNull(info.IsChecked);
+ Assert.IsNull(info.OnNodeChecked);
+ Assert.IsNull(info.CanDrag);
+ Assert.IsNull(info.CanDrop);
+ Assert.IsNull(info.CanInsert);
+ Assert.IsNull(info.OnDrop);
+ }
+
+ [Test]
+ public void Text_Always_ReturnsName()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var mechanism = new PipingFailureMechanism();
+ var context = new ProbabilityFailureMechanismSectionResultContext(mechanism.SectionResults, mechanism, assessmentSection);
+
+ // Call
+ string text = info.Text(context);
+
+ // Assert
+ Assert.AreEqual("Resultaat", text);
+ }
+
+ [Test]
+ public void Image_Always_ReturnsGenericInputOutputIcon()
+ {
+ // Setup
+ mocks.ReplayAll();
+
+ // Call
+ Image image = info.Image(null);
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.FailureMechanismSectionResultIcon, image);
+ }
+
+ [Test]
+ public void ContextMenuStrip_Always_CallsBuilder()
+ {
+ // Setup
+ var menuBuilder = mocks.StrictMock();
+ menuBuilder.Expect(mb => mb.AddOpenItem()).Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.Build()).Return(null);
+
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var gui = mocks.Stub();
+ gui.Stub(g => g.Get(null, treeViewControl)).Return(menuBuilder);
+
+ mocks.ReplayAll();
+
+ plugin.Gui = gui;
+
+ // Call
+ info.ContextMenuStrip(null, null, treeViewControl);
+ }
+ // Assert
+ // Assert expectancies are called in TearDown()
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag e1a93747d105f27392f4bc0655694810c7d29f4d refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/ProbabilityFailureMechanismSectionResultContextTreeNodeInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismResultView.cs
===================================================================
diff -u -r56246f10e7876b30f36a5b9709ec2e3332b4010a -re1a93747d105f27392f4bc0655694810c7d29f4d
--- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismResultView.cs (.../StabilityPointStructuresFailureMechanismResultView.cs) (revision 56246f10e7876b30f36a5b9709ec2e3332b4010a)
+++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismResultView.cs (.../StabilityPointStructuresFailureMechanismResultView.cs) (revision e1a93747d105f27392f4bc0655694810c7d29f4d)
@@ -35,7 +35,8 @@
namespace Ringtoets.StabilityPointStructures.Forms.Views
{
///
- /// The view for a collection of .
+ /// The view for a collection of
+ /// for stability point structures.
///
public class StabilityPointStructuresFailureMechanismResultView : FailureMechanismResultView>
{
Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructuresFailureMechanismSection2aAssessmentResultExtensionsTest.cs
===================================================================
diff -u -raee2e55bc9dbf0bbe1fac86898575c7faa33162c -re1a93747d105f27392f4bc0655694810c7d29f4d
--- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructuresFailureMechanismSection2aAssessmentResultExtensionsTest.cs (.../StabilityPointStructuresFailureMechanismSection2aAssessmentResultExtensionsTest.cs) (revision aee2e55bc9dbf0bbe1fac86898575c7faa33162c)
+++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructuresFailureMechanismSection2aAssessmentResultExtensionsTest.cs (.../StabilityPointStructuresFailureMechanismSection2aAssessmentResultExtensionsTest.cs) (revision e1a93747d105f27392f4bc0655694810c7d29f4d)
@@ -143,15 +143,15 @@
{
Calculation = new TestStabilityPointStructuresCalculation
{
- Output = new TestStructuresOutput()
+ Output = new TestStructuresOutput(new Random(39).NextDouble())
}
};
// Call
double assessmentLayerTwoA = failureMechanismSectionResult.GetAssessmentLayerTwoA(new StabilityPointStructuresFailureMechanism(), assessmentSection);
// Assert
- Assert.AreEqual(0.5, assessmentLayerTwoA);
+ Assert.AreEqual(0.45984249809357164, assessmentLayerTwoA);
mocks.VerifyAll();
}
}
Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/PresentationObjects/StabilityPointStructuresOutputContextTest.cs
===================================================================
diff -u -r24e2537b4196c44643459f11f568970b17979316 -re1a93747d105f27392f4bc0655694810c7d29f4d
--- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/PresentationObjects/StabilityPointStructuresOutputContextTest.cs (.../StabilityPointStructuresOutputContextTest.cs) (revision 24e2537b4196c44643459f11f568970b17979316)
+++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/PresentationObjects/StabilityPointStructuresOutputContextTest.cs (.../StabilityPointStructuresOutputContextTest.cs) (revision e1a93747d105f27392f4bc0655694810c7d29f4d)
@@ -71,6 +71,7 @@
// Assert
var exception = Assert.Throws(call);
Assert.AreEqual("failureMechanism", exception.ParamName);
+ mocks.VerifyAll();
}
}
}
\ No newline at end of file
Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismResultViewTest.cs
===================================================================
diff -u -rbdfc832a125e7fac88579677e784a29a7ca1340b -re1a93747d105f27392f4bc0655694810c7d29f4d
--- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismResultViewTest.cs (.../StabilityPointStructuresFailureMechanismResultViewTest.cs) (revision bdfc832a125e7fac88579677e784a29a7ca1340b)
+++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismResultViewTest.cs (.../StabilityPointStructuresFailureMechanismResultViewTest.cs) (revision e1a93747d105f27392f4bc0655694810c7d29f4d)
@@ -25,7 +25,6 @@
using System.Globalization;
using System.Linq;
using System.Windows.Forms;
-using Core.Common.Base.Data;
using Core.Common.Base.Geometry;
using Core.Common.TestUtil;
using NUnit.Extensions.Forms;
@@ -252,17 +251,17 @@
var result1 = new StructuresFailureMechanismSectionResult(section1)
{
AssessmentLayerOne = AssessmentLayerOneState.Sufficient,
- AssessmentLayerThree = (RoundedDouble) random.NextDouble()
+ AssessmentLayerThree = random.NextRoundedDouble()
};
var result2 = new StructuresFailureMechanismSectionResult(section2)
{
AssessmentLayerOne = AssessmentLayerOneState.NotAssessed,
- AssessmentLayerThree = (RoundedDouble) random.NextDouble()
+ AssessmentLayerThree = random.NextRoundedDouble()
};
var result3 = new StructuresFailureMechanismSectionResult(section3)
{
AssessmentLayerOne = AssessmentLayerOneState.NoVerdict,
- AssessmentLayerThree = (RoundedDouble) random.NextDouble()
+ AssessmentLayerThree = random.NextRoundedDouble()
};
using (StabilityPointStructuresFailureMechanismResultView view = CreateConfiguredFailureMechanismResultsView())
@@ -331,7 +330,7 @@
var result = new StructuresFailureMechanismSectionResult(section)
{
AssessmentLayerOne = assessmentLayerOneState,
- AssessmentLayerThree = (RoundedDouble) random.NextDouble()
+ AssessmentLayerThree = random.NextRoundedDouble()
};
using (StabilityPointStructuresFailureMechanismResultView view = CreateConfiguredFailureMechanismResultsView())
{
Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/Ringtoets.StabilityPointStructures.Plugin.Test.csproj
===================================================================
diff -u -rfb1234bf64085a67f7b277ca86d39f80e15ff644 -re1a93747d105f27392f4bc0655694810c7d29f4d
--- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/Ringtoets.StabilityPointStructures.Plugin.Test.csproj (.../Ringtoets.StabilityPointStructures.Plugin.Test.csproj) (revision fb1234bf64085a67f7b277ca86d39f80e15ff644)
+++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/Ringtoets.StabilityPointStructures.Plugin.Test.csproj (.../Ringtoets.StabilityPointStructures.Plugin.Test.csproj) (revision e1a93747d105f27392f4bc0655694810c7d29f4d)
@@ -41,7 +41,7 @@
-
+
Fisheye: Tag e1a93747d105f27392f4bc0655694810c7d29f4d refers to a dead (removed) revision in file `Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/TreeNodeInfos/ProbabilityFailureMechanismSectionResultContextTreeNodeInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/TreeNodeInfos/StabilityPointStructuresProbabilityFailureMechanismSectionResultContextTreeNodeInfoTest.cs
===================================================================
diff -u
--- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/TreeNodeInfos/StabilityPointStructuresProbabilityFailureMechanismSectionResultContextTreeNodeInfoTest.cs (revision 0)
+++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/TreeNodeInfos/StabilityPointStructuresProbabilityFailureMechanismSectionResultContextTreeNodeInfoTest.cs (revision e1a93747d105f27392f4bc0655694810c7d29f4d)
@@ -0,0 +1,144 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System.Drawing;
+using System.Linq;
+using Core.Common.Controls.TreeView;
+using Core.Common.Gui;
+using Core.Common.Gui.ContextMenu;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.Structures;
+using Ringtoets.Common.Forms.PresentationObjects;
+using Ringtoets.Common.Forms.Properties;
+using Ringtoets.StabilityPointStructures.Data;
+
+namespace Ringtoets.StabilityPointStructures.Plugin.Test.TreeNodeInfos
+{
+ [TestFixture]
+ public class StabilityPointStructuresProbabilityFailureMechanismSectionResultContextTreeNodeInfoTest
+ {
+ private MockRepository mocks;
+ private StabilityPointStructuresPlugin plugin;
+ private TreeNodeInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ mocks = new MockRepository();
+ plugin = new StabilityPointStructuresPlugin();
+ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(ProbabilityFailureMechanismSectionResultContext>));
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ plugin.Dispose();
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Setup
+ mocks.ReplayAll();
+
+ // Assert
+ Assert.IsNotNull(info.Text);
+ Assert.IsNull(info.ForeColor);
+ Assert.IsNotNull(info.Image);
+ Assert.IsNotNull(info.ContextMenuStrip);
+ Assert.IsNull(info.EnsureVisibleOnCreate);
+ Assert.IsNull(info.ExpandOnCreate);
+ Assert.IsNull(info.ChildNodeObjects);
+ Assert.IsNull(info.CanRename);
+ Assert.IsNull(info.OnNodeRenamed);
+ Assert.IsNull(info.CanRemove);
+ Assert.IsNull(info.OnNodeRemoved);
+ Assert.IsNull(info.CanCheck);
+ Assert.IsNull(info.IsChecked);
+ Assert.IsNull(info.OnNodeChecked);
+ Assert.IsNull(info.CanDrag);
+ Assert.IsNull(info.CanDrop);
+ Assert.IsNull(info.CanInsert);
+ Assert.IsNull(info.OnDrop);
+ }
+
+ [Test]
+ public void Text_Always_ReturnsName()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var mechanism = new StabilityPointStructuresFailureMechanism();
+ var context = new ProbabilityFailureMechanismSectionResultContext>(
+ mechanism.SectionResults, mechanism, assessmentSection);
+
+ // Call
+ string text = info.Text(context);
+
+ // Assert
+ Assert.AreEqual("Resultaat", text);
+ }
+
+ [Test]
+ public void Image_Always_ReturnsFailureMechanismSectionResultIcon()
+ {
+ // Setup
+ mocks.ReplayAll();
+
+ // Call
+ Image image = info.Image(null);
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(Resources.FailureMechanismSectionResultIcon, image);
+ }
+
+ [Test]
+ public void ContextMenuStrip_Always_CallsBuilder()
+ {
+ // Setup
+ var menuBuilder = mocks.StrictMock();
+ menuBuilder.Expect(mb => mb.AddOpenItem()).Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.Build()).Return(null);
+
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var gui = mocks.Stub();
+ gui.Stub(g => g.Get(null, treeViewControl)).Return(menuBuilder);
+ gui.Stub(g => g.ProjectOpened += null).IgnoreArguments();
+ gui.Stub(g => g.ProjectOpened -= null).IgnoreArguments();
+
+ mocks.ReplayAll();
+
+ plugin.Gui = gui;
+
+ // Call
+ info.ContextMenuStrip(null, null, treeViewControl);
+ }
+ // Assert
+ // Assert expectancies are called in TearDown()
+ }
+ }
+}
\ No newline at end of file