Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/TreeNodeInfos/ClosingStructuresCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -rada94ef2b6943fb9a2d8e59256871205a7d4c4ee -rfaa45d14b96d0433ec561a39635ad6285b1ad5e3 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/TreeNodeInfos/ClosingStructuresCalculationContextTreeNodeInfoTest.cs (.../ClosingStructuresCalculationContextTreeNodeInfoTest.cs) (revision ada94ef2b6943fb9a2d8e59256871205a7d4c4ee) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/TreeNodeInfos/ClosingStructuresCalculationContextTreeNodeInfoTest.cs (.../ClosingStructuresCalculationContextTreeNodeInfoTest.cs) (revision faa45d14b96d0433ec561a39635ad6285b1ad5e3) @@ -834,7 +834,7 @@ } [Test] - public void ContextMenuStrip_WithForeshoreProfile_ContextMenuItemUpdateForeshoreProfileEnabled() + public void ContextMenuStrip_WithForeshoreProfileAndChanges_ContextMenuItemUpdateForeshoreProfileEnabled() { // Setup var assessmentSectionStub = mocks.Stub(); @@ -846,6 +846,7 @@ ForeshoreProfile = new TestForeshoreProfile() } }; + calculation.InputParameters.UseBreakWater = true; var nodeData = new ClosingStructuresCalculationContext(calculation, failureMechanism, assessmentSectionStub); Index: Ringtoets/Common/src/Ringtoets.Common.Data/Structures/StructuresInputBase.cs =================================================================== diff -u -r0e1d04a42ec35249482d25d398ed9dce132e0155 -rfaa45d14b96d0433ec561a39635ad6285b1ad5e3 --- Ringtoets/Common/src/Ringtoets.Common.Data/Structures/StructuresInputBase.cs (.../StructuresInputBase.cs) (revision 0e1d04a42ec35249482d25d398ed9dce132e0155) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Structures/StructuresInputBase.cs (.../StructuresInputBase.cs) (revision faa45d14b96d0433ec561a39635ad6285b1ad5e3) @@ -388,7 +388,9 @@ return UseForeshore == foreshoreProfile.Geometry.Count() > 1 && UseBreakWater == foreshoreProfile.HasBreakWater - && BreakWater.Equals(foreshoreProfile.BreakWater); + && BreakWater.Equals(foreshoreProfile.HasBreakWater + ? foreshoreProfile.BreakWater + : GetDefaultBreakWater()); } } @@ -404,9 +406,7 @@ { UseForeshore = foreshoreProfile.Geometry.Count() > 1; UseBreakWater = foreshoreProfile.HasBreakWater; - BreakWater = foreshoreProfile.HasBreakWater ? - new BreakWater(foreshoreProfile.BreakWater.Type, foreshoreProfile.BreakWater.Height) : - GetDefaultBreakWater(); + BreakWater = foreshoreProfile.HasBreakWater ? new BreakWater(foreshoreProfile.BreakWater.Type, foreshoreProfile.BreakWater.Height) : GetDefaultBreakWater(); } } Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Structures/StructuresInputBaseTest.cs =================================================================== diff -u -r22f2f5e1f5cf9047b2ab2e5097b56a37fbc4cc5b -rfaa45d14b96d0433ec561a39635ad6285b1ad5e3 --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Structures/StructuresInputBaseTest.cs (.../StructuresInputBaseTest.cs) (revision 22f2f5e1f5cf9047b2ab2e5097b56a37fbc4cc5b) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Structures/StructuresInputBaseTest.cs (.../StructuresInputBaseTest.cs) (revision faa45d14b96d0433ec561a39635ad6285b1ad5e3) @@ -548,6 +548,9 @@ Orientation = orientation }); + // Precondition + Assert.IsFalse(input.IsForeshoreProfileParametersSynchronized); + // Call input.ForeshoreProfile = foreshoreProfile; @@ -559,6 +562,7 @@ Assert.AreEqual(withValidForeshore, input.UseForeshore); CollectionAssert.AreEqual(foreshoreProfile.Geometry, input.ForeshoreGeometry); Assert.AreSame(originalHydraulicBoundaryLocation, input.HydraulicBoundaryLocation); + Assert.IsTrue(input.IsForeshoreProfileParametersSynchronized); } [Test] @@ -586,6 +590,7 @@ input.ForeshoreProfile = foreshoreProfile; // Precondition + Assert.IsTrue(input.IsForeshoreProfileParametersSynchronized); Assert.AreSame(foreshoreProfile, input.ForeshoreProfile); Assert.IsTrue(input.UseBreakWater); Assert.AreNotEqual(originalBreakWaterType, input.BreakWater.Type); @@ -598,6 +603,7 @@ input.ForeshoreProfile = null; // Assert + Assert.IsFalse(input.IsForeshoreProfileParametersSynchronized); Assert.IsFalse(input.UseBreakWater); Assert.AreEqual(originalBreakWaterType, input.BreakWater.Type); Assert.AreEqual(originalBreakWaterHeight, input.BreakWater.Height); Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -rada94ef2b6943fb9a2d8e59256871205a7d4c4ee -rfaa45d14b96d0433ec561a39635ad6285b1ad5e3 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision ada94ef2b6943fb9a2d8e59256871205a7d4c4ee) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision faa45d14b96d0433ec561a39635ad6285b1ad5e3) @@ -761,7 +761,7 @@ } [Test] - public void ContextMenuStrip_WithForeshoreProfile_ContextMenuItemUpdateForeshoreProfileEnabled() + public void ContextMenuStrip_WithForeshoreProfileAndChanges_ContextMenuItemUpdateForeshoreProfileEnabled() { // Setup var assessmentSectionStub = mocks.Stub(); @@ -776,6 +776,7 @@ ForeshoreProfile = new TestForeshoreProfile() } }; + calculation.InputParameters.UseBreakWater = true; var nodeData = new GrassCoverErosionOutwardsWaveConditionsCalculationContext(calculation, failureMechanism, assessmentSectionStub); Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -rada94ef2b6943fb9a2d8e59256871205a7d4c4ee -rfaa45d14b96d0433ec561a39635ad6285b1ad5e3 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationContextTreeNodeInfoTest.cs) (revision ada94ef2b6943fb9a2d8e59256871205a7d4c4ee) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationContextTreeNodeInfoTest.cs) (revision faa45d14b96d0433ec561a39635ad6285b1ad5e3) @@ -966,7 +966,7 @@ } [Test] - public void ContextMenuStrip_WithForeshoreProfile_ContextMenuItemUpdateForeshoreProfileEnabled() + public void ContextMenuStrip_WithForeshoreProfileAndChanges_ContextMenuItemUpdateForeshoreProfileEnabled() { // Setup var assessmentSectionStub = mocks.Stub(); @@ -978,6 +978,7 @@ ForeshoreProfile = new TestForeshoreProfile() } }; + calculation.InputParameters.UseBreakWater = true; var nodeData = new HeightStructuresCalculationContext(calculation, failureMechanism, assessmentSectionStub); Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Data/WaveConditionsInput.cs =================================================================== diff -u -r0e1d04a42ec35249482d25d398ed9dce132e0155 -rfaa45d14b96d0433ec561a39635ad6285b1ad5e3 --- Ringtoets/Revetment/src/Ringtoets.Revetment.Data/WaveConditionsInput.cs (.../WaveConditionsInput.cs) (revision 0e1d04a42ec35249482d25d398ed9dce132e0155) +++ Ringtoets/Revetment/src/Ringtoets.Revetment.Data/WaveConditionsInput.cs (.../WaveConditionsInput.cs) (revision faa45d14b96d0433ec561a39635ad6285b1ad5e3) @@ -85,22 +85,6 @@ } /// - /// Gets or sets the foreshore profile. - /// - public ForeshoreProfile ForeshoreProfile - { - get - { - return foreshoreProfile; - } - set - { - foreshoreProfile = value; - SynchronizeForeshoreProfileParameters(); - } - } - - /// /// Gets or sets the orientation of the foreshore profile geometry with respect to North /// in degrees. A positive value equals a clockwise rotation. /// @@ -256,6 +240,41 @@ } } + /// + /// Gets or sets the foreshore profile. + /// + public ForeshoreProfile ForeshoreProfile + { + get + { + return foreshoreProfile; + } + set + { + foreshoreProfile = value; + SynchronizeForeshoreProfileParameters(); + } + } + + public bool IsForeshoreProfileParametersSynchronized + { + get + { + if (foreshoreProfile == null) + { + return false; + } + + return + Orientation == foreshoreProfile.Orientation + && UseForeshore == foreshoreProfile.Geometry.Count() > 1 + && UseBreakWater == foreshoreProfile.HasBreakWater + && BreakWater.Equals(foreshoreProfile.HasBreakWater + ? foreshoreProfile.BreakWater + : GetDefaultBreakWater()); + } + } + public bool UseBreakWater { get; set; } public BreakWater BreakWater { get; private set; } @@ -272,6 +291,25 @@ } } + public void SynchronizeForeshoreProfileParameters() + { + if (foreshoreProfile == null) + { + UseForeshore = false; + UseBreakWater = false; + BreakWater = GetDefaultBreakWater(); + } + else + { + Orientation = foreshoreProfile.Orientation; + UseForeshore = foreshoreProfile.Geometry.Count() > 1; + UseBreakWater = foreshoreProfile.HasBreakWater; + BreakWater = foreshoreProfile.HasBreakWater + ? new BreakWater(foreshoreProfile.BreakWater.Type, foreshoreProfile.BreakWater.Height) + : GetDefaultBreakWater(); + } + } + private static RoundedDouble ValidateUpperBoundaryInRange(RoundedDouble boundary) { if (boundary > 1000) @@ -348,42 +386,6 @@ return waterLevels; } - public bool IsForeshoreProfileParametersSynchronized - { - get - { - if (foreshoreProfile == null) - { - return false; - } - - return - Orientation == foreshoreProfile.Orientation - && UseForeshore == foreshoreProfile.Geometry.Count() > 1 - && UseBreakWater == foreshoreProfile.HasBreakWater - && BreakWater.Equals(foreshoreProfile.BreakWater); - } - } - - public void SynchronizeForeshoreProfileParameters() - { - if (foreshoreProfile == null) - { - UseForeshore = false; - UseBreakWater = false; - BreakWater = GetDefaultBreakWater(); - } - else - { - Orientation = foreshoreProfile.Orientation; - UseForeshore = foreshoreProfile.Geometry.Count() > 1; - UseBreakWater = foreshoreProfile.HasBreakWater; - BreakWater = foreshoreProfile.HasBreakWater - ? new BreakWater(foreshoreProfile.BreakWater.Type, foreshoreProfile.BreakWater.Height) - : GetDefaultBreakWater(); - } - } - private static BreakWater GetDefaultBreakWater() { return new BreakWater(BreakWaterType.Dam, 0.0); Index: Ringtoets/Revetment/test/Ringtoets.Revetment.Data.Test/WaveConditionsInputTest.cs =================================================================== diff -u -r9b0af3f940ae57b373ab4edfd7da944090255fde -rfaa45d14b96d0433ec561a39635ad6285b1ad5e3 --- Ringtoets/Revetment/test/Ringtoets.Revetment.Data.Test/WaveConditionsInputTest.cs (.../WaveConditionsInputTest.cs) (revision 9b0af3f940ae57b373ab4edfd7da944090255fde) +++ Ringtoets/Revetment/test/Ringtoets.Revetment.Data.Test/WaveConditionsInputTest.cs (.../WaveConditionsInputTest.cs) (revision faa45d14b96d0433ec561a39635ad6285b1ad5e3) @@ -212,10 +212,14 @@ Orientation = orientation }); + // Precondition + Assert.IsFalse(input.IsForeshoreProfileParametersSynchronized); + // Call input.ForeshoreProfile = foreshoreProfile; // Assert + Assert.IsTrue(input.IsForeshoreProfileParametersSynchronized); Assert.AreSame(foreshoreProfile, input.ForeshoreProfile); Assert.AreEqual(withBreakWater, input.UseBreakWater); Assert.AreEqual(withBreakWater ? foreshoreProfile.BreakWater.Type : originalBreakWaterType, input.BreakWater.Type); @@ -252,6 +256,7 @@ input.ForeshoreProfile = foreshoreProfile; // Precondition + Assert.IsTrue(input.IsForeshoreProfileParametersSynchronized); Assert.AreSame(foreshoreProfile, input.ForeshoreProfile); Assert.IsTrue(input.UseBreakWater); Assert.AreNotEqual(originalBreakWaterType, input.BreakWater.Type); @@ -264,6 +269,7 @@ input.ForeshoreProfile = null; // Assert + Assert.IsFalse(input.IsForeshoreProfileParametersSynchronized); Assert.IsFalse(input.UseBreakWater); Assert.AreEqual(originalBreakWaterType, input.BreakWater.Type); Assert.AreEqual(originalBreakWaterHeight, input.BreakWater.Height); Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/TreeNodeInfos/StabilityPointStructuresCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -rada94ef2b6943fb9a2d8e59256871205a7d4c4ee -rfaa45d14b96d0433ec561a39635ad6285b1ad5e3 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/TreeNodeInfos/StabilityPointStructuresCalculationContextTreeNodeInfoTest.cs (.../StabilityPointStructuresCalculationContextTreeNodeInfoTest.cs) (revision ada94ef2b6943fb9a2d8e59256871205a7d4c4ee) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/TreeNodeInfos/StabilityPointStructuresCalculationContextTreeNodeInfoTest.cs (.../StabilityPointStructuresCalculationContextTreeNodeInfoTest.cs) (revision faa45d14b96d0433ec561a39635ad6285b1ad5e3) @@ -442,7 +442,7 @@ } [Test] - public void ContextMenuStrip_WithForeshoreProfile_ContextMenuItemUpdateForeshoreProfileEnabled() + public void ContextMenuStrip_WithForeshoreProfileAndChanges_ContextMenuItemUpdateForeshoreProfileEnabled() { // Setup var assessmentSectionStub = mocks.Stub(); @@ -454,6 +454,7 @@ ForeshoreProfile = new TestForeshoreProfile() } }; + calculation.InputParameters.UseBreakWater = true; var nodeData = new StabilityPointStructuresCalculationContext(calculation, failureMechanism, assessmentSectionStub); Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -rada94ef2b6943fb9a2d8e59256871205a7d4c4ee -rfaa45d14b96d0433ec561a39635ad6285b1ad5e3 --- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision ada94ef2b6943fb9a2d8e59256871205a7d4c4ee) +++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision faa45d14b96d0433ec561a39635ad6285b1ad5e3) @@ -686,7 +686,7 @@ } [Test] - public void ContextMenuStrip_WithForeshoreProfile_ContextMenuItemUpdateForeshoreProfileEnabled() + public void ContextMenuStrip_WithForeshoreProfileAndChanges_ContextMenuItemUpdateForeshoreProfileEnabled() { // Setup var assessmentSectionStub = mocks.Stub(); @@ -698,6 +698,7 @@ ForeshoreProfile = new TestForeshoreProfile() } }; + calculation.InputParameters.UseBreakWater = true; var nodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationContext(calculation, failureMechanism, assessmentSectionStub);