Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs =================================================================== diff -u -rcc2b4067500d40bf504c7c4b3b076061cc390af4 -r09e74252ce6ef417b3df9e14025702b16ce4dca2 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs (.../PipingInputContextPropertiesTest.cs) (revision cc2b4067500d40bf504c7c4b3b076061cc390af4) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs (.../PipingInputContextPropertiesTest.cs) (revision 09e74252ce6ef417b3df9e14025702b16ce4dca2) @@ -1200,6 +1200,104 @@ mocks.VerifyAll(); } + [Test] + public void GetReferenceLocation_InputWithoutSurfaceLine_ReturnsNull() + { + // Setup + var mocks = new MockRepository(); + 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, assessmentSection); + var properties = new PipingInputContextProperties + { + Data = context, + }; + + // Call + Point2D referenceLocation = properties.GetReferenceLocation(); + + // Assert + Assert.IsNull(referenceLocation); + mocks.VerifyAll(); + } + + [Test] + public void GetReferenceLocation_InputWithSurfaceLine_ReturnsReferenceLocation() + { + // Setup + var mocks = new MockRepository(); + 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, assessmentSection); + RingtoetsPipingSurfaceLine surfaceLine = ValidSurfaceLine(0.0, 4.0); + surfaceLine.ReferenceLineIntersectionWorldPoint = new Point2D(0.0, 0.0); + var properties = new PipingInputContextProperties + { + Data = context, + SurfaceLine = surfaceLine + }; + + // Call + Point2D referenceLocation = properties.GetReferenceLocation(); + + // Assert + Assert.AreSame(surfaceLine.ReferenceLineIntersectionWorldPoint, referenceLocation); + mocks.VerifyAll(); + } + + [Test] + public void GetHydraulicBoundaryLocations_InputWithLocations_ReturnLocations() + { + // Setup + var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase() + { + Locations = + { + new HydraulicBoundaryLocation(0, "A", 0, 10), + new HydraulicBoundaryLocation(0, "E", 0, 500), + new HydraulicBoundaryLocation(0, "F", 0, 100), + new HydraulicBoundaryLocation(0, "D", 0, 200), + new HydraulicBoundaryLocation(0, "C", 0, 200), + new HydraulicBoundaryLocation(0, "B", 0, 200) + } + }; + + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; + mocks.ReplayAll(); + + var failureMechanism = new PipingFailureMechanism(); + var calculation = new PipingCalculationScenario(failureMechanism.GeneralInput); + var context = new PipingInputContext(calculation.InputParameters, calculation, + failureMechanism.SurfaceLines, failureMechanism.StochasticSoilModels, + failureMechanism, assessmentSection); + RingtoetsPipingSurfaceLine surfaceLine = ValidSurfaceLine(0.0, 4.0); + surfaceLine.ReferenceLineIntersectionWorldPoint = new Point2D(0.0, 0.0); + var properties = new PipingInputContextProperties + { + Data = context, + SurfaceLine = surfaceLine + }; + + // Call + IEnumerable locations = properties.GetHydraulicBoundaryLocations(); + + // Assert + Assert.AreSame(assessmentSection.HydraulicBoundaryDatabase.Locations, locations); + mocks.VerifyAll(); + } + private static StochasticSoilModel ValidStochasticSoilModel(double xMin, double xMax) { StochasticSoilModel stochasticSoilModel = new StochasticSoilModel(0, "StochasticSoilModelName", "StochasticSoilModelSegmentName");