Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/MacroStabilityInwardsInput.cs =================================================================== diff -u -rd3a6fe9ed562db5846e576c3f5853ba4ce14fcf2 -rc609b717a3669a4f9e440b032052a7670b76b8f7 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/MacroStabilityInwardsInput.cs (.../MacroStabilityInwardsInput.cs) (revision d3a6fe9ed562db5846e576c3f5853ba4ce14fcf2) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/MacroStabilityInwardsInput.cs (.../MacroStabilityInwardsInput.cs) (revision c609b717a3669a4f9e440b032052a7670b76b8f7) @@ -259,6 +259,7 @@ /// Gets or sets the outside high water level. /// [m+NAP] /// + /// This property is only used for calculations when is true. public RoundedDouble AssessmentLevel { get Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/MacroStabilityInwardsInputTest.cs =================================================================== diff -u -rc0532d07766ecad2566f7cfa4a97a9aeb6e8540c -rc609b717a3669a4f9e440b032052a7670b76b8f7 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/MacroStabilityInwardsInputTest.cs (.../MacroStabilityInwardsInputTest.cs) (revision c0532d07766ecad2566f7cfa4a97a9aeb6e8540c) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/MacroStabilityInwardsInputTest.cs (.../MacroStabilityInwardsInputTest.cs) (revision c609b717a3669a4f9e440b032052a7670b76b8f7) @@ -29,7 +29,6 @@ using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.Calculation; -using Ringtoets.Common.Data.Hydraulics; using Ringtoets.Common.Data.TestUtil; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; using Ringtoets.MacroStabilityInwards.Data.TestUtil; @@ -69,9 +68,8 @@ Assert.IsNull(inputParameters.HydraulicBoundaryLocation); Assert.IsNull(inputParameters.SoilProfileUnderSurfaceLine); - Assert.IsInstanceOf(inputParameters.AssessmentLevel); Assert.IsNaN(inputParameters.AssessmentLevel); - + Assert.AreEqual(2, inputParameters.AssessmentLevel.NumberOfDecimalPlaces); Assert.IsFalse(inputParameters.UseAssessmentLevelManualInput); Assert.AreEqual(0, inputParameters.SlipPlaneMinimumDepth, inputParameters.SlipPlaneMinimumDepth.GetAccuracy()); @@ -223,6 +221,7 @@ { // Setup var random = new Random(21); + double assessmentLevel = random.NextDouble(); double slipPlaneMinimumDepth = random.NextDouble(); double slipPlaneMinimumLength = random.NextDouble(); double maximumSliceWidth = random.NextDouble(); @@ -246,6 +245,7 @@ // Call var input = new MacroStabilityInwardsInput(new MacroStabilityInwardsInput.ConstructionProperties()) { + AssessmentLevel = (RoundedDouble) assessmentLevel, SlipPlaneMinimumDepth = (RoundedDouble) slipPlaneMinimumDepth, SlipPlaneMinimumLength = (RoundedDouble) slipPlaneMinimumLength, MaximumSliceWidth = (RoundedDouble) maximumSliceWidth, @@ -268,6 +268,9 @@ }; // Assert + Assert.AreEqual(2, input.AssessmentLevel.NumberOfDecimalPlaces); + Assert.AreEqual(assessmentLevel, input.AssessmentLevel, input.AssessmentLevel.GetAccuracy()); + Assert.AreEqual(2, input.SlipPlaneMinimumDepth.NumberOfDecimalPlaces); Assert.AreEqual(slipPlaneMinimumDepth, input.SlipPlaneMinimumDepth, input.SlipPlaneMinimumDepth.GetAccuracy()); @@ -320,134 +323,6 @@ } [Test] - public void AssessmentLevel_UseAssessmentLevelManualInputIsFalse_ReturnsNaN() - { - // Setup - var input = new MacroStabilityInwardsInput(new MacroStabilityInwardsInput.ConstructionProperties()) - { - UseAssessmentLevelManualInput = false, - HydraulicBoundaryLocation = new TestHydraulicBoundaryLocation() - }; - - // Call - RoundedDouble calculatedAssessmentLevel = input.AssessmentLevel; - - // Assert - Assert.IsNaN(calculatedAssessmentLevel); - } - - [Test] - public void AssessmentLevel_UseAssessmentLevelManualInputIsFalseWithHydraulicLocationSetAndDesignWaterLevelOutputSet_ReturnCalculatedAssessmentLevel() - { - // Setup - double calculatedAssessmentLevel = new Random(21).NextDouble(); - HydraulicBoundaryLocation testHydraulicBoundaryLocation = new TestHydraulicBoundaryLocation - { - DesignWaterLevelCalculation1 = - { - Output = new TestHydraulicBoundaryLocationOutput(calculatedAssessmentLevel) - } - }; - - var input = new MacroStabilityInwardsInput(new MacroStabilityInwardsInput.ConstructionProperties()) - { - HydraulicBoundaryLocation = testHydraulicBoundaryLocation - }; - - // Call - RoundedDouble newAssessmentLevel = input.AssessmentLevel; - - // Assert - Assert.AreEqual(calculatedAssessmentLevel, newAssessmentLevel, input.AssessmentLevel.GetAccuracy()); - } - - [Test] - public void AssessmentLevel_UseAssessmentLevelManualInputFalseAndSettingValue_ThrowsInvalidOperationException() - { - // Setup - var input = new MacroStabilityInwardsInput(new MacroStabilityInwardsInput.ConstructionProperties()) - { - UseAssessmentLevelManualInput = false - }; - - var testLevel = (RoundedDouble) new Random(21).NextDouble(); - - // Call - TestDelegate call = () => input.AssessmentLevel = testLevel; - - // Assert - string message = Assert.Throws(call).Message; - Assert.AreEqual("UseAssessmentLevelManualInput is false", message); - } - - [Test] - public void AssessmentLevel_UseAssessmentLevelManualInputTrueAndSettingValue_ReturnSetValue() - { - // Setup - var input = new MacroStabilityInwardsInput(new MacroStabilityInwardsInput.ConstructionProperties()) - { - UseAssessmentLevelManualInput = true - }; - - var testLevel = (RoundedDouble) new Random(21).NextDouble(); - - // Call - input.AssessmentLevel = testLevel; - - // Assert - Assert.AreEqual(2, input.AssessmentLevel.NumberOfDecimalPlaces); - Assert.AreEqual(testLevel, input.AssessmentLevel, input.AssessmentLevel.GetAccuracy()); - } - - [Test] - public void GivenAssessmentLevelSetByHydraulicBoundaryLocation_WhenManualAssessmentLevelTrueAndNewLevelSet_ThenLevelUpdatedAndLocationRemoved() - { - // Given - var random = new Random(21); - var testLevel = (RoundedDouble) random.NextDouble(); - var input = new MacroStabilityInwardsInput(new MacroStabilityInwardsInput.ConstructionProperties()) - { - HydraulicBoundaryLocation = TestHydraulicBoundaryLocation.CreateDesignWaterLevelCalculated(testLevel) - }; - - var newLevel = (RoundedDouble) random.NextDouble(); - - // When - input.UseAssessmentLevelManualInput = true; - 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 GivenAssessmentLevelSetByManualInput_WhenManualAssessmentLevelFalseAndHydraulicBoundaryLocationSet_ThenAssessmentLevelUpdatedAndLocationSet() - { - // Given - var random = new Random(21); - var testLevel = (RoundedDouble) random.NextDouble(); - var input = new MacroStabilityInwardsInput(new MacroStabilityInwardsInput.ConstructionProperties()) - { - UseAssessmentLevelManualInput = true, - AssessmentLevel = testLevel - }; - - var newLevel = (RoundedDouble) random.NextDouble(); - TestHydraulicBoundaryLocation hydraulicBoundaryLocation = TestHydraulicBoundaryLocation.CreateDesignWaterLevelCalculated(newLevel); - - // When - input.UseAssessmentLevelManualInput = false; - 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 GivenInput_WhenSurfaceLineSetAndStochasticSoilProfileNull_ThenSoilProfileUnderSurfaceLineNull() { // Given