Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/DerivedMacroStabilityInwardsInputTest.cs =================================================================== diff -u -r4888594ebb719e8d63af0d80ae6a866bb134bdbc -r1aee3bed1c335bc1b6e48d1c5ca3df85d1f15633 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/DerivedMacroStabilityInwardsInputTest.cs (.../DerivedMacroStabilityInwardsInputTest.cs) (revision 4888594ebb719e8d63af0d80ae6a866bb134bdbc) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/DerivedMacroStabilityInwardsInputTest.cs (.../DerivedMacroStabilityInwardsInputTest.cs) (revision 1aee3bed1c335bc1b6e48d1c5ca3df85d1f15633) @@ -21,10 +21,12 @@ using System; using Core.Common.Base.Data; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil; using Ringtoets.MacroStabilityInwards.Data.TestUtil; using Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators; +using Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.Waternet.Input; using Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Calculators; using Ringtoets.MacroStabilityInwards.Primitives; @@ -45,7 +47,7 @@ } [Test] - public void GetWaternetExtreme_SoilProfileNull_ReturnMacroStabilityInwardsWaternet() + public void GetWaternetExtreme_SoilProfileNull_ReturnsMacroStabilityInwardsWaternet() { // Setup MacroStabilityInwardsCalculationScenario calculation = MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput(); @@ -64,7 +66,7 @@ } [Test] - public void GetWaternetExtreme_SurfaceLineNull_ReturnMacroStabilityInwardsWaternet() + public void GetWaternetExtreme_SurfaceLineNull_ReturnsMacroStabilityInwardsWaternet() { // Setup MacroStabilityInwardsCalculationScenario calculation = MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput(); @@ -83,19 +85,21 @@ } [Test] - public void GetWaternetExtreme_ValidInput_ReturnMacroStabilityInwardsWaternet() + public void GetWaternetExtreme_ValidInput_SetsAssessmentLevelToCalculatorInputAndReturnsMacroStabilityInwardsWaternet() { // Setup + RoundedDouble assessmentLevel = new Random(21).NextRoundedDouble(); MacroStabilityInwardsCalculationScenario calculation = MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput(); using (new MacroStabilityInwardsCalculatorFactoryConfig()) { - var calculatorFactory = (TestMacroStabilityInwardsCalculatorFactory) MacroStabilityInwardsCalculatorFactory.Instance; - // Call - MacroStabilityInwardsWaternet waternet = DerivedMacroStabilityInwardsInput.GetWaternetExtreme(calculation.InputParameters, RoundedDouble.NaN); + MacroStabilityInwardsWaternet waternet = DerivedMacroStabilityInwardsInput.GetWaternetExtreme(calculation.InputParameters, assessmentLevel); // Assert + var calculatorFactory = (TestMacroStabilityInwardsCalculatorFactory) MacroStabilityInwardsCalculatorFactory.Instance; + + Assert.AreEqual(assessmentLevel, calculatorFactory.LastCreatedWaternetCalculator.Input.AssessmentLevel); CalculatorOutputAssert.AssertWaternet(calculatorFactory.LastCreatedWaternetCalculator.Output, waternet); } } @@ -112,7 +116,7 @@ } [Test] - public void GetWaternetDaily_SoilProfileNull_ReturnMacroStabilityInwardsWaternet() + public void GetWaternetDaily_SoilProfileNull_ReturnsMacroStabilityInwardsWaternet() { // Setup MacroStabilityInwardsCalculationScenario calculation = MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput(); @@ -131,7 +135,7 @@ } [Test] - public void GetWaternetDaily_SurfaceLineNull_ReturnMacroStabilityInwardsWaternet() + public void GetWaternetDaily_SurfaceLineNull_ReturnsMacroStabilityInwardsWaternet() { // Setup MacroStabilityInwardsCalculationScenario calculation = MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput(); @@ -150,19 +154,19 @@ } [Test] - public void GetWaternetDaily_ValidInput_ReturnMacroStabilityInwardsWaternet() + public void GetWaternetDaily_ValidInput_ReturnsMacroStabilityInwardsWaternet() { // Setup MacroStabilityInwardsCalculationScenario calculation = MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput(); using (new MacroStabilityInwardsCalculatorFactoryConfig()) { - var calculatorFactory = (TestMacroStabilityInwardsCalculatorFactory) MacroStabilityInwardsCalculatorFactory.Instance; - // Call MacroStabilityInwardsWaternet waternet = DerivedMacroStabilityInwardsInput.GetWaternetDaily(calculation.InputParameters); // Assert + var calculatorFactory = (TestMacroStabilityInwardsCalculatorFactory) MacroStabilityInwardsCalculatorFactory.Instance; + CalculatorOutputAssert.AssertWaternet(calculatorFactory.LastCreatedWaternetCalculator.Output, waternet); } } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsInputContextPropertiesTest.cs =================================================================== diff -u -r2f0f4e0bd2be4afb1e2b8f5b2380c6a8abea8ad3 -r1aee3bed1c335bc1b6e48d1c5ca3df85d1f15633 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsInputContextPropertiesTest.cs (.../MacroStabilityInwardsInputContextPropertiesTest.cs) (revision 2f0f4e0bd2be4afb1e2b8f5b2380c6a8abea8ad3) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsInputContextPropertiesTest.cs (.../MacroStabilityInwardsInputContextPropertiesTest.cs) (revision 1aee3bed1c335bc1b6e48d1c5ca3df85d1f15633) @@ -39,12 +39,15 @@ using Ringtoets.Common.Forms.PropertyClasses; using Ringtoets.Common.Forms.TestUtil; using Ringtoets.Common.Forms.UITypeEditors; +using Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil; using Ringtoets.MacroStabilityInwards.Data; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; using Ringtoets.MacroStabilityInwards.Data.TestUtil; using Ringtoets.MacroStabilityInwards.Data.TestUtil.SoilProfile; using Ringtoets.MacroStabilityInwards.Forms.PresentationObjects; using Ringtoets.MacroStabilityInwards.Forms.PropertyClasses; +using Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators; +using Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Calculators; using Ringtoets.MacroStabilityInwards.Primitives; namespace Ringtoets.MacroStabilityInwards.Forms.Test.PropertyClasses @@ -445,6 +448,16 @@ Assert.AreSame(inputParameters, properties.WaterStressesProperties.Data); + using (new MacroStabilityInwardsCalculatorFactoryConfig()) + { + MacroStabilityInwardsWaternetProperties waternetProperties = properties.WaterStressesProperties.WaterStressLines.WaternetExtreme; + + var calculatorFactory = (TestMacroStabilityInwardsCalculatorFactory) MacroStabilityInwardsCalculatorFactory.Instance; + + Assert.AreEqual(expectedAssessmentLevel, calculatorFactory.LastCreatedWaternetCalculator.Input.AssessmentLevel); + CalculatorOutputAssert.AssertWaternet(calculatorFactory.LastCreatedWaternetCalculator.Output, (MacroStabilityInwardsWaternet) waternetProperties.Data); + } + Assert.AreEqual(inputParameters.SlipPlaneMinimumDepth, properties.SlipPlaneMinimumDepth); Assert.AreEqual(inputParameters.SlipPlaneMinimumLength, properties.SlipPlaneMinimumLength); Assert.AreEqual(inputParameters.MaximumSliceWidth, properties.MaximumSliceWidth); Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsWaterStressLinesPropertiesTest.cs =================================================================== diff -u -rcb7cf1ee86e858b3b552335b4924e21d5cc1e387 -r1aee3bed1c335bc1b6e48d1c5ca3df85d1f15633 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsWaterStressLinesPropertiesTest.cs (.../MacroStabilityInwardsWaterStressLinesPropertiesTest.cs) (revision cb7cf1ee86e858b3b552335b4924e21d5cc1e387) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsWaterStressLinesPropertiesTest.cs (.../MacroStabilityInwardsWaterStressLinesPropertiesTest.cs) (revision 1aee3bed1c335bc1b6e48d1c5ca3df85d1f15633) @@ -25,8 +25,13 @@ using Core.Common.Gui.PropertyBag; using Core.Common.TestUtil; using NUnit.Framework; +using Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil; using Ringtoets.MacroStabilityInwards.Data; +using Ringtoets.MacroStabilityInwards.Data.TestUtil; using Ringtoets.MacroStabilityInwards.Forms.PropertyClasses; +using Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators; +using Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Calculators; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Ringtoets.MacroStabilityInwards.Forms.Test.PropertyClasses { @@ -63,22 +68,48 @@ } [Test] - public void GetProperties_WithData_ReturnExpectedValues() + public void WaternetExtreme_ValidWaternet_ExpectedValue() { // Setup - var input = new MacroStabilityInwardsInput(new MacroStabilityInwardsInput.ConstructionProperties()); + RoundedDouble assessmentLevel = new Random(21).NextRoundedDouble(); + MacroStabilityInwardsCalculationScenario calculation = MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput(); - // Call - var properties = new MacroStabilityInwardsWaterStressLinesProperties(input, GetTestNormativeAssessmentLevel()); + var properties = new MacroStabilityInwardsWaterStressLinesProperties(calculation.InputParameters, assessmentLevel); - // Assert - CollectionAssert.IsEmpty(properties.WaternetExtreme.PhreaticLines); - CollectionAssert.IsEmpty(properties.WaternetExtreme.WaternetLines); - CollectionAssert.IsEmpty(properties.WaternetDaily.PhreaticLines); - CollectionAssert.IsEmpty(properties.WaternetDaily.WaternetLines); + using (new MacroStabilityInwardsCalculatorFactoryConfig()) + { + // Call + MacroStabilityInwardsWaternetProperties waternetProperties = properties.WaternetExtreme; + + // Assert + var calculatorFactory = (TestMacroStabilityInwardsCalculatorFactory) MacroStabilityInwardsCalculatorFactory.Instance; + + Assert.AreEqual(assessmentLevel, calculatorFactory.LastCreatedWaternetCalculator.Input.AssessmentLevel); + CalculatorOutputAssert.AssertWaternet(calculatorFactory.LastCreatedWaternetCalculator.Output, (MacroStabilityInwardsWaternet) waternetProperties.Data); + } } [Test] + public void WaternetDaily_ValidWaternet_ExpectedValue() + { + // Setup + MacroStabilityInwardsCalculationScenario calculation = MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput(); + + var properties = new MacroStabilityInwardsWaterStressLinesProperties(calculation.InputParameters, GetTestNormativeAssessmentLevel()); + + using (new MacroStabilityInwardsCalculatorFactoryConfig()) + { + // Call + MacroStabilityInwardsWaternetProperties waternetProperties = properties.WaternetDaily; + + // Assert + var calculatorFactory = (TestMacroStabilityInwardsCalculatorFactory) MacroStabilityInwardsCalculatorFactory.Instance; + + CalculatorOutputAssert.AssertWaternet(calculatorFactory.LastCreatedWaternetCalculator.Output, (MacroStabilityInwardsWaternet) waternetProperties.Data); + } + } + + [Test] public void ToString_Always_ReturnEmpty() { // Setup Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsWaterStressesPropertiesTest.cs =================================================================== diff -u -r28d9f08e359c89436494ad63a6cb7832baa10341 -r1aee3bed1c335bc1b6e48d1c5ca3df85d1f15633 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsWaterStressesPropertiesTest.cs (.../MacroStabilityInwardsWaterStressesPropertiesTest.cs) (revision 28d9f08e359c89436494ad63a6cb7832baa10341) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsWaterStressesPropertiesTest.cs (.../MacroStabilityInwardsWaterStressesPropertiesTest.cs) (revision 1aee3bed1c335bc1b6e48d1c5ca3df85d1f15633) @@ -31,8 +31,13 @@ using Ringtoets.Common.Forms.ChangeHandlers; using Ringtoets.Common.Forms.PropertyClasses; using Ringtoets.Common.Forms.TestUtil; +using Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil; using Ringtoets.MacroStabilityInwards.Data; +using Ringtoets.MacroStabilityInwards.Data.TestUtil; using Ringtoets.MacroStabilityInwards.Forms.PropertyClasses; +using Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators; +using Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Calculators; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Ringtoets.MacroStabilityInwards.Forms.Test.PropertyClasses { @@ -247,16 +252,30 @@ var propertyChangeHandler = mocks.Stub(); mocks.ReplayAll(); - var input = new MacroStabilityInwardsInput(new MacroStabilityInwardsInput.ConstructionProperties()); + RoundedDouble assessmentLevel = new Random(21).NextRoundedDouble(); + MacroStabilityInwardsCalculationScenario calculation = MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput(); + MacroStabilityInwardsInput input = calculation.InputParameters; // Call - var properties = new MacroStabilityInwardsWaterStressesProperties(input, GetTestNormativeAssessmentLevel(), propertyChangeHandler); + var properties = new MacroStabilityInwardsWaterStressesProperties(input, assessmentLevel, propertyChangeHandler); // Assert Assert.AreEqual(input.WaterLevelRiverAverage, properties.WaterLevelRiverAverage); Assert.AreSame(input.LocationInputExtreme, properties.LocationExtreme.Data); Assert.AreSame(input.LocationInputDaily, properties.LocationDaily.Data); + Assert.AreSame(input, properties.WaterStressLines.Data); + + using (new MacroStabilityInwardsCalculatorFactoryConfig()) + { + MacroStabilityInwardsWaternetProperties waternetProperties = properties.WaterStressLines.WaternetExtreme; + + var calculatorFactory = (TestMacroStabilityInwardsCalculatorFactory) MacroStabilityInwardsCalculatorFactory.Instance; + + Assert.AreEqual(assessmentLevel, calculatorFactory.LastCreatedWaternetCalculator.Input.AssessmentLevel); + CalculatorOutputAssert.AssertWaternet(calculatorFactory.LastCreatedWaternetCalculator.Output, (MacroStabilityInwardsWaternet) waternetProperties.Data); + } + Assert.AreSame(input, properties.Drainage.Data); Assert.AreEqual(input.MinimumLevelPhreaticLineAtDikeTopRiver, properties.MinimumLevelPhreaticLineAtDikeTopRiver); Assert.AreEqual(input.MinimumLevelPhreaticLineAtDikeTopPolder, properties.MinimumLevelPhreaticLineAtDikeTopPolder); @@ -277,8 +296,8 @@ var calculationItem = new MacroStabilityInwardsCalculationScenario(); MacroStabilityInwardsInput input = calculationItem.InputParameters; - var handler = new ObservablePropertyChangeHandler(calculationItem, input); - var properties = new MacroStabilityInwardsWaterStressesProperties(input, GetTestNormativeAssessmentLevel(), handler); + var propertyChangeHandler = new ObservablePropertyChangeHandler(calculationItem, input); + var properties = new MacroStabilityInwardsWaterStressesProperties(input, GetTestNormativeAssessmentLevel(), propertyChangeHandler); var random = new Random(21); double waterLevelRiverAverage = random.NextDouble(); @@ -460,18 +479,18 @@ MacroStabilityInwardsInput input = calculation.InputParameters; - var handler = new SetPropertyValueAfterConfirmationParameterTester(new[] + var propertyChangeHandler = new SetPropertyValueAfterConfirmationParameterTester(new[] { observable }); - var properties = new MacroStabilityInwardsWaterStressesProperties(input, GetTestNormativeAssessmentLevel(), handler); + var properties = new MacroStabilityInwardsWaterStressesProperties(input, GetTestNormativeAssessmentLevel(), propertyChangeHandler); // Call setProperty(properties); // Assert - Assert.IsTrue(handler.Called); + Assert.IsTrue(propertyChangeHandler.Called); mocks.VerifyAll(); } } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Ringtoets.MacroStabilityInwards.Forms.Test.csproj =================================================================== diff -u -r74df3b2f37b578eb5f0d5c8d33379d965805bb8e -r1aee3bed1c335bc1b6e48d1c5ca3df85d1f15633 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Ringtoets.MacroStabilityInwards.Forms.Test.csproj (.../Ringtoets.MacroStabilityInwards.Forms.Test.csproj) (revision 74df3b2f37b578eb5f0d5c8d33379d965805bb8e) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Ringtoets.MacroStabilityInwards.Forms.Test.csproj (.../Ringtoets.MacroStabilityInwards.Forms.Test.csproj) (revision 1aee3bed1c335bc1b6e48d1c5ca3df85d1f15633) @@ -182,10 +182,18 @@ {69ebf07f-20e5-4b5a-8620-c2638191afed} Ringtoets.MacroStabilityInwards.Forms + + {3C0D3B38-A9F7-4B22-9705-513DA26AE2CC} + Ringtoets.MacroStabilityInwards.KernelWrapper + {e9b39743-2dc9-4922-9e0f-6ba3e0e54189} Ringtoets.MacroStabilityInwards.Primitives + + {53F7C73E-6D85-4B90-A6A8-DAA7F4BCB071} + Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil + {2b78cf04-4785-4f27-a6e5-45bddbb7bf04} Ringtoets.MacroStabilityInwards.Data.TestUtil