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