Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/MacroStabilityInwardsCalculator.cs =================================================================== diff -u -r8df0c1c5344a84bd7aa0a1f660e3a0adacc47bc7 -rf7b1b88b405ba24f2baeaec0cfe3697c64755d70 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/MacroStabilityInwardsCalculator.cs (.../MacroStabilityInwardsCalculator.cs) (revision 8df0c1c5344a84bd7aa0a1f660e3a0adacc47bc7) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/MacroStabilityInwardsCalculator.cs (.../MacroStabilityInwardsCalculator.cs) (revision f7b1b88b405ba24f2baeaec0cfe3697c64755d70) @@ -85,8 +85,8 @@ { IUpliftVanCalculator calculator = factory.CreateUpliftVanCalculator(); Soil[] soils = MacroStabilityInwardsSoilCreator.Create(input.SoilProfile); + calculator.SoilModel = MacroStabilityInwardsSoilModelCreator.Create(soils); GeometrySurface[] surfaces = CreateSurfaces(input.SoilProfile); - calculator.SoilModel = CreateSoilModel(soils); calculator.SoilProfile = CreateSoilProfile(input.SoilProfile.LayersUnderSurfaceLine.ToArray(), soils, surfaces); return calculator; } @@ -194,14 +194,6 @@ return profile; } - private static SoilModel CreateSoilModel(IEnumerable soils) - { - var soilModel = new SoilModel(); - soilModel.Soils.AddRange(soils); - - return soilModel; - } - /// /// Returns a list of validation messages. The validation messages are based on the values of the /// which was provided to this and are determined by the kernel. Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/MacroStabilityInwardsSoilCreator.cs =================================================================== diff -u -r4a09cd9c68d573626eed8a24a67306ad8690e9cb -rf7b1b88b405ba24f2baeaec0cfe3697c64755d70 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/MacroStabilityInwardsSoilCreator.cs (.../MacroStabilityInwardsSoilCreator.cs) (revision 4a09cd9c68d573626eed8a24a67306ad8690e9cb) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/MacroStabilityInwardsSoilCreator.cs (.../MacroStabilityInwardsSoilCreator.cs) (revision f7b1b88b405ba24f2baeaec0cfe3697c64755d70) @@ -38,10 +38,16 @@ /// The from /// which to take the information. /// A new with information taken from the . + /// Thrown when is null. /// Thrown when /// has an type that can't be converted to . public static Soil[] Create(MacroStabilityInwardsSoilProfileUnderSurfaceLine profile) { + if (profile == null) + { + throw new ArgumentNullException(nameof(profile)); + } + return profile.LayersUnderSurfaceLine.Select(l => { MacroStabilityInwardsSoilLayerPropertiesUnderSurfaceLine properties = l.Properties; Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/MacroStabilityInwardsSoilModelCreator.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/MacroStabilityInwardsSoilModelCreator.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/MacroStabilityInwardsSoilModelCreator.cs (revision f7b1b88b405ba24f2baeaec0cfe3697c64755d70) @@ -0,0 +1,52 @@ +// 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 Deltares.WTIStability.Data.Geo; +using Deltares.WTIStability.Data.Standard; + +namespace Ringtoets.MacroStabilityInwards.KernelWrapper +{ + /// + /// Creates instances which are required by the . + /// + internal static class MacroStabilityInwardsSoilModelCreator + { + /// + /// Creates a with the given + /// which can be used in the . + /// + /// The array of to use in the . + /// A new with the . + /// Thrown when is null. + public static SoilModel Create(Soil[] soils) + { + if (soils == null) + { + throw new ArgumentNullException(nameof(soils)); + } + + var soilModel = new SoilModel(); + soilModel.Soils.AddRange(soils); + return soilModel; + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Ringtoets.MacroStabilityInwards.KernelWrapper.csproj =================================================================== diff -u -r708bcebfe9e5db209c818a12d630cb418231f863 -rf7b1b88b405ba24f2baeaec0cfe3697c64755d70 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Ringtoets.MacroStabilityInwards.KernelWrapper.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.csproj) (revision 708bcebfe9e5db209c818a12d630cb418231f863) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Ringtoets.MacroStabilityInwards.KernelWrapper.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.csproj) (revision f7b1b88b405ba24f2baeaec0cfe3697c64755d70) @@ -47,6 +47,7 @@ + Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/MacroStabilityInwardsSoilCreatorTest.cs =================================================================== diff -u -r4a09cd9c68d573626eed8a24a67306ad8690e9cb -rf7b1b88b405ba24f2baeaec0cfe3697c64755d70 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/MacroStabilityInwardsSoilCreatorTest.cs (.../MacroStabilityInwardsSoilCreatorTest.cs) (revision 4a09cd9c68d573626eed8a24a67306ad8690e9cb) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/MacroStabilityInwardsSoilCreatorTest.cs (.../MacroStabilityInwardsSoilCreatorTest.cs) (revision f7b1b88b405ba24f2baeaec0cfe3697c64755d70) @@ -33,6 +33,17 @@ public class MacroStabilityInwardsSoilCreatorTest { [Test] + public void Create_ProfileNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => MacroStabilityInwardsSoilCreator.Create(null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("profile", exception.ParamName); + } + + [Test] public void Create_ProfileWithLayers_ReturnsProfileWithLayers() { // Setup Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/MacroStabilityInwardsSoilModelCreatorTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/MacroStabilityInwardsSoilModelCreatorTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/MacroStabilityInwardsSoilModelCreatorTest.cs (revision f7b1b88b405ba24f2baeaec0cfe3697c64755d70) @@ -0,0 +1,59 @@ +// 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 Deltares.WTIStability.Data.Geo; +using NUnit.Framework; + +namespace Ringtoets.MacroStabilityInwards.KernelWrapper.Test +{ + [TestFixture] + public class MacroStabilityInwardsSoilModelCreatorTest + { + [Test] + public void Create_SoilsNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => MacroStabilityInwardsSoilModelCreator.Create(null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("soils", exception.ParamName); + } + + [Test] + public void Create_WithSoils_ReturnSoilModelWithSoils() + { + // Setup + var soils = new[] + { + new Soil("soil 1"), + new Soil("soil 2") + }; + + // Call + SoilModel soilModel = MacroStabilityInwardsSoilModelCreator.Create(soils); + + // Assert + CollectionAssert.AreEqual(soils, soilModel.Soils); + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj =================================================================== diff -u -r739cf596f79acc842ee61e885220a8022f3cdedf -rf7b1b88b405ba24f2baeaec0cfe3697c64755d70 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj) (revision 739cf596f79acc842ee61e885220a8022f3cdedf) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj) (revision f7b1b88b405ba24f2baeaec0cfe3697c64755d70) @@ -64,6 +64,7 @@ +