Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/Waternet/Input/WaternetCalculatorInput.cs =================================================================== diff -u -r557444d8587632235e4fda55487e6f322cde9ce7 -rc6c1bd3e608d35c5fb707033534b5aff950ff55d --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/Waternet/Input/WaternetCalculatorInput.cs (.../WaternetCalculatorInput.cs) (revision 557444d8587632235e4fda55487e6f322cde9ce7) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/Waternet/Input/WaternetCalculatorInput.cs (.../WaternetCalculatorInput.cs) (revision c6c1bd3e608d35c5fb707033534b5aff950ff55d) @@ -40,6 +40,9 @@ /// /// ; /// ; + /// ; + /// ; + /// ; /// /// public WaternetCalculatorInput(ConstructionProperties properties) @@ -57,10 +60,28 @@ { throw new ArgumentException("SoilProfile must be set."); } + if (properties.DrainageConstruction == null) + { + throw new ArgumentException("DrainageConstruction must be set."); + } + if (properties.PhreaticLineOffsetsExtreme == null) + { + throw new ArgumentException("PhreaticLineOffsetsExtreme must be set."); + } + if (properties.PhreaticLineOffsetsDaily == null) + { + throw new ArgumentException("PhreaticLineOffsetsDaily must be set."); + } + WaternetCreationMode = properties.WaternetCreationMode; + PlLineCreationMethod = properties.PlLineCreationMethod; AssessmentLevel = properties.AssessmentLevel; + LandwardDirection = properties.LandwardDirection; SurfaceLine = properties.SurfaceLine; SoilProfile = properties.SoilProfile; + DrainageConstruction = properties.DrainageConstruction; + PhreaticLineOffsetsExtreme = properties.PhreaticLineOffsetsExtreme; + PhreaticLineOffsetsDaily = properties.PhreaticLineOffsetsDaily; WaterLevelRiverAverage = properties.WaterLevelRiverAverage; WaterLevelPolderExtreme = properties.WaterLevelPolderExtreme; WaterLevelPolderDaily = properties.WaterLevelPolderDaily; @@ -87,7 +108,10 @@ /// public ConstructionProperties() { + WaternetCreationMode = WaternetCreationMode.CreateWaternet; + PlLineCreationMethod = PlLineCreationMethod.RingtoetsWti2017; AssessmentLevel = double.NaN; + LandwardDirection = LandwardDirection.PositiveX; WaterLevelRiverAverage = double.NaN; WaterLevelPolderExtreme = double.NaN; WaterLevelPolderDaily = double.NaN; @@ -106,12 +130,27 @@ #region Properties /// + /// Gets or sets the waternet creation mode. + /// + public WaternetCreationMode WaternetCreationMode { internal get; set; } + + /// + /// Gets or sets the pl line creation method. + /// + public PlLineCreationMethod PlLineCreationMethod { internal get; set; } + + /// /// Gets or sets the outside high water level. /// [m+NAP] /// public double AssessmentLevel { internal get; set; } /// + /// Gets or sets the landward direction of . + /// + public LandwardDirection LandwardDirection { internal get; set; } + + /// /// Gets or sets the surface line. /// public MacroStabilityInwardsSurfaceLine SurfaceLine { internal get; set; } @@ -122,6 +161,21 @@ public SoilProfile SoilProfile { internal get; set; } /// + /// Gets or sets the drainage construction. + /// + public DrainageConstruction DrainageConstruction { internal get; set; } + + /// + /// Gets or sets the phreatic line offsets under extreme circumstances. + /// + public PhreaticLineOffsets PhreaticLineOffsetsExtreme { internal get; set; } + + /// + /// Gets or sets the phreatic line offsets under daily circumstances. + /// + public PhreaticLineOffsets PhreaticLineOffsetsDaily { internal get; set; } + + /// /// Gets or sets the dike soil scenario. /// public MacroStabilityInwardsDikeSoilScenario DikeSoilScenario { internal get; set; } @@ -209,11 +263,27 @@ #region Properties /// + /// Gets the waternet creation mode. + /// + public WaternetCreationMode WaternetCreationMode { get; } + + /// + /// Gets the pl line creation method. + /// + public PlLineCreationMethod PlLineCreationMethod { get; } + + /// /// Gets the outside high water level. /// [m+NAP] /// public double AssessmentLevel { get; } + /// + /// Gets the landward direction of . + /// + public LandwardDirection LandwardDirection { get; } + + /// /// Gets the surface line. /// public MacroStabilityInwardsSurfaceLine SurfaceLine { get; } @@ -224,6 +294,21 @@ public SoilProfile SoilProfile { get; } /// + /// Gets the drainage construction. + /// + public DrainageConstruction DrainageConstruction { get; } + + /// + /// Gets the phreatic line offsets under extreme circumstances. + /// + public PhreaticLineOffsets PhreaticLineOffsetsExtreme { get; } + + /// + /// Gets the phreatic line offsets under daily circumstances. + /// + public PhreaticLineOffsets PhreaticLineOffsetsDaily { get; } + + /// /// Gets the dike soil scenario. /// public MacroStabilityInwardsDikeSoilScenario DikeSoilScenario { get; } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Calculators/Waternet/Input/WaternetCalculatorInputTest.cs =================================================================== diff -u -r557444d8587632235e4fda55487e6f322cde9ce7 -rc6c1bd3e608d35c5fb707033534b5aff950ff55d --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Calculators/Waternet/Input/WaternetCalculatorInputTest.cs (.../WaternetCalculatorInputTest.cs) (revision 557444d8587632235e4fda55487e6f322cde9ce7) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Calculators/Waternet/Input/WaternetCalculatorInputTest.cs (.../WaternetCalculatorInputTest.cs) (revision c6c1bd3e608d35c5fb707033534b5aff950ff55d) @@ -22,7 +22,7 @@ using System; using Core.Common.TestUtil; using NUnit.Framework; -using Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.UpliftVan.Input; +using Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.Input; using Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.Waternet.Input; using Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Calculators.Input; using Ringtoets.MacroStabilityInwards.Primitives; @@ -52,7 +52,12 @@ double hRiverValue = random.NextDouble(); var surfaceLine = new MacroStabilityInwardsSurfaceLine(string.Empty); var soilProfile = new TestSoilProfile(); + var drainageConstruction = new DrainageConstruction(); + var phreaticLineOffsets = new PhreaticLineOffsets(); + var waternetCreationMode = random.NextEnumValue(); + var plLineCreationMethod = random.NextEnumValue(); + var landwardDirection = random.NextEnumValue(); double waterLevelRiverAverage = random.Next(); double waterLevelPolderExtreme = random.Next(); double waterLevelPolderDaily = random.Next(); @@ -72,9 +77,15 @@ var input = new WaternetCalculatorInput( new WaternetCalculatorInput.ConstructionProperties { + WaternetCreationMode = waternetCreationMode, + PlLineCreationMethod = plLineCreationMethod, AssessmentLevel = hRiverValue, + LandwardDirection = landwardDirection, SurfaceLine = surfaceLine, SoilProfile = soilProfile, + DrainageConstruction = drainageConstruction, + PhreaticLineOffsetsExtreme = phreaticLineOffsets, + PhreaticLineOffsetsDaily = phreaticLineOffsets, WaterLevelRiverAverage = waterLevelRiverAverage, WaterLevelPolderExtreme = waterLevelPolderExtreme, WaterLevelPolderDaily = waterLevelPolderDaily, @@ -88,13 +99,19 @@ PiezometricHeadPhreaticLine2Inwards = piezometricHeadPhreaticLine2Inwards, PenetrationLength = penetrationLength, AdjustPhreaticLine3And4ForUplift = adjustPhreaticLine3And4ForUplift, - DikeSoilScenario = dikeSoilScenario + DikeSoilScenario = dikeSoilScenario, }); // Assert + Assert.AreEqual(waternetCreationMode, input.WaternetCreationMode); + Assert.AreEqual(plLineCreationMethod, input.PlLineCreationMethod); Assert.AreEqual(hRiverValue, input.AssessmentLevel); Assert.AreSame(surfaceLine, input.SurfaceLine); + Assert.AreEqual(landwardDirection, input.LandwardDirection); Assert.AreSame(soilProfile, input.SoilProfile); + Assert.AreSame(drainageConstruction, input.DrainageConstruction); + Assert.AreSame(phreaticLineOffsets, input.PhreaticLineOffsetsDaily); + Assert.AreSame(phreaticLineOffsets, input.PhreaticLineOffsetsExtreme); Assert.AreEqual(waterLevelRiverAverage, input.WaterLevelRiverAverage); Assert.AreEqual(waterLevelPolderExtreme, input.WaterLevelPolderExtreme); @@ -119,13 +136,18 @@ // Setup var surfaceLine = new MacroStabilityInwardsSurfaceLine(string.Empty); var soilProfile = new TestSoilProfile(); + var drainageConstruction = new DrainageConstruction(); + var phreaticLineOffsets = new PhreaticLineOffsets(); // Call var input = new WaternetCalculatorInput( new WaternetCalculatorInput.ConstructionProperties { SurfaceLine = surfaceLine, - SoilProfile = soilProfile + SoilProfile = soilProfile, + DrainageConstruction = drainageConstruction, + PhreaticLineOffsetsExtreme = phreaticLineOffsets, + PhreaticLineOffsetsDaily = phreaticLineOffsets }); // Assert @@ -144,6 +166,9 @@ Assert.IsNaN(input.PenetrationLength); Assert.IsFalse(input.AdjustPhreaticLine3And4ForUplift); + Assert.AreEqual(WaternetCreationMode.CreateWaternet, input.WaternetCreationMode); + Assert.AreEqual(PlLineCreationMethod.RingtoetsWti2017, input.PlLineCreationMethod); + Assert.AreEqual(LandwardDirection.PositiveX, input.LandwardDirection); Assert.AreEqual(MacroStabilityInwardsDikeSoilScenario.ClayDikeOnClay, input.DikeSoilScenario); } @@ -154,7 +179,10 @@ TestDelegate test = () => new WaternetCalculatorInput( new WaternetCalculatorInput.ConstructionProperties { - SoilProfile = new TestSoilProfile() + SoilProfile = new TestSoilProfile(), + PhreaticLineOffsetsExtreme = new PhreaticLineOffsets(), + PhreaticLineOffsetsDaily = new PhreaticLineOffsets(), + DrainageConstruction = new DrainageConstruction() }); // Assert @@ -168,11 +196,65 @@ TestDelegate test = () => new WaternetCalculatorInput( new WaternetCalculatorInput.ConstructionProperties { - SurfaceLine = new MacroStabilityInwardsSurfaceLine("test") + SurfaceLine = new MacroStabilityInwardsSurfaceLine("test"), + PhreaticLineOffsetsExtreme = new PhreaticLineOffsets(), + PhreaticLineOffsetsDaily = new PhreaticLineOffsets(), + DrainageConstruction = new DrainageConstruction() }); // Assert TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, "SoilProfile must be set."); } + + [Test] + public void Constructor_DrainageConstructionNull_ThrowsArgumentException() + { + // Call + TestDelegate test = () => new WaternetCalculatorInput( + new WaternetCalculatorInput.ConstructionProperties + { + SoilProfile = new TestSoilProfile(), + SurfaceLine = new MacroStabilityInwardsSurfaceLine("test"), + PhreaticLineOffsetsDaily = new PhreaticLineOffsets(), + PhreaticLineOffsetsExtreme = new PhreaticLineOffsets() + }); + + // Assert + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, "DrainageConstruction must be set."); + } + + [Test] + public void Constructor_PhreaticLineOffsetsExtremeNull_ThrowsArgumentException() + { + // Call + TestDelegate test = () => new WaternetCalculatorInput( + new WaternetCalculatorInput.ConstructionProperties + { + SoilProfile = new TestSoilProfile(), + SurfaceLine = new MacroStabilityInwardsSurfaceLine("test"), + DrainageConstruction = new DrainageConstruction(), + PhreaticLineOffsetsDaily = new PhreaticLineOffsets() + }); + + // Assert + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, "PhreaticLineOffsetsExtreme must be set."); + } + + [Test] + public void Constructor_PhreaticLineOffsetsDailyNull_ThrowsArgumentException() + { + // Call + TestDelegate test = () => new WaternetCalculatorInput( + new WaternetCalculatorInput.ConstructionProperties + { + SoilProfile = new TestSoilProfile(), + SurfaceLine = new MacroStabilityInwardsSurfaceLine("test"), + DrainageConstruction = new DrainageConstruction(), + PhreaticLineOffsetsExtreme = new PhreaticLineOffsets() + }); + + // Assert + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, "PhreaticLineOffsetsDaily must be set."); + } } } \ No newline at end of file