Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/UpliftVan/Input/UpliftVanCalculatorInput.cs =================================================================== diff -u -r9f936b0b29f490a024df02345df182133b1c041a -r82014e97419537804be86264d0ed501637ccd10f --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/UpliftVan/Input/UpliftVanCalculatorInput.cs (.../UpliftVanCalculatorInput.cs) (revision 9f936b0b29f490a024df02345df182133b1c041a) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/UpliftVan/Input/UpliftVanCalculatorInput.cs (.../UpliftVanCalculatorInput.cs) (revision 82014e97419537804be86264d0ed501637ccd10f) @@ -45,10 +45,9 @@ AssessmentLevel = properties.AssessmentLevel; SurfaceLine = properties.SurfaceLine; SoilProfile = properties.SoilProfile; + DrainageConstruction = properties.DrainageConstruction; WaterLevelRiverAverage = properties.WaterLevelRiverAverage; WaterLevelPolder = properties.WaterLevelPolder; - XCoordinateDrainageConstruction = properties.XCoordinateDrainageConstruction; - ZCoordinateDrainageConstruction = properties.ZCoordinateDrainageConstruction; MinimumLevelPhreaticLineAtDikeTopRiver = properties.MinimumLevelPhreaticLineAtDikeTopRiver; MinimumLevelPhreaticLineAtDikeTopPolder = properties.MinimumLevelPhreaticLineAtDikeTopPolder; PhreaticLineOffsetBelowDikeTopAtRiver = properties.PhreaticLineOffsetBelowDikeTopAtRiver; @@ -62,7 +61,6 @@ PiezometricHeadPhreaticLine2Outwards = properties.PiezometricHeadPhreaticLine2Outwards; PiezometricHeadPhreaticLine2Inwards = properties.PiezometricHeadPhreaticLine2Inwards; PenetrationLength = properties.PenetrationLength; - DrainageConstructionPresent = properties.DrainageConstructionPresent; AdjustPhreaticLine3And4ForUplift = properties.AdjustPhreaticLine3And4ForUplift; UseDefaultOffsets = properties.UseDefaultOffsets; DikeSoilScenario = properties.DikeSoilScenario; @@ -93,8 +91,6 @@ AssessmentLevel = double.NaN; WaterLevelRiverAverage = double.NaN; WaterLevelPolder = double.NaN; - XCoordinateDrainageConstruction = double.NaN; - ZCoordinateDrainageConstruction = double.NaN; MinimumLevelPhreaticLineAtDikeTopRiver = double.NaN; MinimumLevelPhreaticLineAtDikeTopPolder = double.NaN; PhreaticLineOffsetBelowDikeTopAtRiver = double.NaN; @@ -135,6 +131,11 @@ public UpliftVanSoilProfile SoilProfile { internal get; set; } /// + /// Gets or sets the drainage construction. + /// + public UpliftVanDrainageConstruction DrainageConstruction { internal get; set; } + + /// /// Gets or sets the dike soil scenario. /// public MacroStabilityInwardsDikeSoilScenario DikeSoilScenario { internal get; set; } @@ -152,23 +153,6 @@ public double WaterLevelPolder { internal get; set; } /// - /// Gets or sets whether a drainage construction is present. - /// - public bool DrainageConstructionPresent { internal get; set; } - - /// - /// Gets or sets the x coordinate of the drainage construction. - /// [m] - /// - public double XCoordinateDrainageConstruction { internal get; set; } - - /// - /// Gets or sets the z coordinate of the drainage construction. - /// [m+NAP] - /// - public double ZCoordinateDrainageConstruction { internal get; set; } - - /// /// Gets or sets the minimum level phreatic line at dike top river. /// [m+NAP] /// @@ -343,6 +327,11 @@ public UpliftVanSoilProfile SoilProfile { get; } /// + /// Gets the drainage construction. + /// + public UpliftVanDrainageConstruction DrainageConstruction { get; } + + /// /// Gets the dike soil scenario. /// public MacroStabilityInwardsDikeSoilScenario DikeSoilScenario { get; } @@ -360,23 +349,6 @@ public double WaterLevelPolder { get; } /// - /// Gets whether a drainage construction is present. - /// - public bool DrainageConstructionPresent { get; } - - /// - /// Gets the x coordinate of the drainage construction. - /// [m] - /// - public double XCoordinateDrainageConstruction { get; } - - /// - /// Gets the z coordinate of the drainage construction. - /// [m+NAP] - /// - public double ZCoordinateDrainageConstruction { get; } - - /// /// Gets the minimum level phreatic line at dike top river. /// [m+NAP] /// Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/UpliftVan/Input/UpliftVanDrainageConstruction.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/UpliftVan/Input/UpliftVanDrainageConstruction.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/UpliftVan/Input/UpliftVanDrainageConstruction.cs (revision 82014e97419537804be86264d0ed501637ccd10f) @@ -0,0 +1,69 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.UpliftVan.Input +{ + /// + /// A drainage construction which its properties have been adapted to perform a calculation. + /// + public class UpliftVanDrainageConstruction + { + /// + /// Creates a new instance of . + /// + /// is set to false; and + /// are set to . + public UpliftVanDrainageConstruction() + { + IsPresent = false; + XCoordinate = double.NaN; + ZCoordinate = double.NaN; + } + + /// + /// Creates a new instance of + /// + /// The x coordinate of the drainage construction. + /// The z coordinate of the drainage construction. + /// is set to true. + public UpliftVanDrainageConstruction(double xCoordinate, double zCoordinate) + { + IsPresent = true; + XCoordinate = xCoordinate; + ZCoordinate = zCoordinate; + } + + /// + /// Gets whether the drainage construction is present. + /// + public bool IsPresent { get; } + + /// + /// Gets the x coordinate of the drainage construction. + /// + public double XCoordinate { get; } + + /// + /// Gets the z coordinate of the drainage construction. + /// + public double ZCoordinate { get; } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Creators/Input/StabilityLocationCreator.cs =================================================================== diff -u -r5384132a6cf39e2cc34d3eeac2becaefa2a349f1 -r82014e97419537804be86264d0ed501637ccd10f --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Creators/Input/StabilityLocationCreator.cs (.../StabilityLocationCreator.cs) (revision 5384132a6cf39e2cc34d3eeac2becaefa2a349f1) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Creators/Input/StabilityLocationCreator.cs (.../StabilityLocationCreator.cs) (revision 82014e97419537804be86264d0ed501637ccd10f) @@ -60,9 +60,9 @@ WaterLevelRiver = input.AssessmentLevel, WaterLevelRiverAverage = input.WaterLevelRiverAverage, WaterLevelPolder = input.WaterLevelPolder, - DrainageConstructionPresent = input.DrainageConstructionPresent, - XCoordMiddleDrainageConstruction = input.XCoordinateDrainageConstruction, - ZCoordMiddleDrainageConstruction = input.ZCoordinateDrainageConstruction, + DrainageConstructionPresent = input.DrainageConstruction.IsPresent, + XCoordMiddleDrainageConstruction = input.DrainageConstruction.XCoordinate, + ZCoordMiddleDrainageConstruction = input.DrainageConstruction.ZCoordinate, MinimumLevelPhreaticLineAtDikeTopRiver = input.MinimumLevelPhreaticLineAtDikeTopRiver, MinimumLevelPhreaticLineAtDikeTopPolder = input.MinimumLevelPhreaticLineAtDikeTopPolder, UseDefaultOffsets = input.UseDefaultOffsets, Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Ringtoets.MacroStabilityInwards.KernelWrapper.csproj =================================================================== diff -u -r98893373912f751309ca68fa432e3b9abd9ec2ce -r82014e97419537804be86264d0ed501637ccd10f --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Ringtoets.MacroStabilityInwards.KernelWrapper.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.csproj) (revision 98893373912f751309ca68fa432e3b9abd9ec2ce) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Ringtoets.MacroStabilityInwards.KernelWrapper.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.csproj) (revision 82014e97419537804be86264d0ed501637ccd10f) @@ -44,6 +44,7 @@ Properties\GlobalAssembly.cs + Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Service/Converters/UpliftVanDrainageConstructionConverter.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Service/Converters/UpliftVanDrainageConstructionConverter.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Service/Converters/UpliftVanDrainageConstructionConverter.cs (revision 82014e97419537804be86264d0ed501637ccd10f) @@ -0,0 +1,54 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Ringtoets.MacroStabilityInwards.Data; +using Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.UpliftVan.Input; + +namespace Ringtoets.MacroStabilityInwards.Service.Converters +{ + /// + /// Converter to convert drainage properties + /// into . + /// + internal static class UpliftVanDrainageConstructionConverter + { + /// + /// Converts drainage properties + /// into . + /// + /// The input to get the properties from. + /// The converted . + /// Thrown when + /// is null. + public static UpliftVanDrainageConstruction Convert(MacroStabilityInwardsInput input) + { + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + + return input.DrainageConstructionPresent + ? new UpliftVanDrainageConstruction(input.XCoordinateDrainageConstruction, input.ZCoordinateDrainageConstruction) + : new UpliftVanDrainageConstruction(); + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Service/Converters/UpliftVanSoilProfileConverter.cs =================================================================== diff -u -r69d647795daacbf48e17d0cf3a02a21865ab4ae6 -r82014e97419537804be86264d0ed501637ccd10f --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Service/Converters/UpliftVanSoilProfileConverter.cs (.../UpliftVanSoilProfileConverter.cs) (revision 69d647795daacbf48e17d0cf3a02a21865ab4ae6) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Service/Converters/UpliftVanSoilProfileConverter.cs (.../UpliftVanSoilProfileConverter.cs) (revision 82014e97419537804be86264d0ed501637ccd10f) @@ -23,11 +23,9 @@ using System.Collections.Generic; using System.ComponentModel; using System.Linq; -using Core.Common.Base.Geometry; using Ringtoets.MacroStabilityInwards.Data; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; using Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.UpliftVan.Input; -using Ringtoets.MacroStabilityInwards.Primitives; namespace Ringtoets.MacroStabilityInwards.Service.Converters { Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Service/MacroStabilityInwardsCalculationService.cs =================================================================== diff -u -ra37adf7a6d10fa2c6a069bc6d423a14c22ead9ea -r82014e97419537804be86264d0ed501637ccd10f --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Service/MacroStabilityInwardsCalculationService.cs (.../MacroStabilityInwardsCalculationService.cs) (revision a37adf7a6d10fa2c6a069bc6d423a14c22ead9ea) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Service/MacroStabilityInwardsCalculationService.cs (.../MacroStabilityInwardsCalculationService.cs) (revision 82014e97419537804be86264d0ed501637ccd10f) @@ -190,12 +190,10 @@ AssessmentLevel = inputParameters.AssessmentLevel, SurfaceLine = inputParameters.SurfaceLine, SoilProfile = UpliftVanSoilProfileConverter.Convert(inputParameters.SoilProfileUnderSurfaceLine), + DrainageConstruction = UpliftVanDrainageConstructionConverter.Convert(inputParameters), DikeSoilScenario = inputParameters.DikeSoilScenario, WaterLevelRiverAverage = inputParameters.WaterLevelRiverAverage, WaterLevelPolder = inputParameters.WaterLevelPolder, - DrainageConstructionPresent = inputParameters.DrainageConstructionPresent, - XCoordinateDrainageConstruction = inputParameters.DrainageConstructionPresent ? inputParameters.XCoordinateDrainageConstruction : double.NaN, - ZCoordinateDrainageConstruction = inputParameters.DrainageConstructionPresent ? inputParameters.ZCoordinateDrainageConstruction : double.NaN, MinimumLevelPhreaticLineAtDikeTopRiver = inputParameters.MinimumLevelPhreaticLineAtDikeTopRiver, MinimumLevelPhreaticLineAtDikeTopPolder = inputParameters.MinimumLevelPhreaticLineAtDikeTopPolder, UseDefaultOffsets = inputParameters.UseDefaultOffsets, Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Service/Ringtoets.MacroStabilityInwards.Service.csproj =================================================================== diff -u -r3b20cfd37a7802163d500bbbe37d562a38ab3989 -r82014e97419537804be86264d0ed501637ccd10f --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Service/Ringtoets.MacroStabilityInwards.Service.csproj (.../Ringtoets.MacroStabilityInwards.Service.csproj) (revision 3b20cfd37a7802163d500bbbe37d562a38ab3989) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Service/Ringtoets.MacroStabilityInwards.Service.csproj (.../Ringtoets.MacroStabilityInwards.Service.csproj) (revision 82014e97419537804be86264d0ed501637ccd10f) @@ -41,6 +41,7 @@ + Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Calculators/UpliftVan/Input/UpliftVanCalculatorInputTest.cs =================================================================== diff -u -r01f2f9421fd1bc8dcef928a2d86da8840da24ef5 -r82014e97419537804be86264d0ed501637ccd10f --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Calculators/UpliftVan/Input/UpliftVanCalculatorInputTest.cs (.../UpliftVanCalculatorInputTest.cs) (revision 01f2f9421fd1bc8dcef928a2d86da8840da24ef5) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Calculators/UpliftVan/Input/UpliftVanCalculatorInputTest.cs (.../UpliftVanCalculatorInputTest.cs) (revision 82014e97419537804be86264d0ed501637ccd10f) @@ -32,7 +32,7 @@ public class UpliftVanCalculatorInputTest { [Test] - public void Constructor_WithoutConstructionProperies_ThrowsArgumentNullException() + public void Constructor_ConstructionPropertiesNull_ThrowsArgumentNullException() { // Call TestDelegate test = () => new UpliftVanCalculatorInput(null); @@ -56,10 +56,10 @@ new UpliftVanSoilLayer(new Point2D[0], new Point2D[0][], new UpliftVanSoilLayer.ConstructionProperties()) }, new UpliftVanPreconsolidationStress[0]); + var drainageConstruction = new UpliftVanDrainageConstruction(); + double waterLevelRiverAverage = random.Next(); double waterLevelPolder = random.Next(); - double xCoordinateDrainageConstruction = random.Next(); - double zCoordinateDrainageConstruction = random.Next(); double minimumLevelPhreaticLineAtDikeTopRiver = random.Next(); double minimumLevelPhreaticLineAtDikeTopPolder = random.Next(); double phreaticLineOffsetBelowDikeTopAtRiver = random.Next(); @@ -75,7 +75,6 @@ double penetrationLength = random.Next(); bool useDefaultOffsets = random.NextBoolean(); bool adjustPhreaticLine3And4ForUplift = random.NextBoolean(); - bool drainageConstructionPresent = random.NextBoolean(); var dikeSoilScenario = random.NextEnumValue(); bool moveGrid = random.NextBoolean(); double maximumSliceWidth = random.Next(); @@ -97,10 +96,9 @@ AssessmentLevel = hRiverValue, SurfaceLine = surfaceLine, SoilProfile = soilProfile, + DrainageConstruction = drainageConstruction, WaterLevelRiverAverage = waterLevelRiverAverage, WaterLevelPolder = waterLevelPolder, - XCoordinateDrainageConstruction = xCoordinateDrainageConstruction, - ZCoordinateDrainageConstruction = zCoordinateDrainageConstruction, MinimumLevelPhreaticLineAtDikeTopRiver = minimumLevelPhreaticLineAtDikeTopRiver, MinimumLevelPhreaticLineAtDikeTopPolder = minimumLevelPhreaticLineAtDikeTopPolder, PhreaticLineOffsetBelowDikeTopAtRiver = phreaticLineOffsetBelowDikeTopAtRiver, @@ -116,7 +114,6 @@ PenetrationLength = penetrationLength, UseDefaultOffsets = useDefaultOffsets, AdjustPhreaticLine3And4ForUplift = adjustPhreaticLine3And4ForUplift, - DrainageConstructionPresent = drainageConstructionPresent, DikeSoilScenario = dikeSoilScenario, MoveGrid = moveGrid, MaximumSliceWidth = maximumSliceWidth, @@ -136,11 +133,10 @@ Assert.AreEqual(hRiverValue, input.AssessmentLevel); Assert.AreSame(surfaceLine, input.SurfaceLine); Assert.AreSame(soilProfile, input.SoilProfile); + Assert.AreSame(drainageConstruction, input.DrainageConstruction); Assert.AreEqual(waterLevelRiverAverage, input.WaterLevelRiverAverage); Assert.AreEqual(waterLevelPolder, input.WaterLevelPolder); - Assert.AreEqual(xCoordinateDrainageConstruction, input.XCoordinateDrainageConstruction); - Assert.AreEqual(zCoordinateDrainageConstruction, input.ZCoordinateDrainageConstruction); Assert.AreEqual(minimumLevelPhreaticLineAtDikeTopRiver, input.MinimumLevelPhreaticLineAtDikeTopRiver); Assert.AreEqual(minimumLevelPhreaticLineAtDikeTopPolder, input.MinimumLevelPhreaticLineAtDikeTopPolder); Assert.AreEqual(phreaticLineOffsetBelowDikeTopAtRiver, input.PhreaticLineOffsetBelowDikeTopAtRiver); @@ -156,7 +152,6 @@ Assert.AreEqual(penetrationLength, input.PenetrationLength); Assert.AreEqual(useDefaultOffsets, input.UseDefaultOffsets); Assert.AreEqual(adjustPhreaticLine3And4ForUplift, input.AdjustPhreaticLine3And4ForUplift); - Assert.AreEqual(drainageConstructionPresent, input.DrainageConstructionPresent); Assert.AreEqual(dikeSoilScenario, input.DikeSoilScenario); Assert.AreEqual(moveGrid, input.MoveGrid); @@ -185,14 +180,13 @@ // Assert Assert.IsNull(input.SurfaceLine); Assert.IsNull(input.SoilProfile); + Assert.IsNull(input.DrainageConstruction); Assert.IsNull(input.LeftGrid); Assert.IsNull(input.RightGrid); Assert.IsNaN(input.AssessmentLevel); Assert.IsNaN(input.WaterLevelRiverAverage); Assert.IsNaN(input.WaterLevelPolder); - Assert.IsNaN(input.XCoordinateDrainageConstruction); - Assert.IsNaN(input.ZCoordinateDrainageConstruction); Assert.IsNaN(input.MinimumLevelPhreaticLineAtDikeTopRiver); Assert.IsNaN(input.MinimumLevelPhreaticLineAtDikeTopPolder); Assert.IsNaN(input.PhreaticLineOffsetBelowDikeTopAtRiver); @@ -211,8 +205,7 @@ Assert.IsNaN(input.TangentLineZBottom); Assert.IsNaN(input.SlipPlaneMinimumDepth); Assert.IsNaN(input.SlipPlaneMinimumLength); - - Assert.IsFalse(input.DrainageConstructionPresent); + Assert.IsFalse(input.AdjustPhreaticLine3And4ForUplift); Assert.IsFalse(input.UseDefaultOffsets); Assert.IsFalse(input.MoveGrid); Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Calculators/UpliftVan/Input/UpliftVanDrainageConstructionTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Calculators/UpliftVan/Input/UpliftVanDrainageConstructionTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Calculators/UpliftVan/Input/UpliftVanDrainageConstructionTest.cs (revision 82014e97419537804be86264d0ed501637ccd10f) @@ -0,0 +1,60 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using NUnit.Framework; +using Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.UpliftVan.Input; + +namespace Ringtoets.MacroStabilityInwards.KernelWrapper.Test.Calculators.UpliftVan.Input +{ + [TestFixture] + public class UpliftVanDrainageConstructionTest + { + [Test] + public void ParameterlessConstructor_ExpectedValues() + { + // Call + var drainageConstruction = new UpliftVanDrainageConstruction(); + + // Assert + Assert.IsFalse(drainageConstruction.IsPresent); + Assert.IsNaN(drainageConstruction.XCoordinate); + Assert.IsNaN(drainageConstruction.ZCoordinate); + } + + [Test] + public void ParameterdConstructor_ExpectedValues() + { + // Setup + var random = new Random(21); + double xCoordinate = random.NextDouble(); + double zCoordinate = random.NextDouble(); + + // Call + var drainageConstruction = new UpliftVanDrainageConstruction(xCoordinate, zCoordinate); + + // Assert + Assert.IsTrue(drainageConstruction.IsPresent); + Assert.AreEqual(xCoordinate, drainageConstruction.XCoordinate); + Assert.AreEqual(zCoordinate, drainageConstruction.ZCoordinate); + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Calculators/UpliftVan/UpliftVanCalculatorTest.cs =================================================================== diff -u -r98893373912f751309ca68fa432e3b9abd9ec2ce -r82014e97419537804be86264d0ed501637ccd10f --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Calculators/UpliftVan/UpliftVanCalculatorTest.cs (.../UpliftVanCalculatorTest.cs) (revision 98893373912f751309ca68fa432e3b9abd9ec2ce) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Calculators/UpliftVan/UpliftVanCalculatorTest.cs (.../UpliftVanCalculatorTest.cs) (revision 82014e97419537804be86264d0ed501637ccd10f) @@ -220,7 +220,8 @@ SurfaceLine = surfaceLine, SoilProfile = CreateValidSoilProfile(surfaceLine), LeftGrid = new MacroStabilityInwardsGrid(), - RightGrid = new MacroStabilityInwardsGrid() + RightGrid = new MacroStabilityInwardsGrid(), + DrainageConstruction = new UpliftVanDrainageConstruction() }); } @@ -235,10 +236,9 @@ AssessmentLevel = random.NextDouble(), SurfaceLine = surfaceLine, SoilProfile = CreateValidSoilProfile(surfaceLine), + DrainageConstruction = new UpliftVanDrainageConstruction(), WaterLevelRiverAverage = random.Next(), WaterLevelPolder = random.Next(), - XCoordinateDrainageConstruction = random.Next(), - ZCoordinateDrainageConstruction = random.Next(), MinimumLevelPhreaticLineAtDikeTopRiver = random.Next(), MinimumLevelPhreaticLineAtDikeTopPolder = random.Next(), PhreaticLineOffsetBelowDikeTopAtRiver = random.Next(), @@ -254,7 +254,6 @@ PenetrationLength = random.Next(), UseDefaultOffsets = random.NextBoolean(), AdjustPhreaticLine3And4ForUplift = random.NextBoolean(), - DrainageConstructionPresent = random.NextBoolean(), DikeSoilScenario = random.NextEnumValue(), MoveGrid = random.NextBoolean(), MaximumSliceWidth = random.Next(), Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Creators/Input/StabilityLocationCreatorTest.cs =================================================================== diff -u -r5384132a6cf39e2cc34d3eeac2becaefa2a349f1 -r82014e97419537804be86264d0ed501637ccd10f --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Creators/Input/StabilityLocationCreatorTest.cs (.../StabilityLocationCreatorTest.cs) (revision 5384132a6cf39e2cc34d3eeac2becaefa2a349f1) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Creators/Input/StabilityLocationCreatorTest.cs (.../StabilityLocationCreatorTest.cs) (revision 82014e97419537804be86264d0ed501637ccd10f) @@ -75,7 +75,8 @@ var input = new UpliftVanCalculatorInput( new UpliftVanCalculatorInput.ConstructionProperties { - DikeSoilScenario = macroStabilityInwardsDikeSoilScenario + DikeSoilScenario = macroStabilityInwardsDikeSoilScenario, + DrainageConstruction = new UpliftVanDrainageConstruction() }); // Call @@ -93,7 +94,6 @@ double assessmentLevel = random.Next(); double waterLevelRiverAverage = random.Next(); double waterLevelPolder = random.Next(); - bool drainageConstructionPresent = random.NextBoolean(); double xCoordinateDrainageConstruction = random.Next(); double zCoordinateDrainageConstruction = random.Next(); double minimumLevelPhreaticLineAtDikeTopRiver = random.Next(); @@ -112,16 +112,16 @@ double piezometricHeadPhreaticLine2Inwards = random.Next(); double penetrationLength = random.Next(); + var drainageConstruction = new UpliftVanDrainageConstruction(xCoordinateDrainageConstruction, zCoordinateDrainageConstruction); + var input = new UpliftVanCalculatorInput( new UpliftVanCalculatorInput.ConstructionProperties { DikeSoilScenario = MacroStabilityInwardsDikeSoilScenario.ClayDikeOnClay, AssessmentLevel = assessmentLevel, WaterLevelRiverAverage = waterLevelRiverAverage, WaterLevelPolder = waterLevelPolder, - DrainageConstructionPresent = drainageConstructionPresent, - XCoordinateDrainageConstruction = xCoordinateDrainageConstruction, - ZCoordinateDrainageConstruction = zCoordinateDrainageConstruction, + DrainageConstruction = drainageConstruction, MinimumLevelPhreaticLineAtDikeTopRiver = minimumLevelPhreaticLineAtDikeTopRiver, MinimumLevelPhreaticLineAtDikeTopPolder = minimumLevelPhreaticLineAtDikeTopPolder, UseDefaultOffsets = useDefaultOffsets, @@ -151,7 +151,6 @@ Assert.AreEqual(assessmentLevel, location.HeadInPlLine4); Assert.AreEqual(waterLevelRiverAverage, location.WaterLevelRiverAverage); Assert.AreEqual(waterLevelPolder, location.WaterLevelPolder); - Assert.AreEqual(drainageConstructionPresent, location.DrainageConstructionPresent); Assert.AreEqual(xCoordinateDrainageConstruction, location.XCoordMiddleDrainageConstruction); Assert.AreEqual(zCoordinateDrainageConstruction, location.ZCoordMiddleDrainageConstruction); Assert.AreEqual(minimumLevelPhreaticLineAtDikeTopRiver, location.MinimumLevelPhreaticLineAtDikeTopRiver); Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj =================================================================== diff -u -rca7ddd190b0430262aa722d3d7b70906c2e68605 -r82014e97419537804be86264d0ed501637ccd10f --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj) (revision ca7ddd190b0430262aa722d3d7b70906c2e68605) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj) (revision 82014e97419537804be86264d0ed501637ccd10f) @@ -62,6 +62,7 @@ Properties\GlobalAssembly.cs + Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/Converters/UpliftVanDrainageConstructionConverterTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/Converters/UpliftVanDrainageConstructionConverterTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/Converters/UpliftVanDrainageConstructionConverterTest.cs (revision 82014e97419537804be86264d0ed501637ccd10f) @@ -0,0 +1,85 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Base.Data; +using NUnit.Framework; +using Ringtoets.MacroStabilityInwards.Data; +using Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.UpliftVan.Input; +using Ringtoets.MacroStabilityInwards.Service.Converters; + +namespace Ringtoets.MacroStabilityInwards.Service.Test.Converters +{ + [TestFixture] + public class UpliftVanDrainageConstructionConverterTest + { + [Test] + public void Convert_InputNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => UpliftVanDrainageConstructionConverter.Convert(null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("input", exception.ParamName); + } + + [Test] + public void Convert_DrainageConsructionPresentFalse_ReturnUpliftVanDrainageConstruction() + { + // Setup + var input = new MacroStabilityInwardsInput + { + DrainageConstructionPresent = false, + XCoordinateDrainageConstruction = (RoundedDouble) 2, + ZCoordinateDrainageConstruction = (RoundedDouble) 4 + }; + + // Call + UpliftVanDrainageConstruction drainageConstruction = UpliftVanDrainageConstructionConverter.Convert(input); + + // Assert + Assert.IsFalse(drainageConstruction.IsPresent); + Assert.IsNaN(drainageConstruction.XCoordinate); + Assert.IsNaN(drainageConstruction.ZCoordinate); + } + + [Test] + public void Convert_DrainageConsructionPresentTrue_ReturnUpliftVanDrainageConstruction() + { + // Setup + var input = new MacroStabilityInwardsInput + { + DrainageConstructionPresent = true, + XCoordinateDrainageConstruction = (RoundedDouble) 2, + ZCoordinateDrainageConstruction = (RoundedDouble) 4 + }; + + // Call + UpliftVanDrainageConstruction drainageConstruction = UpliftVanDrainageConstructionConverter.Convert(input); + + // Assert + Assert.IsTrue(drainageConstruction.IsPresent); + Assert.AreEqual(input.XCoordinateDrainageConstruction, drainageConstruction.XCoordinate); + Assert.AreEqual(input.ZCoordinateDrainageConstruction, drainageConstruction.ZCoordinate); + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/MacroStabilityInwardsCalculationServiceTest.cs =================================================================== diff -u -ra37adf7a6d10fa2c6a069bc6d423a14c22ead9ea -r82014e97419537804be86264d0ed501637ccd10f --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/MacroStabilityInwardsCalculationServiceTest.cs (.../MacroStabilityInwardsCalculationServiceTest.cs) (revision a37adf7a6d10fa2c6a069bc6d423a14c22ead9ea) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/MacroStabilityInwardsCalculationServiceTest.cs (.../MacroStabilityInwardsCalculationServiceTest.cs) (revision 82014e97419537804be86264d0ed501637ccd10f) @@ -346,9 +346,9 @@ // Assert UpliftVanCalculatorInput actualInput = ((TestMacroStabilityInwardsCalculatorFactory) MacroStabilityInwardsCalculatorFactory.Instance) .LastCreatedUpliftVanCalculator.Input; - Assert.IsFalse(actualInput.DrainageConstructionPresent); - Assert.IsNaN(actualInput.XCoordinateDrainageConstruction); - Assert.IsNaN(actualInput.ZCoordinateDrainageConstruction); + Assert.IsFalse(actualInput.DrainageConstruction.IsPresent); + Assert.IsNaN(actualInput.DrainageConstruction.XCoordinate); + Assert.IsNaN(actualInput.DrainageConstruction.ZCoordinate); } } @@ -372,7 +372,7 @@ // Assert UpliftVanCalculatorInput actualInput = ((TestMacroStabilityInwardsCalculatorFactory) MacroStabilityInwardsCalculatorFactory.Instance) .LastCreatedUpliftVanCalculator.Input; - Assert.IsFalse(actualInput.DrainageConstructionPresent); + Assert.IsFalse(actualInput.DrainageConstruction.IsPresent); Assert.IsNaN(actualInput.PhreaticLineOffsetBelowDikeToeAtPolder); Assert.IsNaN(actualInput.PhreaticLineOffsetBelowDikeTopAtPolder); Assert.IsNaN(actualInput.PhreaticLineOffsetBelowDikeTopAtRiver); @@ -381,54 +381,6 @@ } [Test] - public void Calculate_GridDeterminationTypeAutomatic_SetsInputOnCalculator() - { - // Setup - var random = new Random(11); - MacroStabilityInwardsInput inputParameters = testCalculation.InputParameters; - inputParameters.GridDeterminationType = MacroStabilityInwardsGridDeterminationType.Automatic; - inputParameters.TangentLineZTop = random.NextRoundedDouble(); - inputParameters.TangentLineZBottom = random.NextRoundedDouble(); - inputParameters.LeftGrid.XLeft = random.NextRoundedDouble(); - inputParameters.LeftGrid.XRight = random.NextRoundedDouble(); - inputParameters.LeftGrid.ZTop = random.NextRoundedDouble(); - inputParameters.LeftGrid.ZBottom = random.NextRoundedDouble(); - inputParameters.LeftGrid.NumberOfHorizontalPoints = random.Next(); - inputParameters.LeftGrid.NumberOfVerticalPoints = random.Next(); - inputParameters.RightGrid.XLeft = random.NextRoundedDouble(); - inputParameters.RightGrid.XRight = random.NextRoundedDouble(); - inputParameters.RightGrid.ZTop = random.NextRoundedDouble(); - inputParameters.RightGrid.ZBottom = random.NextRoundedDouble(); - inputParameters.RightGrid.NumberOfHorizontalPoints = random.Next(); - inputParameters.RightGrid.NumberOfVerticalPoints = random.Next(); - - using (new MacroStabilityInwardsCalculatorFactoryConfig()) - { - // Call - MacroStabilityInwardsCalculationService.Calculate(testCalculation); - - // Assert - UpliftVanCalculatorInput actualInput = ((TestMacroStabilityInwardsCalculatorFactory) MacroStabilityInwardsCalculatorFactory.Instance) - .LastCreatedUpliftVanCalculator.Input; - Assert.IsTrue(actualInput.GridAutomaticDetermined); - Assert.IsNaN(actualInput.TangentLineZTop); - Assert.IsNaN(actualInput.TangentLineZBottom); - Assert.IsNaN(actualInput.LeftGrid.XLeft); - Assert.IsNaN(actualInput.LeftGrid.XRight); - Assert.IsNaN(actualInput.LeftGrid.ZTop); - Assert.IsNaN(actualInput.LeftGrid.ZBottom); - Assert.AreEqual(0, actualInput.LeftGrid.NumberOfHorizontalPoints); - Assert.AreEqual(0, actualInput.LeftGrid.NumberOfVerticalPoints); - Assert.IsNaN(actualInput.RightGrid.XLeft); - Assert.IsNaN(actualInput.RightGrid.XRight); - Assert.IsNaN(actualInput.RightGrid.ZTop); - Assert.IsNaN(actualInput.RightGrid.ZBottom); - Assert.AreEqual(0, actualInput.RightGrid.NumberOfHorizontalPoints); - Assert.AreEqual(0, actualInput.RightGrid.NumberOfVerticalPoints); - } - } - - [Test] public void Calculate_CalculationRan_SetOutput() { // Setup @@ -495,8 +447,9 @@ Assert.AreEqual(originalInput.DikeSoilScenario, actualInput.DikeSoilScenario); Assert.AreEqual(originalInput.WaterLevelRiverAverage, actualInput.WaterLevelRiverAverage); Assert.AreEqual(originalInput.WaterLevelPolder, actualInput.WaterLevelPolder); - Assert.AreEqual(originalInput.XCoordinateDrainageConstruction, actualInput.XCoordinateDrainageConstruction); - Assert.AreEqual(originalInput.ZCoordinateDrainageConstruction, actualInput.ZCoordinateDrainageConstruction); + Assert.AreEqual(originalInput.DrainageConstructionPresent, actualInput.DrainageConstruction.IsPresent); + Assert.AreEqual(originalInput.XCoordinateDrainageConstruction, actualInput.DrainageConstruction.XCoordinate); + Assert.AreEqual(originalInput.ZCoordinateDrainageConstruction, actualInput.DrainageConstruction.ZCoordinate); Assert.AreEqual(originalInput.MinimumLevelPhreaticLineAtDikeTopRiver, actualInput.MinimumLevelPhreaticLineAtDikeTopRiver); Assert.AreEqual(originalInput.MinimumLevelPhreaticLineAtDikeTopPolder, actualInput.MinimumLevelPhreaticLineAtDikeTopPolder); Assert.AreEqual(originalInput.PhreaticLineOffsetBelowDikeTopAtRiver, actualInput.PhreaticLineOffsetBelowDikeTopAtRiver); @@ -510,7 +463,6 @@ Assert.AreEqual(originalInput.PiezometricHeadPhreaticLine2Outwards, actualInput.PiezometricHeadPhreaticLine2Outwards); Assert.AreEqual(originalInput.PiezometricHeadPhreaticLine2Inwards, actualInput.PiezometricHeadPhreaticLine2Inwards); Assert.AreEqual(originalInput.PenetrationLength, actualInput.PenetrationLength); - Assert.AreEqual(originalInput.DrainageConstructionPresent, actualInput.DrainageConstructionPresent); Assert.AreEqual(originalInput.AdjustPhreaticLine3And4ForUplift, actualInput.AdjustPhreaticLine3And4ForUplift); Assert.AreEqual(originalInput.UseDefaultOffsets, actualInput.UseDefaultOffsets); Assert.AreEqual(originalInput.MoveGrid, actualInput.MoveGrid); Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/Ringtoets.MacroStabilityInwards.Service.Test.csproj =================================================================== diff -u -re2786bbbad5456a4b42b68e1d0b0f85f732393d7 -r82014e97419537804be86264d0ed501637ccd10f --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/Ringtoets.MacroStabilityInwards.Service.Test.csproj (.../Ringtoets.MacroStabilityInwards.Service.Test.csproj) (revision e2786bbbad5456a4b42b68e1d0b0f85f732393d7) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/Ringtoets.MacroStabilityInwards.Service.Test.csproj (.../Ringtoets.MacroStabilityInwards.Service.Test.csproj) (revision 82014e97419537804be86264d0ed501637ccd10f) @@ -62,6 +62,7 @@ +