Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs =================================================================== diff -u -r4c1b7cae9e302e07399e1045dac0fe81f1dbe3b5 -r779548d2d9deb4e87dbdc03739b94a2e332c7d47 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs (.../PipingInputContextPropertiesTest.cs) (revision 4c1b7cae9e302e07399e1045dac0fe81f1dbe3b5) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs (.../PipingInputContextPropertiesTest.cs) (revision 779548d2d9deb4e87dbdc03739b94a2e332c7d47) @@ -66,7 +66,7 @@ { // Setup var mocks = new MockRepository(); - var assessmentSectionMock = mocks.StrictMock(); + var assessmentSection = mocks.Stub(); mocks.ReplayAll(); PipingCalculationScenario calculationItem = new PipingCalculationScenario(new GeneralPipingInput()); PipingFailureMechanism failureMechanism = new PipingFailureMechanism(); @@ -81,7 +81,7 @@ Enumerable.Empty(), Enumerable.Empty(), failureMechanism, - assessmentSectionMock) + assessmentSection) }; // Assert @@ -223,7 +223,7 @@ { // Setup var mocks = new MockRepository(); - var assessmentSectionMock = mocks.StrictMock(); + var assessmentSection = mocks.Stub(); mocks.ReplayAll(); var random = new Random(22); @@ -262,7 +262,7 @@ Enumerable.Empty(), Enumerable.Empty(), failureMechanism, - assessmentSectionMock) + assessmentSection) }; // Call & Assert @@ -307,7 +307,7 @@ { // Setup var mocks = new MockRepository(); - var assessmentSectionMock = mocks.StrictMock(); + var assessmentSection = mocks.Stub(); var projectObserver = mocks.StrictMock(); projectObserver.Expect(o => o.UpdateObserver()); mocks.ReplayAll(); @@ -325,7 +325,7 @@ Enumerable.Empty(), Enumerable.Empty(), failureMechanism, - assessmentSectionMock) + assessmentSection) }; const double entryPointL = 0.12; @@ -343,7 +343,7 @@ { // Setup var mocks = new MockRepository(); - var assessmentSectionMock = mocks.StrictMock(); + var assessmentSection = mocks.Stub(); var projectObserver = mocks.StrictMock(); int numberOfChangedProperties = 6; projectObserver.Expect(o => o.UpdateObserver()).Repeat.Times(numberOfChangedProperties); @@ -387,7 +387,7 @@ stochasticSoilModel2 }, failureMechanism, - assessmentSectionMock), + assessmentSection), DampingFactorExit = new LogNormalDistributionDesignVariable(dampingFactorExit), PhreaticLevelExit = new NormalDistributionDesignVariable(phreaticLevelExit), SurfaceLine = surfaceLine, @@ -427,7 +427,7 @@ { // Setup var mocks = new MockRepository(); - var assessmentSectionMock = mocks.StrictMock(); + var assessmentSection = mocks.Stub(); var inputObserver = mocks.StrictMock(); int numberOfChangedProperties = 2; inputObserver.Expect(o => o.UpdateObserver()).Repeat.Times(numberOfChangedProperties); @@ -450,7 +450,7 @@ Enumerable.Empty(), Enumerable.Empty(), failureMechanism, - assessmentSectionMock), + assessmentSection), ExitPointL = (RoundedDouble) exitPoint, EntryPointL = (RoundedDouble) entryPoint }; @@ -468,7 +468,7 @@ { // Setup var mocks = new MockRepository(); - var assessmentSectionMock = mocks.StrictMock(); + var assessmentSection = mocks.Stub(); var inputObserver = mocks.StrictMock(); int numberOfChangedProperties = 2; inputObserver.Expect(o => o.UpdateObserver()).Repeat.Times(numberOfChangedProperties); @@ -491,7 +491,7 @@ Enumerable.Empty(), Enumerable.Empty(), failureMechanism, - assessmentSectionMock), + assessmentSection), EntryPointL = (RoundedDouble) 0.5, ExitPointL = (RoundedDouble) 2 }; @@ -511,7 +511,7 @@ { // Setup var mocks = new MockRepository(); - var assessmentSectionMock = mocks.StrictMock(); + var assessmentSection = mocks.Stub(); var inputObserver = mocks.StrictMock(); mocks.ReplayAll(); @@ -531,7 +531,7 @@ Enumerable.Empty(), Enumerable.Empty(), failureMechanism, - assessmentSectionMock), + assessmentSection), EntryPointL = (RoundedDouble) 2.0 }; @@ -553,7 +553,7 @@ { // Setup var mocks = new MockRepository(); - var assessmentSectionMock = mocks.StrictMock(); + var assessmentSection = mocks.Stub(); var inputObserver = mocks.StrictMock(); mocks.ReplayAll(); @@ -573,7 +573,7 @@ Enumerable.Empty(), Enumerable.Empty(), failureMechanism, - assessmentSectionMock), + assessmentSection), ExitPointL = (RoundedDouble) 2.0 }; @@ -593,7 +593,7 @@ { // Setup var mocks = new MockRepository(); - var assessmentSectionMock = mocks.StrictMock(); + var assessmentSection = mocks.Stub(); var inputObserver = mocks.StrictMock(); mocks.ReplayAll(); @@ -613,7 +613,7 @@ Enumerable.Empty(), Enumerable.Empty(), failureMechanism, - assessmentSectionMock), + assessmentSection), ExitPointL = (RoundedDouble) 2.0 }; @@ -633,7 +633,7 @@ { // Setup var mocks = new MockRepository(); - var assessmentSectionMock = mocks.StrictMock(); + var assessmentSection = mocks.Stub(); var inputObserver = mocks.StrictMock(); mocks.ReplayAll(); @@ -653,7 +653,7 @@ Enumerable.Empty(), Enumerable.Empty(), failureMechanism, - assessmentSectionMock), + assessmentSection), EntryPointL = (RoundedDouble) 2.0 }; @@ -673,7 +673,7 @@ { // Setup var mocks = new MockRepository(); - var assessmentSectionMock = mocks.Stub(); + var assessmentSection = mocks.Stub(); var projectObserver = mocks.StrictMock(); projectObserver.Expect(o => o.UpdateObserver()); mocks.ReplayAll(); @@ -684,10 +684,7 @@ PipingInput inputParameters = new PipingInput(new GeneralPipingInput()) { - HydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, string.Empty, 0.0, 0.0) - { - DesignWaterLevel = assessmentLevel - } + HydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(assessmentLevel) }; inputParameters.Attach(projectObserver); @@ -698,14 +695,10 @@ Enumerable.Empty(), Enumerable.Empty(), failureMechanism, - assessmentSectionMock) + assessmentSection) }; - string testName = "TestName"; - var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, testName, 0, 0) - { - DesignWaterLevel = RoundedDouble.NaN - }; + var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(); var selectableHydraulicBoundaryLocation = new SelectableHydraulicBoundaryLocation(hydraulicBoundaryLocation, null); // Call @@ -744,10 +737,7 @@ }; RoundedDouble testLevel = (RoundedDouble) new Random(21).NextDouble(); - var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, string.Empty, 0, 0) - { - DesignWaterLevel = testLevel - }; + var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(testLevel); var selectableHydraulicBoundaryLocation = new SelectableHydraulicBoundaryLocation(hydraulicBoundaryLocation, null); // Call @@ -764,7 +754,7 @@ { // Given var mocks = new MockRepository(); - var assessmentSectionMock = mocks.Stub(); + var assessmentSection = mocks.Stub(); mocks.ReplayAll(); PipingCalculationScenario calculationItem = new PipingCalculationScenario(new GeneralPipingInput()); @@ -773,10 +763,7 @@ var random = new Random(21); PipingInput inputParameters = new PipingInput(new GeneralPipingInput()) { - HydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, string.Empty, 0, 0) - { - DesignWaterLevel = (RoundedDouble) 50 - } + HydraulicBoundaryLocation = new TestHydraulicBoundaryLocation((RoundedDouble) 50) }; PipingInputContextProperties properties = new PipingInputContextProperties @@ -786,7 +773,7 @@ Enumerable.Empty(), Enumerable.Empty(), failureMechanism, - assessmentSectionMock) + assessmentSection) }; RoundedDouble testLevel = (RoundedDouble) random.NextDouble(); @@ -811,7 +798,7 @@ { // Setup var mocks = new MockRepository(); - var assessmentSectionMock = mocks.Stub(); + var assessmentSection = mocks.Stub(); var projectObserver = mocks.StrictMock(); projectObserver.Expect(o => o.UpdateObserver()).Repeat.Times(1); mocks.ReplayAll(); @@ -829,7 +816,7 @@ Enumerable.Empty(), Enumerable.Empty(), failureMechanism, - assessmentSectionMock) + assessmentSection) }; // Call @@ -847,7 +834,7 @@ { // Given var mocks = new MockRepository(); - var assessmentSectionMock = mocks.Stub(); + var assessmentSection = mocks.Stub(); mocks.ReplayAll(); PipingCalculationScenario calculationItem = new PipingCalculationScenario(new GeneralPipingInput()); @@ -864,14 +851,11 @@ Enumerable.Empty(), Enumerable.Empty(), failureMechanism, - assessmentSectionMock) + assessmentSection) }; RoundedDouble testLevel = (RoundedDouble) random.NextDouble(); - var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, string.Empty, 0, 0) - { - DesignWaterLevel = testLevel - }; + var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(testLevel); var selectableHydraulicBoundaryLocation = new SelectableHydraulicBoundaryLocation(hydraulicBoundaryLocation, null); // When @@ -890,7 +874,7 @@ { // Setup var mocks = new MockRepository(); - var assessmentSectionMock = mocks.StrictMock(); + var assessmentSection = mocks.Stub(); mocks.ReplayAll(); PipingCalculationScenario calculationItem = new PipingCalculationScenario(new GeneralPipingInput()) @@ -910,7 +894,7 @@ Enumerable.Empty(), Enumerable.Empty(), failureMechanism, - assessmentSectionMock) + assessmentSection) }; inputParameters.StochasticSoilProfile = new StochasticSoilProfile(0.0, SoilProfileType.SoilProfile1D, 0) { @@ -931,7 +915,7 @@ { // Setup var mocks = new MockRepository(); - var assessmentSectionMock = mocks.StrictMock(); + var assessmentSection = mocks.Stub(); mocks.ReplayAll(); RingtoetsPipingSurfaceLine testSurfaceLine = ValidSurfaceLine(0, 2); @@ -961,7 +945,7 @@ stochasticSoilModel }, failureMechanism, - assessmentSectionMock) + assessmentSection) }; // Call @@ -978,7 +962,7 @@ { // Setup var mocks = new MockRepository(); - var assessmentSectionMock = mocks.StrictMock(); + var assessmentSection = mocks.Stub(); mocks.ReplayAll(); StochasticSoilProfile testPipingSoilProfile = new StochasticSoilProfile(0.0, SoilProfileType.SoilProfile1D, 0) @@ -1010,7 +994,7 @@ stochasticSoilModel }, failureMechanism, - assessmentSectionMock) + assessmentSection) }; // Call @@ -1027,7 +1011,7 @@ { // Setup var mocks = new MockRepository(); - var assessmentSectionMock = mocks.StrictMock(); + var assessmentSection = mocks.Stub(); mocks.ReplayAll(); RingtoetsPipingSurfaceLine testSurfaceLine = ValidSurfaceLine(0, 2); @@ -1061,7 +1045,7 @@ Enumerable.Empty(), Enumerable.Empty(), failureMechanism, - assessmentSectionMock) + assessmentSection) }; // Call @@ -1079,8 +1063,8 @@ { // Given var mocks = new MockRepository(); - var typeDescriptorContextMock = mocks.StrictMock(); - var assessmentSectionMock = mocks.StrictMock(); + var typeDescriptorContext = mocks.StrictMock(); + var assessmentSection = mocks.Stub(); PipingCalculationScenario calculationItem = new PipingCalculationScenario(new GeneralPipingInput()); PipingFailureMechanism failureMechanism = new PipingFailureMechanism(); @@ -1093,20 +1077,17 @@ Enumerable.Empty(), Enumerable.Empty(), failureMechanism, - assessmentSectionMock) + assessmentSection) }; - inputParameters.HydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, string.Empty, 0, 0) - { - DesignWaterLevel = (RoundedDouble) 1.0 - }; + inputParameters.HydraulicBoundaryLocation = new TestHydraulicBoundaryLocation((RoundedDouble) 1.0); DesignVariable phreaticLevelExitProperty = contextProperties.PhreaticLevelExit; DynamicPropertyBag dynamicPropertyBag = new DynamicPropertyBag(contextProperties); - typeDescriptorContextMock.Expect(tdc => tdc.Instance).Return(dynamicPropertyBag).Repeat.Twice(); - typeDescriptorContextMock.Stub(tdc => tdc.PropertyDescriptor).Return(dynamicPropertyBag.GetProperties()["PhreaticLevelExit"]); + typeDescriptorContext.Expect(tdc => tdc.Instance).Return(dynamicPropertyBag).Repeat.Twice(); + typeDescriptorContext.Stub(tdc => tdc.PropertyDescriptor).Return(dynamicPropertyBag.GetProperties()["PhreaticLevelExit"]); mocks.ReplayAll(); - PropertyDescriptorCollection properties = new NormalDistributionDesignVariableTypeConverter().GetProperties(typeDescriptorContextMock, phreaticLevelExitProperty); + PropertyDescriptorCollection properties = new NormalDistributionDesignVariableTypeConverter().GetProperties(typeDescriptorContext, phreaticLevelExitProperty); Assert.NotNull(properties); // When @@ -1334,14 +1315,14 @@ { // Setup var mocks = new MockRepository(); - var assessmentSectionStub = mocks.Stub(); + var assessmentSection = mocks.Stub(); mocks.ReplayAll(); var failureMechanism = new PipingFailureMechanism(); var calculation = new PipingCalculationScenario(failureMechanism.GeneralInput); var context = new PipingInputContext(calculation.InputParameters, calculation, failureMechanism.SurfaceLines, failureMechanism.StochasticSoilModels, - failureMechanism, assessmentSectionStub); + failureMechanism, assessmentSection); var properties = new PipingInputContextProperties { Data = context