Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/AssessmentSectionCompositionProperties.cs
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/AssessmentSectionCompositionProperties.cs (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/AssessmentSectionCompositionProperties.cs (revision c602baeb36d745d3a356bd7832e132cb21cad711)
@@ -0,0 +1,95 @@
+// 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 System.Collections.Generic;
+using System.ComponentModel;
+using Core.Common.Base;
+using Core.Common.Gui.Attributes;
+using Core.Common.Gui.PropertyBag;
+using Core.Common.Util;
+using Core.Common.Util.Attributes;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Integration.Forms.Properties;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.Integration.Forms.PropertyClasses
+{
+ ///
+ /// ViewModel of the composition of an for properties panel.
+ ///
+ public class AssessmentSectionCompositionProperties : ObjectProperties
+ {
+ private readonly IAssessmentSectionCompositionChangeHandler compositionChangeHandler;
+ private readonly IAssessmentSection assessmentSection;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The assessment section for which the properties are shown.
+ /// The for when the composition changes.
+ /// Thrown when any parameter is null.
+ public AssessmentSectionCompositionProperties(
+ IAssessmentSection assessmentSection,
+ IAssessmentSectionCompositionChangeHandler compositionChangeHandler)
+ {
+ if (assessmentSection == null)
+ {
+ throw new ArgumentNullException(nameof(assessmentSection));
+ }
+
+ if (compositionChangeHandler == null)
+ {
+ throw new ArgumentNullException(nameof(compositionChangeHandler));
+ }
+
+ Data = assessmentSection;
+ this.compositionChangeHandler = compositionChangeHandler;
+ this.assessmentSection = assessmentSection;
+ }
+
+ [PropertyOrder(1)]
+ [TypeConverter(typeof(EnumTypeConverter))]
+ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.FailureMechanismContribution_Composition_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.FailureMechanismContribution_Composition_Description))]
+ public AssessmentSectionComposition AssessmentSectionComposition
+ {
+ get
+ {
+ return assessmentSection.Composition;
+ }
+ set
+ {
+ if (compositionChangeHandler.ConfirmCompositionChange())
+ {
+ IEnumerable changedObjects = compositionChangeHandler.ChangeComposition(assessmentSection, value);
+ foreach (IObservable changedObject in changedObjects)
+ {
+ changedObject.NotifyObservers();
+ }
+
+ data.FailureMechanismContribution.NotifyObservers();
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag c602baeb36d745d3a356bd7832e132cb21cad711 refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/FailureMechanismContributionProperties.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj
===================================================================
diff -u -r2d3979f45682cd0678d8210208c468bee4095619 -rc602baeb36d745d3a356bd7832e132cb21cad711
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 2d3979f45682cd0678d8210208c468bee4095619)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision c602baeb36d745d3a356bd7832e132cb21cad711)
@@ -42,7 +42,7 @@
-
+
Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs
===================================================================
diff -u -r2d3979f45682cd0678d8210208c468bee4095619 -rc602baeb36d745d3a356bd7832e132cb21cad711
--- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 2d3979f45682cd0678d8210208c468bee4095619)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision c602baeb36d745d3a356bd7832e132cb21cad711)
@@ -301,12 +301,10 @@
{
CreateInstance = context => new HydraulicBoundaryDatabaseProperties(context.WrappedData)
};
- yield return new PropertyInfo
+ yield return new PropertyInfo
{
- CreateInstance = context => new FailureMechanismContributionProperties(
- context.WrappedData,
+ CreateInstance = context => new AssessmentSectionCompositionProperties(
context.Parent,
- new FailureMechanismContributionNormChangeHandler(context.Parent),
new AssessmentSectionCompositionChangeHandler(Gui.ViewCommands))
};
yield return new PropertyInfo
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/AssessmentSectionCompositionPropertiesTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/AssessmentSectionCompositionPropertiesTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/AssessmentSectionCompositionPropertiesTest.cs (revision c602baeb36d745d3a356bd7832e132cb21cad711)
@@ -0,0 +1,265 @@
+// 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 System.ComponentModel;
+using Core.Common.Base;
+using Core.Common.Gui.Commands;
+using Core.Common.Gui.PropertyBag;
+using Core.Common.TestUtil;
+using NUnit.Extensions.Forms;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.Contribution;
+using Ringtoets.Integration.Data;
+using Ringtoets.Integration.Forms.PropertyClasses;
+using Ringtoets.Integration.Plugin.Handlers;
+
+namespace Ringtoets.Integration.Forms.Test.PropertyClasses
+{
+ [TestFixture]
+ public class AssessmentSectionCompositionPropertiesTest : NUnitFormTest
+ {
+ [Test]
+ public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSectionChangeHandler = mocks.Stub();
+ mocks.ReplayAll();
+
+ // Call
+ TestDelegate test = () => new AssessmentSectionCompositionProperties(
+ null,
+ assessmentSectionChangeHandler);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("assessmentSection", paramName);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_AssessmentSectionCompositionChangeHandlerNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ // Call
+ TestDelegate test = () => new AssessmentSectionCompositionProperties(
+ assessmentSection,
+ null);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("compositionChangeHandler", paramName);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_ValidData_ExpectedValues()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ var assessmentSectionChangeHandler = mocks.Stub();
+ mocks.ReplayAll();
+
+ // Call
+ var properties = new AssessmentSectionCompositionProperties(
+ assessmentSection,
+ assessmentSectionChangeHandler);
+
+ // Assert
+ Assert.IsInstanceOf>(properties);
+ Assert.AreSame(assessmentSection, properties.Data);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_WithValidParameters_DataSet()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ var assessmentSectionChangeHandler = mocks.Stub();
+ mocks.ReplayAll();
+
+ // Call
+ var properties = new AssessmentSectionCompositionProperties(
+ assessmentSection,
+ assessmentSectionChangeHandler);
+
+ // Assert
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
+
+ Assert.AreEqual(1, dynamicProperties.Count);
+
+ const string expectedCategory = "Algemeen";
+
+ PropertyDescriptor compositionProperty = dynamicProperties[0];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(compositionProperty,
+ expectedCategory,
+ "Trajecttype",
+ "Selecteer het type traject, bepalend voor de faalkansbegroting.");
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void GetProperties_WithData_ReturnExpectedValues()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ const AssessmentSectionComposition assessmentSectionComposition = AssessmentSectionComposition.DikeAndDune;
+ var assessmentSection = mocks.Stub();
+ assessmentSection.Stub(section => section.Composition).Return(assessmentSectionComposition);
+ var assessmentSectionChangeHandler = mocks.Stub();
+ mocks.ReplayAll();
+
+ // Call
+ var properties = new AssessmentSectionCompositionProperties(
+ assessmentSection,
+ assessmentSectionChangeHandler);
+
+ // Assert
+ Assert.AreEqual(assessmentSectionComposition, properties.AssessmentSectionComposition);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void GivenAssessmentSectionComposition_WhenConfirmingCompositionValueChange_ThenAssessmentSectionCompositionSetAndNotifiesObserver()
+ {
+ // Given
+ const AssessmentSectionComposition originalComposition = AssessmentSectionComposition.Dike;
+ var assessmentSection = new AssessmentSection(originalComposition);
+ FailureMechanismContribution failureMechanismContribution = assessmentSection.FailureMechanismContribution;
+
+ var mocks = new MockRepository();
+ var observer = mocks.StrictMock();
+ failureMechanismContribution.Attach(observer);
+ observer.Expect(o => o.UpdateObserver());
+ var viewCommands = mocks.Stub();
+ mocks.ReplayAll();
+
+ var compositionChangeHandler = new AssessmentSectionCompositionChangeHandler(viewCommands);
+
+ var properties = new AssessmentSectionCompositionProperties(
+ assessmentSection,
+ compositionChangeHandler);
+
+ DialogBoxHandler = (name, wnd) =>
+ {
+ var messageBox = new MessageBoxTester(wnd);
+ messageBox.ClickOk();
+ };
+
+ // When
+ const AssessmentSectionComposition newComposition = AssessmentSectionComposition.DikeAndDune;
+ properties.AssessmentSectionComposition = newComposition;
+
+ // Then
+ Assert.AreEqual(newComposition, properties.AssessmentSectionComposition);
+ Assert.AreEqual(newComposition, assessmentSection.Composition);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void GivenAssessmentSectionComposition_WhenCancelingCompositionValueChange_ThenDataSameObserversNotNotified()
+ {
+ // Given
+ const AssessmentSectionComposition originalComposition = AssessmentSectionComposition.Dike;
+ var assessmentSection = new AssessmentSection(originalComposition);
+ FailureMechanismContribution failureMechanismContribution = assessmentSection.FailureMechanismContribution;
+
+ var mocks = new MockRepository();
+ var observer = mocks.StrictMock();
+ failureMechanismContribution.Attach(observer);
+
+ var viewCommands = mocks.Stub();
+ mocks.ReplayAll();
+
+ var compositionChangeHandler = new AssessmentSectionCompositionChangeHandler(viewCommands);
+
+ var properties = new AssessmentSectionCompositionProperties(
+ assessmentSection,
+ compositionChangeHandler);
+
+ DialogBoxHandler = (name, wnd) =>
+ {
+ var messageBox = new MessageBoxTester(wnd);
+ messageBox.ClickCancel();
+ };
+
+ // When
+ const AssessmentSectionComposition newComposition = AssessmentSectionComposition.DikeAndDune;
+ properties.AssessmentSectionComposition = newComposition;
+
+ // Then
+ Assert.AreEqual(originalComposition, properties.AssessmentSectionComposition);
+ Assert.AreEqual(originalComposition, assessmentSection.Composition);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [TestCase(AssessmentSectionComposition.Dike, AssessmentSectionComposition.Dune)]
+ [TestCase(AssessmentSectionComposition.Dike, AssessmentSectionComposition.DikeAndDune)]
+ [TestCase(AssessmentSectionComposition.Dune, AssessmentSectionComposition.Dike)]
+ [TestCase(AssessmentSectionComposition.Dune, AssessmentSectionComposition.DikeAndDune)]
+ [TestCase(AssessmentSectionComposition.DikeAndDune, AssessmentSectionComposition.Dike)]
+ [TestCase(AssessmentSectionComposition.DikeAndDune, AssessmentSectionComposition.Dune)]
+ public void AssessmentSectionComposition_CompositionValueChanges_NotifiesChangedObjectsInAssessmentSection(
+ AssessmentSectionComposition initialComposition, AssessmentSectionComposition newComposition)
+ {
+ // Setup
+ var assessmentSection = new AssessmentSection(initialComposition);
+
+ var mocks = new MockRepository();
+ var observable1 = mocks.StrictMock();
+ observable1.Expect(o => o.NotifyObservers());
+ var observable2 = mocks.StrictMock();
+ observable2.Expect(o => o.NotifyObservers());
+
+ var compositionChangeHandler = mocks.StrictMock();
+ compositionChangeHandler.Expect(h => h.ConfirmCompositionChange())
+ .Return(true);
+ compositionChangeHandler.Expect(h => h.ChangeComposition(assessmentSection, newComposition))
+ .Return(new[]
+ {
+ observable1,
+ observable2
+ });
+ mocks.ReplayAll();
+
+ var properties = new AssessmentSectionCompositionProperties(
+ assessmentSection,
+ compositionChangeHandler);
+
+ // Call
+ properties.AssessmentSectionComposition = newComposition;
+
+ // Assert
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag c602baeb36d745d3a356bd7832e132cb21cad711 refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/FailureMechanismContributionPropertiesIntegrationTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag c602baeb36d745d3a356bd7832e132cb21cad711 refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/FailureMechanismContributionPropertiesTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/NormPropertiesIntegrationTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/NormPropertiesIntegrationTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/NormPropertiesIntegrationTest.cs (revision c602baeb36d745d3a356bd7832e132cb21cad711)
@@ -0,0 +1,844 @@
+// 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 System.Linq;
+using Core.Common.Base;
+using Core.Common.TestUtil;
+using NUnit.Extensions.Forms;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.Data.Contribution;
+using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Data.Structures;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.GrassCoverErosionInwards.Data;
+using Ringtoets.GrassCoverErosionInwards.Data.TestUtil;
+using Ringtoets.HeightStructures.Data;
+using Ringtoets.Integration.Data;
+using Ringtoets.Integration.Forms.PropertyClasses;
+using Ringtoets.Integration.Plugin.Handlers;
+using Ringtoets.Piping.Data;
+using Ringtoets.Piping.Data.TestUtil;
+
+namespace Ringtoets.Integration.Forms.Test.PropertyClasses
+{
+ [TestFixture]
+ public class NormPropertiesIntegrationTest : NUnitFormTest
+ {
+ private const string messageAllHydraulicBoundaryLocationOutputCleared =
+ "Alle berekende resultaten voor alle hydraulische randvoorwaardenlocaties zijn verwijderd.";
+
+ private const string messageCalculationsremoved = "De resultaten van {0} berekeningen zijn verwijderd.";
+ private const NormType newNormativeNorm = NormType.Signaling;
+ private const double newLowerLimitNorm = 0.01;
+ private const double newSignalingNorm = 0.000001;
+
+ private void SetPropertyAndVerifyNotificationsAndOutputForAllDataSet(Action setPropertyAction)
+ {
+ // Setup
+ const int numberOfCalculations = 3;
+
+ TestHydraulicBoundaryLocation hydraulicBoundaryLocation = TestHydraulicBoundaryLocation.CreateFullyCalculated();
+
+ var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike)
+ {
+ HydraulicBoundaryDatabase =
+ {
+ Locations =
+ {
+ hydraulicBoundaryLocation
+ }
+ }
+ };
+
+ var emptyPipingCalculation = new PipingCalculation(new GeneralPipingInput());
+ var pipingCalculation = new PipingCalculation(new GeneralPipingInput())
+ {
+ Output = PipingOutputTestFactory.Create()
+ };
+ var emptyGrassCoverErosionInwardsCalculation = new GrassCoverErosionInwardsCalculation();
+ var grassCoverErosionInwardsCalculation = new GrassCoverErosionInwardsCalculation
+ {
+ Output = new TestGrassCoverErosionInwardsOutput()
+ };
+ var emptyHeightStructuresCalculation = new StructuresCalculation();
+ var heightStructuresCalculation = new StructuresCalculation
+ {
+ Output = new TestStructuresOutput()
+ };
+
+ TestHydraulicBoundaryLocation grassCoverErosionOutwardsHydraulicBoundaryLocation = TestHydraulicBoundaryLocation.CreateFullyCalculated();
+
+ assessmentSection.GrassCoverErosionOutwards.HydraulicBoundaryLocations.Add(grassCoverErosionOutwardsHydraulicBoundaryLocation);
+
+ assessmentSection.Piping.CalculationsGroup.Children.Add(emptyPipingCalculation);
+ assessmentSection.Piping.CalculationsGroup.Children.Add(pipingCalculation);
+ assessmentSection.GrassCoverErosionInwards.CalculationsGroup.Children.Add(emptyGrassCoverErosionInwardsCalculation);
+ assessmentSection.GrassCoverErosionInwards.CalculationsGroup.Children.Add(grassCoverErosionInwardsCalculation);
+ assessmentSection.HeightStructures.CalculationsGroup.Children.Add(emptyHeightStructuresCalculation);
+ assessmentSection.HeightStructures.CalculationsGroup.Children.Add(heightStructuresCalculation);
+
+ FailureMechanismContribution failureMechanismContribution = assessmentSection.FailureMechanismContribution;
+
+ var mockRepository = new MockRepository();
+ var failureMechanismContributionObserver = mockRepository.StrictMock();
+ failureMechanismContributionObserver.Expect(o => o.UpdateObserver());
+
+ var pipingCalculationObserver = mockRepository.StrictMock();
+ pipingCalculationObserver.Expect(o => o.UpdateObserver());
+ var grassCoverErosionInwardsCalculationObserver = mockRepository.StrictMock();
+ grassCoverErosionInwardsCalculationObserver.Expect(o => o.UpdateObserver());
+ var heightStructuresCalculationObserver = mockRepository.StrictMock();
+ heightStructuresCalculationObserver.Expect(o => o.UpdateObserver());
+ var emptyPipingCalculationObserver = mockRepository.StrictMock();
+ var emptyGrassCoverErosionInwardsCalculationObserver = mockRepository.StrictMock();
+ var emptyHeightStructuresCalculationObserver = mockRepository.StrictMock();
+
+ var hydraulicBoundaryDatabaseObserver = mockRepository.StrictMock();
+ var grassCoverErosionOutwardsObserver = mockRepository.StrictMock();
+
+ mockRepository.ReplayAll();
+
+ failureMechanismContribution.Attach(failureMechanismContributionObserver);
+ assessmentSection.HydraulicBoundaryDatabase.Attach(hydraulicBoundaryDatabaseObserver);
+
+ emptyPipingCalculation.Attach(emptyPipingCalculationObserver);
+ emptyGrassCoverErosionInwardsCalculation.Attach(emptyGrassCoverErosionInwardsCalculationObserver);
+ emptyHeightStructuresCalculation.Attach(emptyHeightStructuresCalculationObserver);
+
+ pipingCalculation.Attach(pipingCalculationObserver);
+ grassCoverErosionInwardsCalculation.Attach(grassCoverErosionInwardsCalculationObserver);
+ heightStructuresCalculation.Attach(heightStructuresCalculationObserver);
+
+ assessmentSection.GrassCoverErosionOutwards.HydraulicBoundaryLocations.Attach(grassCoverErosionOutwardsObserver);
+
+ var properties = new NormProperties(
+ failureMechanismContribution,
+ new FailureMechanismContributionNormChangeHandler(assessmentSection));
+
+ DialogBoxHandler = (name, wnd) =>
+ {
+ var dialogTester = new MessageBoxTester(wnd);
+ dialogTester.ClickOk();
+ };
+
+ // Call
+ Action call = () => setPropertyAction(properties);
+
+ // Assert
+ TestHelper.AssertLogMessages(call, msgs =>
+ {
+ string[] messages = msgs.ToArray();
+ Assert.AreEqual(string.Format(messageCalculationsremoved, numberOfCalculations), messages[0]);
+ Assert.AreEqual(messageAllHydraulicBoundaryLocationOutputCleared, messages[1]);
+ });
+
+ AssertNormValues(properties, failureMechanismContribution);
+
+ AssertHydraulicBoundaryLocationOutputClear(hydraulicBoundaryLocation);
+ AssertHydraulicBoundaryLocationOutputClear(grassCoverErosionOutwardsHydraulicBoundaryLocation);
+
+ AssertCalculationOutputClear(pipingCalculation);
+ AssertCalculationOutputClear(grassCoverErosionInwardsCalculation);
+ AssertCalculationOutputClear(heightStructuresCalculation);
+
+ mockRepository.VerifyAll();
+ }
+
+ private void ChangeValueNoPermissionGivenAndVerifyNoNotificationsAndOutputForAllDataSet(Action setPropertyAction)
+ {
+ // Setup
+ var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation
+ {
+ DesignWaterLevelCalculation1 =
+ {
+ Output = new TestHydraulicBoundaryLocationOutput(1.1)
+ },
+ DesignWaterLevelCalculation2 =
+ {
+ Output = new TestHydraulicBoundaryLocationOutput(2.2)
+ },
+ DesignWaterLevelCalculation3 =
+ {
+ Output = new TestHydraulicBoundaryLocationOutput(3.3)
+ },
+ DesignWaterLevelCalculation4 =
+ {
+ Output = new TestHydraulicBoundaryLocationOutput(4.4)
+ },
+ WaveHeightCalculation1 =
+ {
+ Output = new TestHydraulicBoundaryLocationOutput(5.5)
+ },
+ WaveHeightCalculation2 =
+ {
+ Output = new TestHydraulicBoundaryLocationOutput(6.6)
+ },
+ WaveHeightCalculation3 =
+ {
+ Output = new TestHydraulicBoundaryLocationOutput(7.7)
+ },
+ WaveHeightCalculation4 =
+ {
+ Output = new TestHydraulicBoundaryLocationOutput(8.8)
+ }
+ };
+
+ var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike)
+ {
+ HydraulicBoundaryDatabase =
+ {
+ Locations =
+ {
+ hydraulicBoundaryLocation
+ }
+ }
+ };
+
+ var emptyPipingCalculation = new PipingCalculation(new GeneralPipingInput());
+ var pipingCalculation = new PipingCalculation(new GeneralPipingInput())
+ {
+ Output = PipingOutputTestFactory.Create()
+ };
+ var emptyGrassCoverErosionInwardsCalculation = new GrassCoverErosionInwardsCalculation();
+ var grassCoverErosionInwardsCalculation = new GrassCoverErosionInwardsCalculation
+ {
+ Output = new TestGrassCoverErosionInwardsOutput()
+ };
+ var emptyHeightStructuresCalculation = new StructuresCalculation();
+ var heightStructuresCalculation = new StructuresCalculation
+ {
+ Output = new TestStructuresOutput()
+ };
+
+ TestHydraulicBoundaryLocation grassCoverErosionOutwardsHydraulicBoundaryLocation = TestHydraulicBoundaryLocation.CreateFullyCalculated();
+
+ assessmentSection.GrassCoverErosionOutwards.HydraulicBoundaryLocations.Add(grassCoverErosionOutwardsHydraulicBoundaryLocation);
+
+ assessmentSection.Piping.CalculationsGroup.Children.Add(emptyPipingCalculation);
+ assessmentSection.Piping.CalculationsGroup.Children.Add(pipingCalculation);
+ assessmentSection.GrassCoverErosionInwards.CalculationsGroup.Children.Add(emptyGrassCoverErosionInwardsCalculation);
+ assessmentSection.GrassCoverErosionInwards.CalculationsGroup.Children.Add(grassCoverErosionInwardsCalculation);
+ assessmentSection.HeightStructures.CalculationsGroup.Children.Add(emptyHeightStructuresCalculation);
+ assessmentSection.HeightStructures.CalculationsGroup.Children.Add(heightStructuresCalculation);
+
+ FailureMechanismContribution failureMechanismContribution = assessmentSection.FailureMechanismContribution;
+
+ var mockRepository = new MockRepository();
+ var failureMechanismContributionObserver = mockRepository.StrictMock();
+ var pipingCalculationObserver = mockRepository.StrictMock();
+ var grassCoverErosionInwardsCalculationObserver = mockRepository.StrictMock();
+ var heightStructuresCalculationObserver = mockRepository.StrictMock();
+ var emptyPipingCalculationObserver = mockRepository.StrictMock();
+ var emptyGrassCoverErosionInwardsCalculationObserver = mockRepository.StrictMock();
+ var emptyHeightStructuresCalculationObserver = mockRepository.StrictMock();
+ var hydraulicBoundaryDatabaseObserver = mockRepository.StrictMock();
+ var grassCoverErosionOutwardsObserver = mockRepository.StrictMock();
+
+ mockRepository.ReplayAll();
+
+ failureMechanismContribution.Attach(failureMechanismContributionObserver);
+ assessmentSection.HydraulicBoundaryDatabase.Attach(hydraulicBoundaryDatabaseObserver);
+
+ emptyPipingCalculation.Attach(emptyPipingCalculationObserver);
+ emptyGrassCoverErosionInwardsCalculation.Attach(emptyGrassCoverErosionInwardsCalculationObserver);
+ emptyHeightStructuresCalculation.Attach(emptyHeightStructuresCalculationObserver);
+
+ pipingCalculation.Attach(pipingCalculationObserver);
+ grassCoverErosionInwardsCalculation.Attach(grassCoverErosionInwardsCalculationObserver);
+ heightStructuresCalculation.Attach(heightStructuresCalculationObserver);
+
+ assessmentSection.GrassCoverErosionOutwards.HydraulicBoundaryLocations.Attach(grassCoverErosionOutwardsObserver);
+
+ var properties = new NormProperties(
+ failureMechanismContribution,
+ new FailureMechanismContributionNormChangeHandler(assessmentSection));
+
+ double originalLowerLimitNorm = failureMechanismContribution.LowerLimitNorm;
+ double originalSignalingNorm = failureMechanismContribution.SignalingNorm;
+ NormType originalNormativeNorm = failureMechanismContribution.NormativeNorm;
+ double originalNorm = failureMechanismContribution.Norm;
+
+ DialogBoxHandler = (name, wnd) =>
+ {
+ var dialogTester = new MessageBoxTester(wnd);
+ dialogTester.ClickCancel();
+ };
+
+ // Call
+ Action call = () => setPropertyAction(properties);
+
+ // Assert
+ TestHelper.AssertLogMessagesCount(call, 0);
+ Assert.AreEqual(originalLowerLimitNorm, failureMechanismContribution.LowerLimitNorm);
+ Assert.AreEqual(originalSignalingNorm, failureMechanismContribution.SignalingNorm);
+ Assert.AreEqual(originalNormativeNorm, failureMechanismContribution.NormativeNorm);
+ Assert.AreEqual(originalNorm, failureMechanismContribution.Norm);
+
+ Assert.IsTrue(hydraulicBoundaryLocation.WaveHeightCalculation1.HasOutput);
+ Assert.IsTrue(hydraulicBoundaryLocation.WaveHeightCalculation2.HasOutput);
+ Assert.IsTrue(hydraulicBoundaryLocation.WaveHeightCalculation3.HasOutput);
+ Assert.IsTrue(hydraulicBoundaryLocation.WaveHeightCalculation4.HasOutput);
+ Assert.IsTrue(hydraulicBoundaryLocation.DesignWaterLevelCalculation1.HasOutput);
+ Assert.IsTrue(hydraulicBoundaryLocation.DesignWaterLevelCalculation2.HasOutput);
+ Assert.IsTrue(hydraulicBoundaryLocation.DesignWaterLevelCalculation3.HasOutput);
+ Assert.IsTrue(hydraulicBoundaryLocation.DesignWaterLevelCalculation4.HasOutput);
+ Assert.IsTrue(grassCoverErosionOutwardsHydraulicBoundaryLocation.WaveHeightCalculation1.HasOutput);
+ Assert.IsTrue(grassCoverErosionOutwardsHydraulicBoundaryLocation.DesignWaterLevelCalculation1.HasOutput);
+ Assert.IsNotNull(pipingCalculation.Output);
+ Assert.IsNotNull(grassCoverErosionInwardsCalculation.Output);
+ Assert.IsNotNull(heightStructuresCalculation.Output);
+
+ mockRepository.VerifyAll();
+ }
+
+ private void SetPropertyAndVerifyNotificationsAndOutputForHydraulicBoundarySetAndCalculationsNoOutput(Action setPropertyAction)
+ {
+ // Setup
+ var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike)
+ {
+ HydraulicBoundaryDatabase =
+ {
+ Locations =
+ {
+ TestHydraulicBoundaryLocation.CreateFullyCalculated()
+ }
+ }
+ };
+
+ var emptyPipingCalculation = new PipingCalculation(new GeneralPipingInput());
+ var emptyGrassCoverErosionInwardsCalculation = new GrassCoverErosionInwardsCalculation();
+ var emptyHeightStructuresCalculation = new StructuresCalculation();
+
+ assessmentSection.Piping.CalculationsGroup.Children.Add(emptyPipingCalculation);
+ assessmentSection.GrassCoverErosionInwards.CalculationsGroup.Children.Add(emptyGrassCoverErosionInwardsCalculation);
+ assessmentSection.HeightStructures.CalculationsGroup.Children.Add(emptyHeightStructuresCalculation);
+
+ FailureMechanismContribution failureMechanismContribution = assessmentSection.FailureMechanismContribution;
+
+ var mockRepository = new MockRepository();
+ var failureMechanismContributionObserver = mockRepository.StrictMock();
+ failureMechanismContributionObserver.Expect(o => o.UpdateObserver());
+ var calculationObserver = mockRepository.StrictMock(); // No update observers expected.
+ var hydraulicBoundaryDatabaseObserver = mockRepository.StrictMock(); // No update observers expected.
+ var hydraulicBoundaryLocationObserver = mockRepository.StrictMock();
+ hydraulicBoundaryLocationObserver.Expect(o => o.UpdateObserver());
+
+ mockRepository.ReplayAll();
+
+ failureMechanismContribution.Attach(failureMechanismContributionObserver);
+ assessmentSection.HydraulicBoundaryDatabase.Attach(hydraulicBoundaryDatabaseObserver);
+
+ emptyPipingCalculation.Attach(calculationObserver);
+ emptyGrassCoverErosionInwardsCalculation.Attach(calculationObserver);
+ emptyHeightStructuresCalculation.Attach(calculationObserver);
+
+ HydraulicBoundaryLocation hydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations[0];
+ hydraulicBoundaryLocation.Attach(hydraulicBoundaryLocationObserver);
+
+ var properties = new NormProperties(
+ failureMechanismContribution,
+ new FailureMechanismContributionNormChangeHandler(assessmentSection));
+
+ DialogBoxHandler = (name, wnd) =>
+ {
+ var dialogTester = new MessageBoxTester(wnd);
+ dialogTester.ClickOk();
+ };
+
+ // Call
+ Action call = () => setPropertyAction(properties);
+
+ // Assert
+ TestHelper.AssertLogMessageIsGenerated(call, messageAllHydraulicBoundaryLocationOutputCleared, 1);
+
+ AssertNormValues(properties, failureMechanismContribution);
+ AssertHydraulicBoundaryLocationOutputClear(hydraulicBoundaryLocation);
+
+ mockRepository.VerifyAll();
+ }
+
+ private void SetPropertyAndVerifyNotificationsAndOutputForHydraulicBoundaryLocationNoOutputAndCalculationWithOutput(Action setPropertyAction)
+ {
+ // Setup
+ const int numberOfCalculations = 3;
+
+ var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike)
+ {
+ HydraulicBoundaryDatabase =
+ {
+ Locations =
+ {
+ new TestHydraulicBoundaryLocation()
+ }
+ }
+ };
+
+ var emptyPipingCalculation = new PipingCalculation(new GeneralPipingInput());
+ var pipingCalculation = new PipingCalculation(new GeneralPipingInput())
+ {
+ Output = PipingOutputTestFactory.Create()
+ };
+ var emptyGrassCoverErosionInwardsCalculation = new GrassCoverErosionInwardsCalculation();
+ var grassCoverErosionInwardsCalculation = new GrassCoverErosionInwardsCalculation
+ {
+ Output = new TestGrassCoverErosionInwardsOutput()
+ };
+ var emptyHeightStructuresCalculation = new StructuresCalculation();
+ var heightStructuresCalculation = new StructuresCalculation
+ {
+ Output = new TestStructuresOutput()
+ };
+
+ assessmentSection.Piping.CalculationsGroup.Children.Add(emptyPipingCalculation);
+ assessmentSection.Piping.CalculationsGroup.Children.Add(pipingCalculation);
+ assessmentSection.GrassCoverErosionInwards.CalculationsGroup.Children.Add(emptyGrassCoverErosionInwardsCalculation);
+ assessmentSection.GrassCoverErosionInwards.CalculationsGroup.Children.Add(grassCoverErosionInwardsCalculation);
+ assessmentSection.HeightStructures.CalculationsGroup.Children.Add(emptyHeightStructuresCalculation);
+ assessmentSection.HeightStructures.CalculationsGroup.Children.Add(heightStructuresCalculation);
+
+ FailureMechanismContribution failureMechanismContribution = assessmentSection.FailureMechanismContribution;
+
+ var mockRepository = new MockRepository();
+ var observer = mockRepository.StrictMock();
+ observer.Expect(o => o.UpdateObserver());
+
+ var pipingCalculationObserver = mockRepository.StrictMock();
+ pipingCalculationObserver.Expect(o => o.UpdateObserver());
+ var grassCoverErosionInwardsCalculationObserver = mockRepository.StrictMock();
+ grassCoverErosionInwardsCalculationObserver.Expect(o => o.UpdateObserver());
+ var heightStructuresCalculationObserver = mockRepository.StrictMock();
+ heightStructuresCalculationObserver.Expect(o => o.UpdateObserver());
+ var emptyPipingCalculationObserver = mockRepository.StrictMock();
+ var emptyGrassCoverErosionInwardsCalculationObserver = mockRepository.StrictMock();
+ var emptyHeightStructuresCalculationObserver = mockRepository.StrictMock();
+
+ var hydraulicBoundaryDatabaseObserver = mockRepository.StrictMock(); // No update observer expected.
+
+ mockRepository.ReplayAll();
+
+ failureMechanismContribution.Attach(observer);
+ assessmentSection.HydraulicBoundaryDatabase.Attach(hydraulicBoundaryDatabaseObserver);
+
+ emptyPipingCalculation.Attach(emptyPipingCalculationObserver);
+ emptyGrassCoverErosionInwardsCalculation.Attach(emptyGrassCoverErosionInwardsCalculationObserver);
+ emptyHeightStructuresCalculation.Attach(emptyHeightStructuresCalculationObserver);
+
+ pipingCalculation.Attach(pipingCalculationObserver);
+ grassCoverErosionInwardsCalculation.Attach(grassCoverErosionInwardsCalculationObserver);
+ heightStructuresCalculation.Attach(heightStructuresCalculationObserver);
+
+ var properties = new NormProperties(
+ failureMechanismContribution,
+ new FailureMechanismContributionNormChangeHandler(assessmentSection));
+
+ DialogBoxHandler = (name, wnd) =>
+ {
+ var dialogTester = new MessageBoxTester(wnd);
+ dialogTester.ClickOk();
+ };
+
+ // Call
+ Action call = () => setPropertyAction(properties);
+
+ // Assert
+ string expectedMessage = string.Format(messageCalculationsremoved,
+ numberOfCalculations);
+ TestHelper.AssertLogMessageIsGenerated(call, expectedMessage, 1);
+
+ AssertNormValues(properties, failureMechanismContribution);
+ AssertCalculationOutputClear(pipingCalculation);
+ AssertCalculationOutputClear(grassCoverErosionInwardsCalculation);
+ AssertCalculationOutputClear(heightStructuresCalculation);
+
+ mockRepository.VerifyAll();
+ }
+
+ private void SetPropertyAndVerifyNotificationsAndOutputForNoHydraulicBoundaryLocationNoOutputAndCalculationWithOutput(Action setPropertyAction)
+ {
+ // Setup
+ const int numberOfCalculations = 3;
+
+ var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike);
+
+ var emptyPipingCalculation = new PipingCalculation(new GeneralPipingInput());
+ var pipingCalculation = new PipingCalculation(new GeneralPipingInput())
+ {
+ Output = PipingOutputTestFactory.Create()
+ };
+ var emptyGrassCoverErosionInwardsCalculation = new GrassCoverErosionInwardsCalculation();
+ var grassCoverErosionInwardsCalculation = new GrassCoverErosionInwardsCalculation
+ {
+ Output = new TestGrassCoverErosionInwardsOutput()
+ };
+ var emptyHeightStructuresCalculation = new StructuresCalculation();
+ var heightStructuresCalculation = new StructuresCalculation
+ {
+ Output = new TestStructuresOutput()
+ };
+
+ assessmentSection.Piping.CalculationsGroup.Children.Add(emptyPipingCalculation);
+ assessmentSection.Piping.CalculationsGroup.Children.Add(pipingCalculation);
+ assessmentSection.GrassCoverErosionInwards.CalculationsGroup.Children.Add(emptyGrassCoverErosionInwardsCalculation);
+ assessmentSection.GrassCoverErosionInwards.CalculationsGroup.Children.Add(grassCoverErosionInwardsCalculation);
+ assessmentSection.HeightStructures.CalculationsGroup.Children.Add(emptyHeightStructuresCalculation);
+ assessmentSection.HeightStructures.CalculationsGroup.Children.Add(heightStructuresCalculation);
+
+ FailureMechanismContribution failureMechanismContribution = assessmentSection.FailureMechanismContribution;
+
+ var mockRepository = new MockRepository();
+ var observer = mockRepository.StrictMock();
+ observer.Expect(o => o.UpdateObserver());
+
+ var pipingCalculationObserver = mockRepository.StrictMock();
+ pipingCalculationObserver.Expect(o => o.UpdateObserver());
+ var grassCoverErosionInwardsCalculationObserver = mockRepository.StrictMock();
+ grassCoverErosionInwardsCalculationObserver.Expect(o => o.UpdateObserver());
+ var heightStructuresCalculationObserver = mockRepository.StrictMock();
+ heightStructuresCalculationObserver.Expect(o => o.UpdateObserver());
+ var emptyPipingCalculationObserver = mockRepository.StrictMock();
+ var emptyGrassCoverErosionInwardsCalculationObserver = mockRepository.StrictMock();
+ var emptyHeightStructuresCalculationObserver = mockRepository.StrictMock();
+
+ mockRepository.ReplayAll();
+
+ failureMechanismContribution.Attach(observer);
+
+ emptyPipingCalculation.Attach(emptyPipingCalculationObserver);
+ emptyGrassCoverErosionInwardsCalculation.Attach(emptyGrassCoverErosionInwardsCalculationObserver);
+ emptyHeightStructuresCalculation.Attach(emptyHeightStructuresCalculationObserver);
+
+ pipingCalculation.Attach(pipingCalculationObserver);
+ grassCoverErosionInwardsCalculation.Attach(grassCoverErosionInwardsCalculationObserver);
+ heightStructuresCalculation.Attach(heightStructuresCalculationObserver);
+
+ var properties = new NormProperties(
+ failureMechanismContribution,
+ new FailureMechanismContributionNormChangeHandler(assessmentSection));
+
+ DialogBoxHandler = (name, wnd) =>
+ {
+ var dialogTester = new MessageBoxTester(wnd);
+ dialogTester.ClickOk();
+ };
+
+ // Call
+ Action call = () => setPropertyAction(properties);
+
+ // Assert
+ string expectedMessage = string.Format(messageCalculationsremoved,
+ numberOfCalculations);
+ TestHelper.AssertLogMessageIsGenerated(call, expectedMessage, 1);
+
+ AssertNormValues(properties, failureMechanismContribution);
+ AssertCalculationOutputClear(pipingCalculation);
+ AssertCalculationOutputClear(grassCoverErosionInwardsCalculation);
+ AssertCalculationOutputClear(heightStructuresCalculation);
+
+ mockRepository.VerifyAll();
+ }
+
+ private void SetPropertyAndVerifyNotificationsAndOutputForHydraulicBoundaryLocationNoOutputAndNoCalculationsWithOutput(Action setPropertyAction)
+ {
+ // Setup
+ var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike)
+ {
+ HydraulicBoundaryDatabase =
+ {
+ Locations =
+ {
+ new TestHydraulicBoundaryLocation()
+ }
+ }
+ };
+
+ var emptyPipingCalculation = new PipingCalculation(new GeneralPipingInput());
+ var emptyGrassCoverErosionInwardsCalculation = new GrassCoverErosionInwardsCalculation();
+ var emptyHeightStructuresCalculation = new StructuresCalculation();
+
+ assessmentSection.Piping.CalculationsGroup.Children.Add(emptyPipingCalculation);
+ assessmentSection.GrassCoverErosionInwards.CalculationsGroup.Children.Add(emptyGrassCoverErosionInwardsCalculation);
+ assessmentSection.HeightStructures.CalculationsGroup.Children.Add(emptyHeightStructuresCalculation);
+
+ FailureMechanismContribution failureMechanismContribution = assessmentSection.FailureMechanismContribution;
+
+ var mockRepository = new MockRepository();
+ var observer = mockRepository.StrictMock();
+ observer.Expect(o => o.UpdateObserver());
+ var calculationObserver = mockRepository.StrictMock();
+ var hydraulicBoundaryDatabaseObserver = mockRepository.StrictMock();
+
+ mockRepository.ReplayAll();
+ failureMechanismContribution.Attach(observer);
+ emptyPipingCalculation.Attach(calculationObserver);
+ emptyGrassCoverErosionInwardsCalculation.Attach(calculationObserver);
+ emptyHeightStructuresCalculation.Attach(calculationObserver);
+ assessmentSection.HydraulicBoundaryDatabase.Attach(hydraulicBoundaryDatabaseObserver);
+
+ var properties = new NormProperties(
+ failureMechanismContribution,
+ new FailureMechanismContributionNormChangeHandler(assessmentSection));
+
+ DialogBoxHandler = (name, wnd) =>
+ {
+ var dialogTester = new MessageBoxTester(wnd);
+ dialogTester.ClickOk();
+ };
+
+ // Call
+ Action call = () => setPropertyAction(properties);
+
+ // Assert
+ TestHelper.AssertLogMessagesCount(call, 0);
+ AssertNormValues(properties, failureMechanismContribution);
+
+ mockRepository.VerifyAll(); // No update observer expected.
+ }
+
+ private void SetPropertyAndVerifyNotificationsAndNoOutputForHydraulicBoundaryDatabaseAndNoCalculationsWithOutput(Action setPropertyAction)
+ {
+ // Setup
+ var mockRepository = new MockRepository();
+ mockRepository.ReplayAll();
+
+ var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike);
+
+ var emptyPipingCalculation = new PipingCalculation(new GeneralPipingInput());
+ var emptyGrassCoverErosionInwardsCalculation = new GrassCoverErosionInwardsCalculation();
+ var emptyHeightStructuresCalculation = new StructuresCalculation();
+
+ assessmentSection.Piping.CalculationsGroup.Children.Add(emptyPipingCalculation);
+ assessmentSection.GrassCoverErosionInwards.CalculationsGroup.Children.Add(emptyGrassCoverErosionInwardsCalculation);
+ assessmentSection.HeightStructures.CalculationsGroup.Children.Add(emptyHeightStructuresCalculation);
+
+ FailureMechanismContribution failureMechanismContribution = assessmentSection.FailureMechanismContribution;
+
+ var properties = new NormProperties(
+ failureMechanismContribution,
+ new FailureMechanismContributionNormChangeHandler(assessmentSection));
+
+ DialogBoxHandler = (name, wnd) =>
+ {
+ var dialogTester = new MessageBoxTester(wnd);
+ dialogTester.ClickOk();
+ };
+
+ // Call
+ Action call = () => setPropertyAction(properties);
+
+ // Assert
+ TestHelper.AssertLogMessagesCount(call, 0);
+ AssertNormValues(properties, failureMechanismContribution);
+ mockRepository.VerifyAll();
+ }
+
+ #region AllDataAndOutputSet
+
+ [Test]
+ public void LowerLimitNorm_ValueChanged_ClearsDependentDataAndNotifiesObserversAndLogsMessages()
+ {
+ SetPropertyAndVerifyNotificationsAndOutputForAllDataSet(properties => properties.LowerLimitNorm = newLowerLimitNorm);
+ }
+
+ [Test]
+ public void SignalingNorm_ValueChanged_ClearsDependentDataAndNotifiesObserversAndLogsMessages()
+ {
+ SetPropertyAndVerifyNotificationsAndOutputForAllDataSet(properties => properties.SignalingNorm = newSignalingNorm);
+ }
+
+ [Test]
+ public void NormativeNorm_ValueChanged_ClearsDependentDataAndNotifiesObserversAndLogsMessages()
+ {
+ SetPropertyAndVerifyNotificationsAndOutputForAllDataSet(properties => properties.NormativeNorm = newNormativeNorm);
+ }
+
+ #endregion
+
+ #region NoPermissionGiven
+
+ [Test]
+ public void LowerLimitNorm_PermissionNotGiven_DoesnotClearDependentDataNorNotifiesObserversAndLogsMessages()
+ {
+ ChangeValueNoPermissionGivenAndVerifyNoNotificationsAndOutputForAllDataSet(properties => properties.LowerLimitNorm = newLowerLimitNorm);
+ }
+
+ [Test]
+ public void SignalingNorm_PermissionNotGiven_DoesnotClearDependentDataNorNotifiesObserversAndLogsMessages()
+ {
+ ChangeValueNoPermissionGivenAndVerifyNoNotificationsAndOutputForAllDataSet(properties => properties.SignalingNorm = newSignalingNorm);
+ }
+
+ [Test]
+ public void NormativeNorm_PermissionNotGiven_DoesnotClearDependentDataNorNotifiesObserversAndLogsMessages()
+ {
+ ChangeValueNoPermissionGivenAndVerifyNoNotificationsAndOutputForAllDataSet(properties => properties.NormativeNorm = newNormativeNorm);
+ }
+
+ #endregion
+
+ #region HydraulicBoundarySetAndCalculationsNoOutput
+
+ [Test]
+ public void LowerLimitNorm_HydraulicBoundarySetAndCalculationsNoOutput_HydraulicBoundaryLocationObserversNotifiedAndMessagesLogged()
+ {
+ SetPropertyAndVerifyNotificationsAndOutputForHydraulicBoundarySetAndCalculationsNoOutput(properties => properties.LowerLimitNorm = newLowerLimitNorm);
+ }
+
+ [Test]
+ public void SignalingNorm_HydraulicBoundarySetAndCalculationsNoOutput_HydraulicBoundaryLocationObserversNotifiedAndMessagesLogged()
+ {
+ SetPropertyAndVerifyNotificationsAndOutputForHydraulicBoundarySetAndCalculationsNoOutput(properties => properties.SignalingNorm = newSignalingNorm);
+ }
+
+ [Test]
+ public void NormativeNorm_HydraulicBoundarySetAndCalculationsNoOutput_HydraulicBoundaryLocationObserversNotifiedAndMessagesLogged()
+ {
+ SetPropertyAndVerifyNotificationsAndOutputForHydraulicBoundarySetAndCalculationsNoOutput(properties => properties.NormativeNorm = newNormativeNorm);
+ }
+
+ #endregion
+
+ #region HydraulicBoundaryLocationNoOutputAndCalculationWithOutput
+
+ [Test]
+ public void LowerLimitNorm_HydraulicBoundaryLocationNoOutputAndCalculationWithOutputAndValueChanged_CalculationObserverNotifiedAndMessageLogged()
+ {
+ SetPropertyAndVerifyNotificationsAndOutputForHydraulicBoundaryLocationNoOutputAndCalculationWithOutput(properties => properties.LowerLimitNorm = newLowerLimitNorm);
+ }
+
+ [Test]
+ public void SignalingNorm_HydraulicBoundaryLocationNoOutputAndCalculationWithOutputAndValueChanged_CalculationObserverNotifiedAndMessageLogged()
+ {
+ SetPropertyAndVerifyNotificationsAndOutputForHydraulicBoundaryLocationNoOutputAndCalculationWithOutput(properties => properties.SignalingNorm = newSignalingNorm);
+ }
+
+ [Test]
+ public void NormativeNorm_HydraulicBoundaryLocationNoOutputAndCalculationWithOutputAndValueChanged_CalculationObserverNotifiedAndMessageLogged()
+ {
+ SetPropertyAndVerifyNotificationsAndOutputForHydraulicBoundaryLocationNoOutputAndCalculationWithOutput(properties => properties.NormativeNorm = newNormativeNorm);
+ }
+
+ #endregion
+
+ #region NoHydraulicBoundaryLocationNoOutputAndCalculationWithOutput
+
+ [Test]
+ public void LowerLimitNorm_NoHydraulicBoundaryLocationNoOutputAndCalculationWithOutputAndValueChanged_CalculationObserverNotifiedAndMessageLogged()
+ {
+ SetPropertyAndVerifyNotificationsAndOutputForNoHydraulicBoundaryLocationNoOutputAndCalculationWithOutput(properties => properties.LowerLimitNorm = newLowerLimitNorm);
+ }
+
+ [Test]
+ public void SignalingNorm_NoHydraulicBoundaryLocationNoOutputAndCalculationWithOutputAndValueChanged_CalculationObserverNotifiedAndMessageLogged()
+ {
+ SetPropertyAndVerifyNotificationsAndOutputForNoHydraulicBoundaryLocationNoOutputAndCalculationWithOutput(properties => properties.SignalingNorm = newSignalingNorm);
+ }
+
+ [Test]
+ public void NormativeNorm_NoHydraulicBoundaryLocationNoOutputAndCalculationWithOutputAndValueChanged_CalculationObserverNotifiedAndMessageLogged()
+ {
+ SetPropertyAndVerifyNotificationsAndOutputForNoHydraulicBoundaryLocationNoOutputAndCalculationWithOutput(properties => properties.NormativeNorm = newNormativeNorm);
+ }
+
+ #endregion
+
+ #region HydraulicBoundaryLocationNoOutputAndNoCalculationsWithOutput
+
+ [Test]
+ public void LowerLimitNorm_HydraulicBoundaryLocationNoOutputAndNoCalculationsWithOutputAndValueChanged_NoObserversNotifiedAndMessagesLogged()
+ {
+ SetPropertyAndVerifyNotificationsAndOutputForHydraulicBoundaryLocationNoOutputAndNoCalculationsWithOutput(properties => properties.LowerLimitNorm = newLowerLimitNorm);
+ }
+
+ [Test]
+ public void SignalingNorm_HydraulicBoundaryLocationNoOutputAndNoCalculationsWithOutputAndValueChanged_NoObserversNotifiedAndMessagesLogged()
+ {
+ SetPropertyAndVerifyNotificationsAndOutputForHydraulicBoundaryLocationNoOutputAndNoCalculationsWithOutput(properties => properties.SignalingNorm = newSignalingNorm);
+ }
+
+ [Test]
+ public void NormativeNorm_HydraulicBoundaryLocationNoOutputAndNoCalculationsWithOutputAndValueChanged_NoObserversNotifiedAndMessagesLogged()
+ {
+ SetPropertyAndVerifyNotificationsAndOutputForHydraulicBoundaryLocationNoOutputAndNoCalculationsWithOutput(properties => properties.NormativeNorm = newNormativeNorm);
+ }
+
+ #endregion
+
+ #region NoHydraulicBoundaryDatabaseAndNoCalculationsWithOutput
+
+ [Test]
+ public void LowerLimitNorm_NoHydraulicBoundaryDatabaseOutputAndNoCalculationsWithOutputAndValueChanged_NoObserversNotifiedAndMessagesLogged()
+ {
+ SetPropertyAndVerifyNotificationsAndNoOutputForHydraulicBoundaryDatabaseAndNoCalculationsWithOutput(properties => properties.LowerLimitNorm = newLowerLimitNorm);
+ }
+
+ [Test]
+ public void SignalingNorm_NoHydraulicBoundaryDatabaseOutputAndNoCalculationsWithOutputAndValueChanged_NoObserversNotifiedAndMessagesLogged()
+ {
+ SetPropertyAndVerifyNotificationsAndNoOutputForHydraulicBoundaryDatabaseAndNoCalculationsWithOutput(properties => properties.SignalingNorm = newSignalingNorm);
+ }
+
+ [Test]
+ public void NormativeNorm_NoHydraulicBoundaryDatabaseOutputAndNoCalculationsWithOutputAndValueChanged_NoObserversNotifiedAndMessagesLogged()
+ {
+ SetPropertyAndVerifyNotificationsAndNoOutputForHydraulicBoundaryDatabaseAndNoCalculationsWithOutput(properties => properties.NormativeNorm = newNormativeNorm);
+ }
+
+ #endregion
+
+ #region Asserts
+
+ private static void AssertCalculationOutputClear(ICalculation calculation)
+ {
+ Assert.IsFalse(calculation.HasOutput);
+ }
+
+ private static void AssertHydraulicBoundaryLocationOutputClear(HydraulicBoundaryLocation hydraulicBoundaryLocation)
+ {
+ Assert.IsFalse(hydraulicBoundaryLocation.WaveHeightCalculation1.HasOutput);
+ Assert.IsFalse(hydraulicBoundaryLocation.WaveHeightCalculation2.HasOutput);
+ Assert.IsFalse(hydraulicBoundaryLocation.WaveHeightCalculation3.HasOutput);
+ Assert.IsFalse(hydraulicBoundaryLocation.WaveHeightCalculation4.HasOutput);
+ Assert.IsFalse(hydraulicBoundaryLocation.DesignWaterLevelCalculation1.HasOutput);
+ Assert.IsFalse(hydraulicBoundaryLocation.DesignWaterLevelCalculation2.HasOutput);
+ Assert.IsFalse(hydraulicBoundaryLocation.DesignWaterLevelCalculation3.HasOutput);
+ Assert.IsFalse(hydraulicBoundaryLocation.DesignWaterLevelCalculation4.HasOutput);
+ }
+
+ private static void AssertNormValues(NormProperties properties, FailureMechanismContribution failureMechanismContribution)
+ {
+ Assert.AreEqual(properties.LowerLimitNorm, failureMechanismContribution.LowerLimitNorm);
+ Assert.AreEqual(properties.SignalingNorm, failureMechanismContribution.SignalingNorm);
+ Assert.AreEqual(properties.NormativeNorm, failureMechanismContribution.NormativeNorm);
+
+ double expectedNorm = failureMechanismContribution.NormativeNorm == NormType.LowerLimit
+ ? failureMechanismContribution.LowerLimitNorm
+ : failureMechanismContribution.SignalingNorm;
+
+ Assert.AreEqual(expectedNorm, failureMechanismContribution.Norm);
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/NormPropertiesTest.cs
===================================================================
diff -u -r2d3979f45682cd0678d8210208c468bee4095619 -rc602baeb36d745d3a356bd7832e132cb21cad711
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/NormPropertiesTest.cs (.../NormPropertiesTest.cs) (revision 2d3979f45682cd0678d8210208c468bee4095619)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/NormPropertiesTest.cs (.../NormPropertiesTest.cs) (revision c602baeb36d745d3a356bd7832e132cb21cad711)
@@ -90,11 +90,10 @@
Assert.IsInstanceOf>(properties);
Assert.AreSame(failureMechanismContribution, properties.Data);
- TestHelper.AssertTypeConverter(
- nameof(FailureMechanismContributionProperties.SignalingNorm));
-
- TestHelper.AssertTypeConverter(
- nameof(FailureMechanismContributionProperties.LowerLimitNorm));
+ TestHelper.AssertTypeConverter(
+ nameof(NormProperties.SignalingNorm));
+ TestHelper.AssertTypeConverter(
+ nameof(NormProperties.LowerLimitNorm));
mocks.VerifyAll();
}
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj
===================================================================
diff -u -r2d3979f45682cd0678d8210208c468bee4095619 -rc602baeb36d745d3a356bd7832e132cb21cad711
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 2d3979f45682cd0678d8210208c468bee4095619)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision c602baeb36d745d3a356bd7832e132cb21cad711)
@@ -47,7 +47,7 @@
-
+
@@ -57,7 +57,7 @@
-
+
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/FailureMechanismContributionContextPropertyInfoTest.cs
===================================================================
diff -u -ra5bf4f56dbf07e5cf48d0b874f5d46d7d02f0dba -rc602baeb36d745d3a356bd7832e132cb21cad711
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/FailureMechanismContributionContextPropertyInfoTest.cs (.../FailureMechanismContributionContextPropertyInfoTest.cs) (revision a5bf4f56dbf07e5cf48d0b874f5d46d7d02f0dba)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/FailureMechanismContributionContextPropertyInfoTest.cs (.../FailureMechanismContributionContextPropertyInfoTest.cs) (revision c602baeb36d745d3a356bd7832e132cb21cad711)
@@ -27,7 +27,6 @@
using NUnit.Framework;
using Rhino.Mocks;
using Ringtoets.Common.Data.AssessmentSection;
-using Ringtoets.Common.Data.Contribution;
using Ringtoets.Common.Data.TestUtil;
using Ringtoets.Common.Forms.PresentationObjects;
using Ringtoets.Integration.Forms.PropertyClasses;
@@ -48,7 +47,7 @@
// Assert
Assert.AreEqual(typeof(FailureMechanismContributionContext), info.DataType);
- Assert.AreEqual(typeof(FailureMechanismContributionProperties), info.PropertyObjectType);
+ Assert.AreEqual(typeof(AssessmentSectionCompositionProperties), info.PropertyObjectType);
}
}
@@ -69,25 +68,25 @@
{
plugin.Gui = gui;
- FailureMechanismContribution failureMechanismContribution = FailureMechanismContributionTestFactory.CreateFailureMechanismContribution();
- var context = new FailureMechanismContributionContext(failureMechanismContribution, assessmentSection);
+ var context = new FailureMechanismContributionContext(FailureMechanismContributionTestFactory.CreateFailureMechanismContribution(),
+ assessmentSection);
PropertyInfo info = GetInfo(plugin);
// Call
IObjectProperties objectProperties = info.CreateInstance(context);
// Assert
- Assert.IsInstanceOf(objectProperties);
- Assert.AreSame(failureMechanismContribution, objectProperties.Data);
+ Assert.IsInstanceOf(objectProperties);
+ Assert.AreSame(assessmentSection, objectProperties.Data);
}
mocks.VerifyAll();
}
private static PropertyInfo GetInfo(RingtoetsPlugin plugin)
{
- return plugin.GetPropertyInfos().First(tni => tni.PropertyObjectType == typeof(FailureMechanismContributionProperties));
+ return plugin.GetPropertyInfos().First(tni => tni.PropertyObjectType == typeof(AssessmentSectionCompositionProperties));
}
}
}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs
===================================================================
diff -u -r2d3979f45682cd0678d8210208c468bee4095619 -rc602baeb36d745d3a356bd7832e132cb21cad711
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision 2d3979f45682cd0678d8210208c468bee4095619)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision c602baeb36d745d3a356bd7832e132cb21cad711)
@@ -248,7 +248,7 @@
PluginTestHelper.AssertPropertyInfoDefined(
propertyInfos,
typeof(FailureMechanismContributionContext),
- typeof(FailureMechanismContributionProperties));
+ typeof(AssessmentSectionCompositionProperties));
PluginTestHelper.AssertPropertyInfoDefined(
propertyInfos,