Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Creators/Input/MacroStabilityInputCreator.cs =================================================================== diff -u -ra19bd9b8118721294650316435aba7c837de164e -r4fa85aa07dfad332e75f927a6a5cfe35fe815eb3 --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Creators/Input/MacroStabilityInputCreator.cs (.../MacroStabilityInputCreator.cs) (revision a19bd9b8118721294650316435aba7c837de164e) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Creators/Input/MacroStabilityInputCreator.cs (.../MacroStabilityInputCreator.cs) (revision 4fa85aa07dfad332e75f927a6a5cfe35fe815eb3) @@ -49,7 +49,7 @@ ConstructionStages = { AddConstructionStage(soilProfile, dailyWaternet, FixedSoilStressCreator.Create(layerLookup).ToList(), - PreConsolidationStressCreator.Create(upliftVanInput.SoilProfile.PreconsolidationStresses).ToList()), + PreconsolidationStressCreator.Create(upliftVanInput.SoilProfile.PreconsolidationStresses).ToList()), AddConstructionStage(soilProfile, extremeWaternet) }, Soils = layersWithSoil.Select(lws => lws.Soil).ToList(), Fisheye: Tag 4fa85aa07dfad332e75f927a6a5cfe35fe815eb3 refers to a dead (removed) revision in file `Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Creators/Input/PreConsolidationStressCreator.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Creators/Input/PreconsolidationStressCreator.cs =================================================================== diff -u --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Creators/Input/PreconsolidationStressCreator.cs (revision 0) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.KernelWrapper/Creators/Input/PreconsolidationStressCreator.cs (revision 4fa85aa07dfad332e75f927a6a5cfe35fe815eb3) @@ -0,0 +1,58 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer 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 System.Collections.Generic; +using System.Linq; +using Deltares.MacroStability.CSharpWrapper; +using Riskeer.MacroStabilityInwards.KernelWrapper.Calculators.Input; +using Riskeer.MacroStabilityInwards.KernelWrapper.Kernels.UpliftVan; +using CSharpWrapperPreconsolidationStress = Deltares.MacroStability.CSharpWrapper.Input.PreconsolidationStress; + +namespace Riskeer.MacroStabilityInwards.KernelWrapper.Creators.Input +{ + /// + /// Creates instances which are required by . + /// + internal static class PreconsolidationStressCreator + { + /// + /// Creates objects based on the given objects. + /// + /// The preconsolidation stresses to use. + /// An of . + /// Thrown when + /// is null. + public static IEnumerable Create(IEnumerable preconsolidationStresses) + { + if (preconsolidationStresses == null) + { + throw new ArgumentNullException(nameof(preconsolidationStresses)); + } + + return preconsolidationStresses.Select(preconsolidationStress => new CSharpWrapperPreconsolidationStress + { + StressValue = preconsolidationStress.Stress, + Point = new Point2D(preconsolidationStress.Coordinate.X, preconsolidationStress.Coordinate.Y) + }).ToArray(); + } + } +} \ No newline at end of file Index: Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.KernelWrapper.Test/Calculators/UpliftVan/UpliftVanCalculatorTest.cs =================================================================== diff -u -rfe0f11c19023237d7f3629c2206b4fe5eb5e121f -r4fa85aa07dfad332e75f927a6a5cfe35fe815eb3 --- Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.KernelWrapper.Test/Calculators/UpliftVan/UpliftVanCalculatorTest.cs (.../UpliftVanCalculatorTest.cs) (revision fe0f11c19023237d7f3629c2206b4fe5eb5e121f) +++ Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.KernelWrapper.Test/Calculators/UpliftVan/UpliftVanCalculatorTest.cs (.../UpliftVanCalculatorTest.cs) (revision 4fa85aa07dfad332e75f927a6a5cfe35fe815eb3) @@ -152,7 +152,7 @@ Assert.AreEqual(input.SlipPlane.GridAutomaticDetermined, upliftVanKernel.GridAutomaticDetermined); Assert.AreEqual(input.SlipPlane.TangentLinesAutomaticAtBoundaries, upliftVanKernel.TangentLinesAutomaticDetermined); CollectionAssert.AreEqual(FixedSoilStressCreator.Create(layerLookup), upliftVanKernel.SoilStresses, new FixedSoilStressComparer()); - CollectionAssert.AreEqual(PreConsolidationStressCreator.Create(input.SoilProfile.PreconsolidationStresses), upliftVanKernel.PreConsolidationStresses, new PreConsolidationStressComparer()); + CollectionAssert.AreEqual(PreconsolidationStressCreator.Create(input.SoilProfile.PreconsolidationStresses), upliftVanKernel.PreConsolidationStresses, new PreConsolidationStressComparer()); Assert.AreEqual(input.SlipPlaneConstraints.AutomaticForbiddenZones, upliftVanKernel.AutomaticForbiddenZones); } } Fisheye: Tag 4fa85aa07dfad332e75f927a6a5cfe35fe815eb3 refers to a dead (removed) revision in file `Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.KernelWrapper.Test/Creators/Input/PreConsolidationStressCreatorTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.KernelWrapper.Test/Creators/Input/PreconsolidationStressCreatorTest.cs =================================================================== diff -u --- Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.KernelWrapper.Test/Creators/Input/PreconsolidationStressCreatorTest.cs (revision 0) +++ Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.KernelWrapper.Test/Creators/Input/PreconsolidationStressCreatorTest.cs (revision 4fa85aa07dfad332e75f927a6a5cfe35fe815eb3) @@ -0,0 +1,75 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer 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 System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using Riskeer.MacroStabilityInwards.KernelWrapper.Calculators.Input; +using Riskeer.MacroStabilityInwards.KernelWrapper.Creators.Input; +using Point2D = Core.Common.Base.Geometry.Point2D; +using CSharpWrapperPreconsolidationStress = Deltares.MacroStability.CSharpWrapper.Input.PreconsolidationStress; + +namespace Riskeer.MacroStabilityInwards.KernelWrapper.Test.Creators.Input +{ + [TestFixture] + public class PreconsolidationStressCreatorTest + { + [Test] + public void Create_PreconsolidationStressesNull_ThrowsArgumentNullException() + { + // Call + void Call() => PreconsolidationStressCreator.Create(null); + + // Assert + var exception = Assert.Throws(Call); + Assert.AreEqual("preconsolidationStresses", exception.ParamName); + } + + [Test] + public void Create_WithValidData_ReturnsPreConsolidationStresses() + { + // Setup + var preconsolidationStresses = new[] + { + new PreconsolidationStress(new Point2D(3.2, 4.8), 1.5), + new PreconsolidationStress(new Point2D(1.2, 0.5), 17.9), + new PreconsolidationStress(new Point2D(50.8, 9.9), 3.8) + }; + + // Call + IEnumerable stabilityPreconsolidationStresses = PreconsolidationStressCreator.Create(preconsolidationStresses); + + // Assert + Assert.AreEqual(preconsolidationStresses.Length, stabilityPreconsolidationStresses.Count()); + + for (var i = 0; i < preconsolidationStresses.Length; i++) + { + PreconsolidationStress preconsolidationStress = preconsolidationStresses[i]; + CSharpWrapperPreconsolidationStress stabilityPreconsolidationStress = stabilityPreconsolidationStresses.ElementAt(i); + + Assert.AreEqual(preconsolidationStress.Coordinate.X, stabilityPreconsolidationStress.Point.X); + Assert.AreEqual(preconsolidationStress.Coordinate.Y, stabilityPreconsolidationStress.Point.Z); + Assert.AreEqual(preconsolidationStress.Stress, stabilityPreconsolidationStress.StressValue); + } + } + } +} \ No newline at end of file