Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwards/MacroStabilityInwardsCalculationOutputEntityReadExtensions.cs =================================================================== diff -u -r7472a3a034f5d43d665980b35727c63d167abb5e -r7b2237f0bdfa03edcf158d24294c4433266ca91f --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwards/MacroStabilityInwardsCalculationOutputEntityReadExtensions.cs (.../MacroStabilityInwardsCalculationOutputEntityReadExtensions.cs) (revision 7472a3a034f5d43d665980b35727c63d167abb5e) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwards/MacroStabilityInwardsCalculationOutputEntityReadExtensions.cs (.../MacroStabilityInwardsCalculationOutputEntityReadExtensions.cs) (revision 7b2237f0bdfa03edcf158d24294c4433266ca91f) @@ -22,6 +22,7 @@ using System; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Serializers; +using Core.Common.Base.Data; using Core.Common.Base.Geometry; using Ringtoets.MacroStabilityInwards.Data; @@ -80,7 +81,7 @@ NumberOfVerticalPoints = entity.SlipPlaneRightGridNrOfVerticalPoints }; - double[] tangentLines = new TangentLinesXmlSerializer().FromXml(entity.SlipPlaneTangentLinesXml); + RoundedDouble[] tangentLines = new TangentLinesXmlSerializer().FromXml(entity.SlipPlaneTangentLinesXml); return new MacroStabilityInwardsSlipPlaneUpliftVan(leftGrid, rightGrid, tangentLines); } Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Serializers/TangentLinesXmlSerializer.cs =================================================================== diff -u -r70e6f175074b3d62532adfda735e6f719602f3b1 -r7b2237f0bdfa03edcf158d24294c4433266ca91f --- Application/Ringtoets/src/Application.Ringtoets.Storage/Serializers/TangentLinesXmlSerializer.cs (.../TangentLinesXmlSerializer.cs) (revision 70e6f175074b3d62532adfda735e6f719602f3b1) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Serializers/TangentLinesXmlSerializer.cs (.../TangentLinesXmlSerializer.cs) (revision 7b2237f0bdfa03edcf158d24294c4433266ca91f) @@ -22,20 +22,21 @@ using System; using System.Collections.Generic; using System.Linq; +using Core.Common.Base.Data; namespace Application.Ringtoets.Storage.Serializers { /// /// Converter class that converts between tangent lines and an XML representation of that data. /// - internal class TangentLinesXmlSerializer : DataCollectionSerializer + internal class TangentLinesXmlSerializer : DataCollectionSerializer { - protected override SerializableTangentLine[] ToSerializableData(IEnumerable elements) + protected override SerializableTangentLine[] ToSerializableData(IEnumerable elements) { return elements.Select(e => new SerializableTangentLine(e)).ToArray(); } - protected override double[] FromSerializableData(IEnumerable serializedElements) + protected override RoundedDouble[] FromSerializableData(IEnumerable serializedElements) { return serializedElements.Select(se => se.ToTangentLine()).ToArray(); } @@ -55,9 +56,9 @@ this.tangentLine = tangentLine; } - public double ToTangentLine() + public RoundedDouble ToTangentLine() { - return tangentLine; + return (RoundedDouble) tangentLine; } } } Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacroStabilityInwards/MacroStabilityInwardsOutputCreateExtensionsTest.cs =================================================================== diff -u -r02096656a864837dcf98505a1ba3145cd1a60608 -r7b2237f0bdfa03edcf158d24294c4433266ca91f --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacroStabilityInwards/MacroStabilityInwardsOutputCreateExtensionsTest.cs (.../MacroStabilityInwardsOutputCreateExtensionsTest.cs) (revision 02096656a864837dcf98505a1ba3145cd1a60608) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacroStabilityInwards/MacroStabilityInwardsOutputCreateExtensionsTest.cs (.../MacroStabilityInwardsOutputCreateExtensionsTest.cs) (revision 7b2237f0bdfa03edcf158d24294c4433266ca91f) @@ -24,6 +24,7 @@ using Application.Ringtoets.Storage.Create.MacroStabilityInwards; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.TestUtil.MacroStabilityInwards; +using Core.Common.Base.Data; using Core.Common.Base.Geometry; using Core.Common.TestUtil; using NUnit.Framework; @@ -68,7 +69,7 @@ MacroStabilityInwardsGrid rightGrid = MacroStabilityInwardsGridTestFactory.Create(); var tangentLines = new[] { - random.NextDouble() + random.NextRoundedDouble() }; var slipPlane = new MacroStabilityInwardsSlipPlaneUpliftVan(leftGrid, rightGrid, tangentLines); @@ -102,7 +103,7 @@ var slipPlane = new MacroStabilityInwardsSlipPlaneUpliftVan(CreateGridWithNaNValues(), CreateGridWithNaNValues(), - new double[0]); + new RoundedDouble[0]); var output = new MacroStabilityInwardsOutput(slidingCurve, slipPlane, new MacroStabilityInwardsOutput.ConstructionProperties()); Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsCalculationEntityReadExtensionsTest.cs =================================================================== diff -u -r10e060be0b77c159b3e99a7200e43c4326b17642 -r7b2237f0bdfa03edcf158d24294c4433266ca91f --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsCalculationEntityReadExtensionsTest.cs (.../MacroStabilityInwardsCalculationEntityReadExtensionsTest.cs) (revision 10e060be0b77c159b3e99a7200e43c4326b17642) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsCalculationEntityReadExtensionsTest.cs (.../MacroStabilityInwardsCalculationEntityReadExtensionsTest.cs) (revision 7b2237f0bdfa03edcf158d24294c4433266ca91f) @@ -25,6 +25,7 @@ using Application.Ringtoets.Storage.Read.MacroStabilityInwards; using Application.Ringtoets.Storage.Serializers; using Application.Ringtoets.Storage.TestUtil.MacroStabilityInwards; +using Core.Common.Base.Data; using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.TestUtil; @@ -236,7 +237,7 @@ { // Setup var random = new Random(31); - var tangentLines = new double[0]; + var tangentLines = new RoundedDouble[0]; var slices = new MacroStabilityInwardsSlice[0]; var calculationOutputEntity = new MacroStabilityInwardsCalculationOutputEntity Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsCalculationOutputEntityReadExtensionsTest.cs =================================================================== diff -u -rce5fb67782799e1a30202e917044803e62e7e078 -r7b2237f0bdfa03edcf158d24294c4433266ca91f --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsCalculationOutputEntityReadExtensionsTest.cs (.../MacroStabilityInwardsCalculationOutputEntityReadExtensionsTest.cs) (revision ce5fb67782799e1a30202e917044803e62e7e078) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsCalculationOutputEntityReadExtensionsTest.cs (.../MacroStabilityInwardsCalculationOutputEntityReadExtensionsTest.cs) (revision 7b2237f0bdfa03edcf158d24294c4433266ca91f) @@ -25,6 +25,7 @@ using Application.Ringtoets.Storage.Read.MacroStabilityInwards; using Application.Ringtoets.Storage.Serializers; using Application.Ringtoets.Storage.TestUtil.MacroStabilityInwards; +using Core.Common.Base.Data; using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.MacroStabilityInwards.Data; @@ -55,9 +56,9 @@ { MacroStabilityInwardsSliceTestFactory.CreateSlice() }; - IEnumerable tangentLines = new[] + IEnumerable tangentLines = new[] { - random.NextDouble() + new RoundedDouble(2, random.NextDouble()) }; var entity = new MacroStabilityInwardsCalculationOutputEntity @@ -156,7 +157,7 @@ return new MacroStabilityInwardsCalculationOutputEntity { SlidingCurveSliceXML = new MacroStabilityInwardsSliceXmlSerializer().ToXml(new MacroStabilityInwardsSlice[0]), - SlipPlaneTangentLinesXml = new TangentLinesXmlSerializer().ToXml(new double[0]), + SlipPlaneTangentLinesXml = new TangentLinesXmlSerializer().ToXml(new RoundedDouble[0]), SlipPlaneLeftGridNrOfHorizontalPoints = random.Next(1, 100), SlipPlaneLeftGridNrOfVerticalPoints = random.Next(1, 100), SlipPlaneRightGridNrOfHorizontalPoints = random.Next(1, 100), Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Serializers/TangentLinesXmlSerializerTest.cs =================================================================== diff -u -r70e6f175074b3d62532adfda735e6f719602f3b1 -r7b2237f0bdfa03edcf158d24294c4433266ca91f --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Serializers/TangentLinesXmlSerializerTest.cs (.../TangentLinesXmlSerializerTest.cs) (revision 70e6f175074b3d62532adfda735e6f719602f3b1) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Serializers/TangentLinesXmlSerializerTest.cs (.../TangentLinesXmlSerializerTest.cs) (revision 7b2237f0bdfa03edcf158d24294c4433266ca91f) @@ -21,6 +21,8 @@ using System; using Application.Ringtoets.Storage.Serializers; +using Core.Common.Base.Data; +using Core.Common.TestUtil; using NUnit.Framework; namespace Application.Ringtoets.Storage.Test.Serializers @@ -35,7 +37,7 @@ var serializer = new TangentLinesXmlSerializer(); // Assert - Assert.IsInstanceOf>(serializer); + Assert.IsInstanceOf>(serializer); } [Test] @@ -45,14 +47,14 @@ var random = new Random(31); var original = new[] { - double.NaN, - random.NextDouble() + new RoundedDouble(2, double.NaN), + random.NextRoundedDouble() }; var serializer = new TangentLinesXmlSerializer(); // When string xml = serializer.ToXml(original); - double[] roundtripResult = serializer.FromXml(xml); + RoundedDouble[] roundtripResult = serializer.FromXml(xml); // Then CollectionAssert.AreEqual(original, roundtripResult); Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/MacroStabilityInwardsSlipPlaneUpliftVan.cs =================================================================== diff -u -r4cbf31a1ae47d22c811e4a8d8f8e6d0f89ddc202 -r7b2237f0bdfa03edcf158d24294c4433266ca91f --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/MacroStabilityInwardsSlipPlaneUpliftVan.cs (.../MacroStabilityInwardsSlipPlaneUpliftVan.cs) (revision 4cbf31a1ae47d22c811e4a8d8f8e6d0f89ddc202) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/MacroStabilityInwardsSlipPlaneUpliftVan.cs (.../MacroStabilityInwardsSlipPlaneUpliftVan.cs) (revision 7b2237f0bdfa03edcf158d24294c4433266ca91f) @@ -22,6 +22,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Core.Common.Base.Data; namespace Ringtoets.MacroStabilityInwards.Data { @@ -39,7 +40,7 @@ /// Thrown when any parameter is null. public MacroStabilityInwardsSlipPlaneUpliftVan(MacroStabilityInwardsGrid leftGrid, MacroStabilityInwardsGrid rightGrid, - IEnumerable tangentLines) + IEnumerable tangentLines) { if (leftGrid == null) { @@ -56,7 +57,7 @@ LeftGrid = leftGrid; RightGrid = rightGrid; - TangentLines = tangentLines; + TangentLines = tangentLines.Select(tangentLine => new RoundedDouble(2, tangentLine)).ToArray(); } /// @@ -72,7 +73,7 @@ /// /// Gets the tangent lines result. /// - public IEnumerable TangentLines { get; private set; } + public IEnumerable TangentLines { get; private set; } public object Clone() { Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsChartDataPointsFactory.cs =================================================================== diff -u -rd0b68b32b0b7787b77b8da952b91cbfb7445c496 -r7b2237f0bdfa03edcf158d24294c4433266ca91f --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsChartDataPointsFactory.cs (.../MacroStabilityInwardsChartDataPointsFactory.cs) (revision d0b68b32b0b7787b77b8da952b91cbfb7445c496) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsChartDataPointsFactory.cs (.../MacroStabilityInwardsChartDataPointsFactory.cs) (revision 7b2237f0bdfa03edcf158d24294c4433266ca91f) @@ -407,7 +407,7 @@ /// of the tangent lines. /// A collection of arrays of points in 2D space or an empty collection when /// or is null. - public static IEnumerable CreateTangentLines(IEnumerable tangentLines, + public static IEnumerable CreateTangentLines(IEnumerable tangentLines, MacroStabilityInwardsSurfaceLine surfaceLine) { if (surfaceLine == null || tangentLines == null) @@ -424,7 +424,7 @@ /// /// Create tangent lines based on the provided amount and - /// range between and + /// range between and /// within the boundaries of the . /// /// The grid determination type. @@ -441,13 +441,14 @@ /// is null; /// is or infinity; /// is or infinity. - /// - public static IEnumerable CreateInputTangentLines(MacroStabilityInwardsGridDeterminationType gridDeterminationType, - MacroStabilityInwardsTangentLineDeterminationType tangentLineDeterminationType, - double tangentLineBottom, - double tangentLineTop, - int tangentLineNumber, - MacroStabilityInwardsSurfaceLine surfaceLine) + /// + /// + public static IEnumerable CreateTangentLines(MacroStabilityInwardsGridDeterminationType gridDeterminationType, + MacroStabilityInwardsTangentLineDeterminationType tangentLineDeterminationType, + RoundedDouble tangentLineBottom, + RoundedDouble tangentLineTop, + int tangentLineNumber, + MacroStabilityInwardsSurfaceLine surfaceLine) { if (gridDeterminationType == MacroStabilityInwardsGridDeterminationType.Automatic || tangentLineDeterminationType == MacroStabilityInwardsTangentLineDeterminationType.LayerSeparated @@ -459,15 +460,8 @@ return Enumerable.Empty(); } - var tangentLines = new List(); - for (var i = 0; i < tangentLineNumber; i++) - { - double diff = tangentLineBottom - tangentLineTop; - double scale = diff / Math.Max(1, tangentLineNumber - 1); - tangentLines.Add(tangentLineTop + (i * scale)); - } - - return CreateTangentLines(tangentLines, surfaceLine); + return CreateTangentLines(GetInterPolatedVerticalPositions(tangentLineTop, tangentLineBottom, tangentLineNumber), + surfaceLine); } /// @@ -492,34 +486,8 @@ }); } - #region SoilLayers and Surface Line Helpers + #region General Helpers - private static Point2D[] GetLocalPointsFromGeometry(MacroStabilityInwardsSurfaceLine surfaceLine, - Point3D worldCoordinate) - { - if (surfaceLine == null || worldCoordinate == null) - { - return new Point2D[0]; - } - - return new[] - { - surfaceLine.GetLocalPointFromGeometry(worldCoordinate) - }; - } - - #endregion - - #region Grid Helpers - - private static bool AreGridSettingsValid(MacroStabilityInwardsGrid grid) - { - return !double.IsNaN(grid.XLeft) - && !double.IsNaN(grid.XRight) - && !double.IsNaN(grid.ZTop) - && !double.IsNaN(grid.ZBottom); - } - private static IEnumerable GetInterPolatedVerticalPositions(RoundedDouble startPoint, RoundedDouble endPoint, int nrOfPoints) @@ -547,6 +515,36 @@ } } + #endregion + + #region SoilLayers and Surface Line Helpers + + private static Point2D[] GetLocalPointsFromGeometry(MacroStabilityInwardsSurfaceLine surfaceLine, + Point3D worldCoordinate) + { + if (surfaceLine == null || worldCoordinate == null) + { + return new Point2D[0]; + } + + return new[] + { + surfaceLine.GetLocalPointFromGeometry(worldCoordinate) + }; + } + + #endregion + + #region Grid Helpers + + private static bool AreGridSettingsValid(MacroStabilityInwardsGrid grid) + { + return !double.IsNaN(grid.XLeft) + && !double.IsNaN(grid.XRight) + && !double.IsNaN(grid.ZTop) + && !double.IsNaN(grid.ZBottom); + } + private static IEnumerable GetInterPolatedHorizontalPoints(RoundedDouble startPoint, RoundedDouble endPoint, RoundedDouble zPoint, Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsInputView.cs =================================================================== diff -u -r2bdf4a594b0ca27cce7b6485103c1011291a50d5 -r7b2237f0bdfa03edcf158d24294c4433266ca91f --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsInputView.cs (.../MacroStabilityInwardsInputView.cs) (revision 2bdf4a594b0ca27cce7b6485103c1011291a50d5) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsInputView.cs (.../MacroStabilityInwardsInputView.cs) (revision 7b2237f0bdfa03edcf158d24294c4433266ca91f) @@ -205,7 +205,7 @@ { MacroStabilityInwardsInput macroStabilityInwardsInput = data.InputParameters; MacroStabilityInwardsSurfaceLine surfaceLine = macroStabilityInwardsInput.SurfaceLine; - IMacroStabilityInwardsSoilProfile soilProfile = data.InputParameters.StochasticSoilProfile?.SoilProfile; + IMacroStabilityInwardsSoilProfile soilProfile = macroStabilityInwardsInput.StochasticSoilProfile?.SoilProfile; SetSurfaceLineChartData(surfaceLine); SetSoilProfileChartData(surfaceLine, soilProfile); @@ -220,12 +220,12 @@ leftGridChartData.Points = MacroStabilityInwardsChartDataPointsFactory.CreateGridPoints(leftGrid, gridDeterminationType); rightGridChartData.Points = MacroStabilityInwardsChartDataPointsFactory.CreateGridPoints(rightGrid, gridDeterminationType); - tangentLinesData.Lines = MacroStabilityInwardsChartDataPointsFactory.CreateInputTangentLines(data.InputParameters.GridDeterminationType, - data.InputParameters.TangentLineDeterminationType, - data.InputParameters.TangentLineZBottom, - data.InputParameters.TangentLineZTop, - data.InputParameters.TangentLineNumber, - data.InputParameters.SurfaceLine); + tangentLinesData.Lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines(macroStabilityInwardsInput.GridDeterminationType, + macroStabilityInwardsInput.TangentLineDeterminationType, + macroStabilityInwardsInput.TangentLineZBottom, + macroStabilityInwardsInput.TangentLineZTop, + macroStabilityInwardsInput.TangentLineNumber, + macroStabilityInwardsInput.SurfaceLine); } private void SetWaternetExtremeChartData(MacroStabilityInwardsWaternet waternet, MacroStabilityInwardsSurfaceLine surfaceLine) Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Service/Converters/MacroStabilityInwardsSlipPlaneUpliftVanConverter.cs =================================================================== diff -u -r7472a3a034f5d43d665980b35727c63d167abb5e -r7b2237f0bdfa03edcf158d24294c4433266ca91f --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Service/Converters/MacroStabilityInwardsSlipPlaneUpliftVanConverter.cs (.../MacroStabilityInwardsSlipPlaneUpliftVanConverter.cs) (revision 7472a3a034f5d43d665980b35727c63d167abb5e) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Service/Converters/MacroStabilityInwardsSlipPlaneUpliftVanConverter.cs (.../MacroStabilityInwardsSlipPlaneUpliftVanConverter.cs) (revision 7b2237f0bdfa03edcf158d24294c4433266ca91f) @@ -20,6 +20,8 @@ // All rights reserved. using System; +using System.Linq; +using Core.Common.Base.Data; using Ringtoets.MacroStabilityInwards.Data; using Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.UpliftVan; using Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.UpliftVan.Output; @@ -50,7 +52,7 @@ MacroStabilityInwardsGrid leftGrid = ConvertGrid(result.LeftGrid); MacroStabilityInwardsGrid rightGrid = ConvertGrid(result.RightGrid); - return new MacroStabilityInwardsSlipPlaneUpliftVan(leftGrid, rightGrid, result.TangentLines); + return new MacroStabilityInwardsSlipPlaneUpliftVan(leftGrid, rightGrid, result.TangentLines.Select(tangentLine => new RoundedDouble(2, tangentLine))); } private static MacroStabilityInwardsGrid ConvertGrid(UpliftVanGrid grid) Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/MacroStabilityInwardsOutputTest.cs =================================================================== diff -u -rc4392a12110e2bb3549c5fee1ec319c229b67198 -r7b2237f0bdfa03edcf158d24294c4433266ca91f --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/MacroStabilityInwardsOutputTest.cs (.../MacroStabilityInwardsOutputTest.cs) (revision c4392a12110e2bb3549c5fee1ec319c229b67198) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/MacroStabilityInwardsOutputTest.cs (.../MacroStabilityInwardsOutputTest.cs) (revision 7b2237f0bdfa03edcf158d24294c4433266ca91f) @@ -21,7 +21,9 @@ using System; using Core.Common.Base; +using Core.Common.Base.Data; using Core.Common.Data.TestUtil; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.Calculation; using Ringtoets.MacroStabilityInwards.Data.TestUtil; @@ -37,7 +39,7 @@ // Setup var slipPlane = new MacroStabilityInwardsSlipPlaneUpliftVan(MacroStabilityInwardsGridTestFactory.Create(), MacroStabilityInwardsGridTestFactory.Create(), - new double[0]); + new RoundedDouble[0]); // Call TestDelegate call = () => new MacroStabilityInwardsOutput(null, slipPlane, new MacroStabilityInwardsOutput.ConstructionProperties()); @@ -73,7 +75,7 @@ var slipPlane = new MacroStabilityInwardsSlipPlaneUpliftVan(MacroStabilityInwardsGridTestFactory.Create(), MacroStabilityInwardsGridTestFactory.Create(), - new double[0]); + new RoundedDouble[0]); // Call TestDelegate call = () => new MacroStabilityInwardsOutput(slidingCurve, slipPlane, null); @@ -93,7 +95,7 @@ var slipPlane = new MacroStabilityInwardsSlipPlaneUpliftVan(MacroStabilityInwardsGridTestFactory.Create(), MacroStabilityInwardsGridTestFactory.Create(), - new double[0]); + new RoundedDouble[0]); // Call var output = new MacroStabilityInwardsOutput(slidingCurve, slipPlane, new MacroStabilityInwardsOutput.ConstructionProperties()); @@ -115,7 +117,7 @@ var slipPlane = new MacroStabilityInwardsSlipPlaneUpliftVan(MacroStabilityInwardsGridTestFactory.Create(), MacroStabilityInwardsGridTestFactory.Create(), - new double[0]); + new RoundedDouble[0]); var random = new Random(21); double factorOfStability = random.NextDouble(); @@ -165,7 +167,7 @@ MacroStabilityInwardsGridTestFactory.Create(), new[] { - random.NextDouble() + random.NextRoundedDouble() }); var properties = new MacroStabilityInwardsOutput.ConstructionProperties Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/MacroStabilityInwardsSlipPlaneUpliftVanTest.cs =================================================================== diff -u -r4cbf31a1ae47d22c811e4a8d8f8e6d0f89ddc202 -r7b2237f0bdfa03edcf158d24294c4433266ca91f --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/MacroStabilityInwardsSlipPlaneUpliftVanTest.cs (.../MacroStabilityInwardsSlipPlaneUpliftVanTest.cs) (revision 4cbf31a1ae47d22c811e4a8d8f8e6d0f89ddc202) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/MacroStabilityInwardsSlipPlaneUpliftVanTest.cs (.../MacroStabilityInwardsSlipPlaneUpliftVanTest.cs) (revision 7b2237f0bdfa03edcf158d24294c4433266ca91f) @@ -22,8 +22,11 @@ using System; using System.Collections.Generic; using System.Linq; +using Core.Common.Base.Data; using Core.Common.Data.TestUtil; +using Core.Common.TestUtil; using NUnit.Framework; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.MacroStabilityInwards.Data.TestUtil; namespace Ringtoets.MacroStabilityInwards.Data.Test @@ -38,7 +41,7 @@ MacroStabilityInwardsGrid grid = MacroStabilityInwardsGridTestFactory.Create(); // Call - TestDelegate call = () => new MacroStabilityInwardsSlipPlaneUpliftVan(null, grid, Enumerable.Empty()); + TestDelegate call = () => new MacroStabilityInwardsSlipPlaneUpliftVan(null, grid, Enumerable.Empty()); // Assert var exception = Assert.Throws(call); @@ -52,7 +55,7 @@ MacroStabilityInwardsGrid grid = MacroStabilityInwardsGridTestFactory.Create(); // Call - TestDelegate call = () => new MacroStabilityInwardsSlipPlaneUpliftVan(grid, null, Enumerable.Empty()); + TestDelegate call = () => new MacroStabilityInwardsSlipPlaneUpliftVan(grid, null, Enumerable.Empty()); // Assert var exception = Assert.Throws(call); @@ -80,7 +83,11 @@ // Setup MacroStabilityInwardsGrid leftGrid = MacroStabilityInwardsGridTestFactory.Create(); MacroStabilityInwardsGrid rightGrid = MacroStabilityInwardsGridTestFactory.Create(); - IEnumerable tangentLines = Enumerable.Empty(); + IEnumerable tangentLines = new[] + { + (RoundedDouble) 3.4, + (RoundedDouble) 0.1 + }; // Call var result = new MacroStabilityInwardsSlipPlaneUpliftVan(leftGrid, rightGrid, tangentLines); @@ -90,7 +97,13 @@ Assert.AreSame(leftGrid, result.LeftGrid); Assert.AreSame(rightGrid, result.RightGrid); - Assert.AreSame(tangentLines, result.TangentLines); + Assert.AreEqual(tangentLines.Count(), result.TangentLines.Count()); + for (var i = 0; i < tangentLines.Count(); i++) + { + RoundedDouble tangentLine = result.TangentLines.ElementAt(i); + Assert.AreEqual(2, tangentLine.NumberOfDecimalPlaces); + Assert.AreEqual(tangentLines.ElementAt(i), tangentLine, tangentLine.GetAccuracy()); + } } [Test] @@ -102,7 +115,7 @@ MacroStabilityInwardsGridTestFactory.Create(), new[] { - random.NextDouble() + random.NextRoundedDouble() }); // Call Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil.Test/MacroStabilityInwardsOutputTestFactoryTest.cs =================================================================== diff -u -r09667b4737dfec082af4a6190f79996062eb6654 -r7b2237f0bdfa03edcf158d24294c4433266ca91f --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil.Test/MacroStabilityInwardsOutputTestFactoryTest.cs (.../MacroStabilityInwardsOutputTestFactoryTest.cs) (revision 09667b4737dfec082af4a6190f79996062eb6654) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil.Test/MacroStabilityInwardsOutputTestFactoryTest.cs (.../MacroStabilityInwardsOutputTestFactoryTest.cs) (revision 7b2237f0bdfa03edcf158d24294c4433266ca91f) @@ -21,6 +21,7 @@ using System; using System.Linq; +using Core.Common.Base.Data; using NUnit.Framework; namespace Ringtoets.MacroStabilityInwards.Data.TestUtil.Test @@ -86,9 +87,9 @@ Assert.IsNotNull(output.SlipPlane); CollectionAssert.AreEqual(new[] { - -3.5, - 0.0, - 2.0 + (RoundedDouble) (-3.5), + (RoundedDouble) 0.0, + (RoundedDouble) 2.0 }, output.SlipPlane.TangentLines); } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/MacroStabilityInwardsOutputTestFactory.cs =================================================================== diff -u -r09667b4737dfec082af4a6190f79996062eb6654 -r7b2237f0bdfa03edcf158d24294c4433266ca91f --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/MacroStabilityInwardsOutputTestFactory.cs (.../MacroStabilityInwardsOutputTestFactory.cs) (revision 09667b4737dfec082af4a6190f79996062eb6654) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/MacroStabilityInwardsOutputTestFactory.cs (.../MacroStabilityInwardsOutputTestFactory.cs) (revision 7b2237f0bdfa03edcf158d24294c4433266ca91f) @@ -21,6 +21,7 @@ using System; using System.Linq; +using Core.Common.Base.Data; namespace Ringtoets.MacroStabilityInwards.Data.TestUtil { @@ -51,7 +52,7 @@ Enumerable.Empty(), 0, 0), new MacroStabilityInwardsSlipPlaneUpliftVan(MacroStabilityInwardsGridTestFactory.Create(), MacroStabilityInwardsGridTestFactory.Create(), - new double[0]), + new RoundedDouble[0]), new MacroStabilityInwardsOutput.ConstructionProperties()); } @@ -76,9 +77,9 @@ MacroStabilityInwardsGridTestFactory.Create(), new[] { - -3.5, - 0.0, - 2.0 + (RoundedDouble) (-3.5), + (RoundedDouble) 0.0, + (RoundedDouble) 2.0 }), properties); } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Factories/MacroStabilityInwardsChartDataPointsFactoryTest.cs =================================================================== diff -u -r2bdf4a594b0ca27cce7b6485103c1011291a50d5 -r7b2237f0bdfa03edcf158d24294c4433266ca91f --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Factories/MacroStabilityInwardsChartDataPointsFactoryTest.cs (.../MacroStabilityInwardsChartDataPointsFactoryTest.cs) (revision 2bdf4a594b0ca27cce7b6485103c1011291a50d5) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Factories/MacroStabilityInwardsChartDataPointsFactoryTest.cs (.../MacroStabilityInwardsChartDataPointsFactoryTest.cs) (revision 7b2237f0bdfa03edcf158d24294c4433266ca91f) @@ -1466,7 +1466,7 @@ public void CreateTangentLines_SurfaceLineNull_ReturnsEmptyCollection() { // Call - IEnumerable lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines(Enumerable.Empty(), null); + IEnumerable lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines(Enumerable.Empty(), null); // Assert CollectionAssert.IsEmpty(lines); @@ -1486,8 +1486,8 @@ // Call IEnumerable lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines(new[] { - 2.5, - 5.8 + (RoundedDouble) 2.5, + (RoundedDouble) 5.8 }, surfaceLine); // Assert @@ -1507,14 +1507,14 @@ } [Test] - public void CreateInputTangentLines_SurfaceLineNull_ReturnsEmptyCollection() + public void CreateTangentLines_WithBoundaryParametersSurfaceLineNull_ReturnsEmptyCollection() { // Call - IEnumerable lines = MacroStabilityInwardsChartDataPointsFactory.CreateInputTangentLines( + IEnumerable lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines( MacroStabilityInwardsGridDeterminationType.Manual, MacroStabilityInwardsTangentLineDeterminationType.Specified, - 0.0, - 10.0, + (RoundedDouble) 0.0, + (RoundedDouble) 10.0, 3, null); @@ -1529,16 +1529,16 @@ [TestCase(double.PositiveInfinity, 10.0)] [TestCase(0.0, double.NegativeInfinity)] [TestCase(0.0, double.PositiveInfinity)] - public void CreateInputTangentLines_BoundariesInvalid_ReturnsEmptyCollection(double bottom, double top) + public void CreateTangentLines_WithInvalidBoundaryParameters_ReturnsEmptyCollection(double bottom, double top) { // Call - IEnumerable lines = MacroStabilityInwardsChartDataPointsFactory.CreateInputTangentLines( + IEnumerable lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines( MacroStabilityInwardsGridDeterminationType.Manual, MacroStabilityInwardsTangentLineDeterminationType.Specified, - bottom, - top, + new RoundedDouble(2, bottom), + new RoundedDouble(2, top), 3, - null); + GetSurfaceLineWithGeometry()); // Assert CollectionAssert.IsEmpty(lines); @@ -1548,25 +1548,25 @@ [TestCase(MacroStabilityInwardsGridDeterminationType.Automatic, MacroStabilityInwardsTangentLineDeterminationType.Specified)] [TestCase(MacroStabilityInwardsGridDeterminationType.Manual, MacroStabilityInwardsTangentLineDeterminationType.LayerSeparated)] [TestCase(MacroStabilityInwardsGridDeterminationType.Automatic, MacroStabilityInwardsTangentLineDeterminationType.LayerSeparated)] - public void CreateInputTangentLines_DeterminationTypeAutomatic_ReturnsEmptyCollection( + public void CreateTangentLines_WithBoundaryParametersAndDeterminationTypeAutomatic_ReturnsEmptyCollection( MacroStabilityInwardsGridDeterminationType gridDeterminationType, MacroStabilityInwardsTangentLineDeterminationType tangentLineDeterminationType) { // Call - IEnumerable lines = MacroStabilityInwardsChartDataPointsFactory.CreateInputTangentLines( + IEnumerable lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines( gridDeterminationType, tangentLineDeterminationType, - 10.0, - 30.0, + (RoundedDouble) 10.0, + (RoundedDouble) 30.0, 3, - null); + GetSurfaceLineWithGeometry()); // Assert CollectionAssert.IsEmpty(lines); } [Test] - public void CreateInputTangentLines_SingleTangentLine_ReturnsExpectedLine() + public void CreateTangentLines_WithBoundaryParametersAndSingleTangentLine_ReturnsExpectedLine() { // Setup var surfaceLine = new MacroStabilityInwardsSurfaceLine("line"); @@ -1577,11 +1577,11 @@ }); // Call - IEnumerable lines = MacroStabilityInwardsChartDataPointsFactory.CreateInputTangentLines( + IEnumerable lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines( MacroStabilityInwardsGridDeterminationType.Manual, MacroStabilityInwardsTangentLineDeterminationType.Specified, - 10.0, - 20.0, + (RoundedDouble) 10.0, + (RoundedDouble) 20.0, 1, surfaceLine); @@ -1597,7 +1597,7 @@ } [Test] - public void CreateInputTangentLines_MultipleTangentLines_ReturnsExpectedLines() + public void CreateTangentLines_WithBoundaryParametersAndMultipleTangentLines_ReturnsExpectedLines() { // Setup var surfaceLine = new MacroStabilityInwardsSurfaceLine("line"); @@ -1608,11 +1608,11 @@ }); // Call - IEnumerable lines = MacroStabilityInwardsChartDataPointsFactory.CreateInputTangentLines( + IEnumerable lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines( MacroStabilityInwardsGridDeterminationType.Manual, MacroStabilityInwardsTangentLineDeterminationType.Specified, - 10.0, - 20.0, + (RoundedDouble) 10.0, + (RoundedDouble) 20.0, 3, surfaceLine); @@ -1637,6 +1637,78 @@ }, lines); } + [Test] + public void CreateTangentLines_WithBoundaryParametersAndMultipleTangentLinesWithTopAndBottomSame_ReturnsExpectedLines() + { + // Setup + var surfaceLine = new MacroStabilityInwardsSurfaceLine("line"); + surfaceLine.SetGeometry(new[] + { + new Point3D(-5, 2, 2), + new Point3D(10, 2, 2) + }); + + // Call + IEnumerable lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines( + MacroStabilityInwardsGridDeterminationType.Manual, + MacroStabilityInwardsTangentLineDeterminationType.Specified, + (RoundedDouble) 10.0, + (RoundedDouble) 10.0, + 3, + surfaceLine); + + // Assert + CollectionAssert.AreEqual(new[] + { + new[] + { + new Point2D(0, 10.0), + new Point2D(15.0, 10.0) + }, + new[] + { + new Point2D(0, 10.0), + new Point2D(15.0, 10.0) + }, + new[] + { + new Point2D(0, 10.0), + new Point2D(15.0, 10.0) + } + }, lines); + } + + [Test] + public void CreateTangentLines_WithBoundaryParametersAndSingleTangentLineWithTopAndBottomSame_ReturnsExpectedLine() + { + // Setup + var surfaceLine = new MacroStabilityInwardsSurfaceLine("line"); + surfaceLine.SetGeometry(new[] + { + new Point3D(-5, 2, 2), + new Point3D(10, 2, 2) + }); + + // Call + IEnumerable lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines( + MacroStabilityInwardsGridDeterminationType.Manual, + MacroStabilityInwardsTangentLineDeterminationType.Specified, + (RoundedDouble) 10.0, + (RoundedDouble) 10.0, + 1, + surfaceLine); + + // Assert + CollectionAssert.AreEqual(new[] + { + new[] + { + new Point2D(0, 10.0), + new Point2D(15.0, 10.0) + } + }, lines); + } + private static MacroStabilityInwardsWaternetLine CreateWaternetLine(IEnumerable waternetLineGeometry, IEnumerable phreaticLineGeometry) { Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsInputViewTest.cs =================================================================== diff -u -r2bdf4a594b0ca27cce7b6485103c1011291a50d5 -r7b2237f0bdfa03edcf158d24294c4433266ca91f --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsInputViewTest.cs (.../MacroStabilityInwardsInputViewTest.cs) (revision 2bdf4a594b0ca27cce7b6485103c1011291a50d5) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsInputViewTest.cs (.../MacroStabilityInwardsInputViewTest.cs) (revision 7b2237f0bdfa03edcf158d24294c4433266ca91f) @@ -364,6 +364,55 @@ } [Test] + public void Data_WithValidTangentLineParameters_TangentLinesDataSet() + { + // Setup + using (var view = new MacroStabilityInwardsInputView()) + { + MacroStabilityInwardsSurfaceLine surfaceLine = GetSurfaceLineWithGeometry(); + + var calculation = new MacroStabilityInwardsCalculationScenario + { + InputParameters = + { + SurfaceLine = surfaceLine, + GridDeterminationType = MacroStabilityInwardsGridDeterminationType.Manual, + TangentLineDeterminationType = MacroStabilityInwardsTangentLineDeterminationType.Specified, + TangentLineZTop = (RoundedDouble) 5.0, + TangentLineZBottom = (RoundedDouble) 0.0, + TangentLineNumber = 3 + } + }; + + // Call + view.Data = calculation; + + // Assert + ChartDataCollection chartData = view.Chart.Data; + List chartDataList = chartData.Collection.ToList(); + var tangentLinesData = (ChartMultipleLineData) chartDataList[tangentLinesIndex]; + CollectionAssert.AreEqual(new[] + { + new[] + { + new Point2D(0.0, 5.0), + new Point2D(1.58, 5.0) + }, + new[] + { + new Point2D(0.0, 2.5), + new Point2D(1.58, 2.5) + }, + new[] + { + new Point2D(0.0, 0), + new Point2D(1.58, 0) + } + }, tangentLinesData.Lines); + } + } + + [Test] public void UpdateObserver_CalculationNameUpdated_ChartTitleUpdated() { // Setup @@ -726,6 +775,53 @@ } [Test] + public void UpdateObserver_CalculationInputTangentLineSettingsUpdated_TangentLineChartDataUpdated() + { + // Setup + var calculation = new MacroStabilityInwardsCalculationScenario + { + InputParameters = + { + SurfaceLine = GetSurfaceLineWithGeometry() + } + }; + + using (var view = new MacroStabilityInwardsInputView + { + Data = calculation + }) + { + MacroStabilityInwardsInput input = calculation.InputParameters; + input.GridDeterminationType = MacroStabilityInwardsGridDeterminationType.Manual; + input.TangentLineDeterminationType = MacroStabilityInwardsTangentLineDeterminationType.Specified; + input.TangentLineZTop = (RoundedDouble) 10; + input.TangentLineZBottom = (RoundedDouble) 5; + input.TangentLineNumber = 2; + + // Call + calculation.InputParameters.NotifyObservers(); + + // Assert + ChartDataCollection chartData = view.Chart.Data; + List chartDataList = chartData.Collection.ToList(); + var tangentLinesData = (ChartMultipleLineData) chartDataList[tangentLinesIndex]; + CollectionAssert.AreEqual(new[] + { + new[] + { + new Point2D(0.0, 10.0), + new Point2D(1.58, 10.0) + }, + new[] + { + new Point2D(0.0, 5.0), + new Point2D(1.58, 5.0) + } + }, tangentLinesData.Lines); + } + } + + [Test] public void GivenViewWithStochasticSoilProfile_WhenStochasticSoilProfileUpdated_ThenDataTableUpdated() { // Given @@ -831,8 +927,8 @@ SurfaceLine = GetSurfaceLineWithGeometry(), GridDeterminationType = MacroStabilityInwardsGridDeterminationType.Manual, TangentLineDeterminationType = MacroStabilityInwardsTangentLineDeterminationType.Specified, - TangentLineZTop = new RoundedDouble(2, 10.0), - TangentLineZBottom = new RoundedDouble(2, 5.0), + TangentLineZTop = (RoundedDouble) 10.0, + TangentLineZBottom = (RoundedDouble) 5.0, TangentLineNumber = 2 } }; Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.TestUtil/MacroStabilityInwardsOutputViewChartDataAssert.cs =================================================================== diff -u -r09667b4737dfec082af4a6190f79996062eb6654 -r7b2237f0bdfa03edcf158d24294c4433266ca91f --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.TestUtil/MacroStabilityInwardsOutputViewChartDataAssert.cs (.../MacroStabilityInwardsOutputViewChartDataAssert.cs) (revision 09667b4737dfec082af4a6190f79996062eb6654) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.TestUtil/MacroStabilityInwardsOutputViewChartDataAssert.cs (.../MacroStabilityInwardsOutputViewChartDataAssert.cs) (revision 7b2237f0bdfa03edcf158d24294c4433266ca91f) @@ -21,6 +21,7 @@ using System.Collections.Generic; using System.Linq; +using Core.Common.Base.Data; using Core.Common.Base.Geometry; using Core.Components.Chart.Data; using NUnit.Framework; @@ -230,12 +231,12 @@ /// Thrown when /// does not correspond to and . /// - private static void AssertTangentLinesChartData(IEnumerable tangentLines, + private static void AssertTangentLinesChartData(IEnumerable tangentLines, MacroStabilityInwardsSurfaceLine surfaceLine, ChartMultipleLineData actual) { CollectionAssert.IsNotEmpty(actual.Lines); - double[] tangentLinesArray = tangentLines.ToArray(); + RoundedDouble[] tangentLinesArray = tangentLines.ToArray(); for (var i = 0; i < tangentLinesArray.Length; i++) { var expectedPoints = new[] Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/Converters/MacroStabilityInwardsSlipPlaneUpliftVanConverterTest.cs =================================================================== diff -u -r59adecfc7f82ab8277440ecae147453f5cbddbbf -r7b2237f0bdfa03edcf158d24294c4433266ca91f --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/Converters/MacroStabilityInwardsSlipPlaneUpliftVanConverterTest.cs (.../MacroStabilityInwardsSlipPlaneUpliftVanConverterTest.cs) (revision 59adecfc7f82ab8277440ecae147453f5cbddbbf) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/Converters/MacroStabilityInwardsSlipPlaneUpliftVanConverterTest.cs (.../MacroStabilityInwardsSlipPlaneUpliftVanConverterTest.cs) (revision 7b2237f0bdfa03edcf158d24294c4433266ca91f) @@ -20,7 +20,11 @@ // All rights reserved. using System; +using System.Collections.Generic; +using System.Linq; +using Core.Common.Base.Data; using NUnit.Framework; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.MacroStabilityInwards.Data; using Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.UpliftVan; using Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.UpliftVan.Output; @@ -62,11 +66,22 @@ MacroStabilityInwardsSlipPlaneUpliftVan output = MacroStabilityInwardsSlipPlaneUpliftVanConverter.Convert(result); // Assert - CollectionAssert.AreEqual(tangentLines, output.TangentLines); + AssertTangentLines(tangentLines, output.TangentLines); AssertGrid(leftGrid, output.LeftGrid); AssertGrid(rightGrid, output.RightGrid); } + private static void AssertTangentLines(IEnumerable expectedTangentLines, IEnumerable actualTangentLines) + { + Assert.AreEqual(expectedTangentLines.Count(), actualTangentLines.Count()); + for (var i = 0; i < expectedTangentLines.Count(); i++) + { + RoundedDouble tangentLine = actualTangentLines.ElementAt(i); + Assert.AreEqual(2, tangentLine.NumberOfDecimalPlaces); + Assert.AreEqual(expectedTangentLines.ElementAt(i), tangentLine, tangentLine.GetAccuracy()); + } + } + private static void AssertGrid(UpliftVanGrid expectedGrid, MacroStabilityInwardsGrid actualGrid) { Assert.AreEqual(expectedGrid.XLeft, actualGrid.XLeft); Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/MacroStabilityInwardsCalculationServiceTest.cs =================================================================== diff -u -rbf1e2809138eed48e7c2b769e038378cfa1a1ecd -r7b2237f0bdfa03edcf158d24294c4433266ca91f --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/MacroStabilityInwardsCalculationServiceTest.cs (.../MacroStabilityInwardsCalculationServiceTest.cs) (revision bf1e2809138eed48e7c2b769e038378cfa1a1ecd) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/MacroStabilityInwardsCalculationServiceTest.cs (.../MacroStabilityInwardsCalculationServiceTest.cs) (revision 7b2237f0bdfa03edcf158d24294c4433266ca91f) @@ -22,9 +22,11 @@ using System; using System.Collections.Generic; using System.Linq; +using Core.Common.Base.Data; using Core.Common.TestUtil; using log4net.Core; using NUnit.Framework; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Service.TestUtil; using Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil; using Ringtoets.MacroStabilityInwards.Data; @@ -697,11 +699,22 @@ private static void AssertSlipPlaneOutput(UpliftVanCalculationGridResult expected, MacroStabilityInwardsSlipPlaneUpliftVan actual) { - CollectionAssert.AreEqual(expected.TangentLines, actual.TangentLines); + AssertTangentLines(expected.TangentLines, actual.TangentLines); AssertGrid(expected.LeftGrid, actual.LeftGrid); AssertGrid(expected.RightGrid, actual.RightGrid); } + private static void AssertTangentLines(IEnumerable expectedTangentLines, IEnumerable actualTangentLines) + { + Assert.AreEqual(expectedTangentLines.Count(), actualTangentLines.Count()); + for (var i = 0; i < expectedTangentLines.Count(); i++) + { + RoundedDouble tangentLine = actualTangentLines.ElementAt(i); + Assert.AreEqual(2, tangentLine.NumberOfDecimalPlaces); + Assert.AreEqual(expectedTangentLines.ElementAt(i), tangentLine, tangentLine.GetAccuracy()); + } + } + private static void AssertGrid(UpliftVanGrid expectedGrid, MacroStabilityInwardsGrid actualGrid) { Assert.AreEqual(expectedGrid.XLeft, actualGrid.XLeft);