Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingInput.cs =================================================================== diff -u -r8142644ec1337be8032e9214b1f103c85d9037f7 -r4c1b7cae9e302e07399e1045dac0fe81f1dbe3b5 --- Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingInput.cs (.../PipingInput.cs) (revision 8142644ec1337be8032e9214b1f103c85d9037f7) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingInput.cs (.../PipingInput.cs) (revision 4c1b7cae9e302e07399e1045dac0fe81f1dbe3b5) @@ -256,6 +256,11 @@ : new RoundedDouble(2, double.NaN); } + private void UpdateHydraulicBoundaryLocation() + { + hydraulicBoundaryLocation = null; + } + #region Derived input /// @@ -271,6 +276,7 @@ set { assessmentLevel = value.ToPrecision(assessmentLevel.NumberOfDecimalPlaces); + UpdateHydraulicBoundaryLocation(); } } Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingInputTest.cs =================================================================== diff -u -r8142644ec1337be8032e9214b1f103c85d9037f7 -r4c1b7cae9e302e07399e1045dac0fe81f1dbe3b5 --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingInputTest.cs (.../PipingInputTest.cs) (revision 8142644ec1337be8032e9214b1f103c85d9037f7) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingInputTest.cs (.../PipingInputTest.cs) (revision 4c1b7cae9e302e07399e1045dac0fe81f1dbe3b5) @@ -417,7 +417,7 @@ // Setup PipingInput input = new PipingInput(new GeneralPipingInput()); - RoundedDouble testLevel = (RoundedDouble)new Random(21).NextDouble(); + RoundedDouble testLevel = (RoundedDouble) new Random(21).NextDouble(); // Call input.AssessmentLevel = testLevel; @@ -428,6 +428,55 @@ } [Test] + public void GivenAssessmentLevelSetWithHydraulicBoundaryLocation_WhenNewAssessmentLevelSet_ThenAssessmentLevelUpdatedAndLocationRemoved() + { + // Given + PipingInput input = new PipingInput(new GeneralPipingInput()); + + var random = new Random(21); + RoundedDouble testLevel = (RoundedDouble) random.NextDouble(); + input.HydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, string.Empty, 0.0, 0.0) + { + DesignWaterLevel = testLevel + }; + + var newLevel = (RoundedDouble) random.NextDouble(); + + // When + input.AssessmentLevel = newLevel; + + // Then + Assert.AreEqual(2, input.AssessmentLevel.NumberOfDecimalPlaces); + Assert.AreEqual(newLevel, input.AssessmentLevel, input.AssessmentLevel.GetAccuracy()); + Assert.IsNull(input.HydraulicBoundaryLocation); + } + + [Test] + public void GivenAssessmentLevelSet_WhenNewHydraulicBoundaryLocationSet_ThenAssessmentLevelUpdatedAndLocationSet() + { + // Given + PipingInput input = new PipingInput(new GeneralPipingInput()); + + var random = new Random(21); + var testLevel = (RoundedDouble) random.NextDouble(); + input.AssessmentLevel = testLevel; + + var newLevel = (RoundedDouble) random.NextDouble(); + var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, string.Empty, 0.0, 0.0) + { + DesignWaterLevel = newLevel + }; + + // When + input.HydraulicBoundaryLocation = hydraulicBoundaryLocation; + + // Then + Assert.AreEqual(2, input.AssessmentLevel.NumberOfDecimalPlaces); + Assert.AreSame(hydraulicBoundaryLocation, input.HydraulicBoundaryLocation); + Assert.AreEqual(newLevel, input.AssessmentLevel, input.AssessmentLevel.GetAccuracy()); + } + + [Test] public void PiezometricHeadExit_ValidInput_SetsParametersForCalculatorAndReturnsPiezometricHead() { // Setup Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs =================================================================== diff -u -r8142644ec1337be8032e9214b1f103c85d9037f7 -r4c1b7cae9e302e07399e1045dac0fe81f1dbe3b5 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs (.../PipingInputContextPropertiesTest.cs) (revision 8142644ec1337be8032e9214b1f103c85d9037f7) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs (.../PipingInputContextPropertiesTest.cs) (revision 4c1b7cae9e302e07399e1045dac0fe81f1dbe3b5) @@ -760,7 +760,7 @@ } [Test] - public void GivenAssessmentLevelSetWithHydraulicBoundaryLocation_WhenNewAssessmentLevel_UpdateAssessmentLevel() + public void GivenAssessmentLevelSetWithHydraulicBoundaryLocation_WhenNewAssessmentLevel_UpdateAssessmentLevelAndRemovesLocation() { // Given var mocks = new MockRepository(); @@ -796,9 +796,8 @@ // Then Assert.AreEqual(2, properties.AssessmentLevel.NumberOfDecimalPlaces); - Assert.AreSame(inputParameters.HydraulicBoundaryLocation, - properties.SelectedHydraulicBoundaryLocation.HydraulicBoundaryLocation); Assert.AreEqual(testLevel, properties.AssessmentLevel, properties.AssessmentLevel.GetAccuracy()); + Assert.IsNull(properties.SelectedHydraulicBoundaryLocation); mocks.VerifyAll(); } @@ -880,6 +879,7 @@ // Then Assert.AreEqual(2, properties.AssessmentLevel.NumberOfDecimalPlaces); + Assert.AreSame(hydraulicBoundaryLocation, properties.SelectedHydraulicBoundaryLocation.HydraulicBoundaryLocation); Assert.AreEqual(testLevel, properties.AssessmentLevel, properties.AssessmentLevel.GetAccuracy()); mocks.VerifyAll();