Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/MacroStabilityInwardsCalculator.cs =================================================================== diff -u -r966dc7335defa901104fd4168d57c08315db2de0 -r8df85402c4de8eb335483bcda5e4ff23ce0dd5ef --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/MacroStabilityInwardsCalculator.cs (.../MacroStabilityInwardsCalculator.cs) (revision 966dc7335defa901104fd4168d57c08315db2de0) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/MacroStabilityInwardsCalculator.cs (.../MacroStabilityInwardsCalculator.cs) (revision 8df85402c4de8eb335483bcda5e4ff23ce0dd5ef) @@ -66,7 +66,7 @@ return new MacroStabilityInwardsCalculatorResult( MacroStabilityInwardsSlidingCurveResultCreator.Create(upliftVanCalculator.SlidingCurveResult), - null, + MacroStabilityInwardsUpliftVanCalculationGridResultCreator.Create(upliftVanCalculator.SlipPlaneResult), new MacroStabilityInwardsCalculatorResult.ConstructionProperties { FactorOfStability = upliftVanCalculator.FactoryOfStability, Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/MacroStabilityInwardsCalculatorResult.cs =================================================================== diff -u -r171b5961353dab92f39de485f07a2f495b01a89d -r8df85402c4de8eb335483bcda5e4ff23ce0dd5ef --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/MacroStabilityInwardsCalculatorResult.cs (.../MacroStabilityInwardsCalculatorResult.cs) (revision 171b5961353dab92f39de485f07a2f495b01a89d) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/MacroStabilityInwardsCalculatorResult.cs (.../MacroStabilityInwardsCalculatorResult.cs) (revision 8df85402c4de8eb335483bcda5e4ff23ce0dd5ef) @@ -43,6 +43,14 @@ MacroStabilityInwardsUpliftVanCalculationGridResult upliftVanCalculationGrid, ConstructionProperties properties) { + if (slidingCurve == null) + { + throw new ArgumentNullException(nameof(slidingCurve)); + } + if (upliftVanCalculationGrid == null) + { + throw new ArgumentNullException(nameof(upliftVanCalculationGrid)); + } if (properties == null) { throw new ArgumentNullException(nameof(properties)); Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/MacroStabilityInwardsCalculatorResultTest.cs =================================================================== diff -u -r171b5961353dab92f39de485f07a2f495b01a89d -r8df85402c4de8eb335483bcda5e4ff23ce0dd5ef --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/MacroStabilityInwardsCalculatorResultTest.cs (.../MacroStabilityInwardsCalculatorResultTest.cs) (revision 171b5961353dab92f39de485f07a2f495b01a89d) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/MacroStabilityInwardsCalculatorResultTest.cs (.../MacroStabilityInwardsCalculatorResultTest.cs) (revision 8df85402c4de8eb335483bcda5e4ff23ce0dd5ef) @@ -31,6 +31,36 @@ public class MacroStabilityInwardsCalculatorResultTest { [Test] + public void Constructor_SlidingCurveNull_ThrowsArgumentNullException() + { + // Setup + var upliftVanCalculationGrid = new MacroStabilityInwardsUpliftVanCalculationGridResult(MacroStabilityInwardsGridResultTestFactory.Create(), + MacroStabilityInwardsGridResultTestFactory.Create(), + new double[0]); + + // Call + TestDelegate call = () => new MacroStabilityInwardsCalculatorResult(null, upliftVanCalculationGrid, new MacroStabilityInwardsCalculatorResult.ConstructionProperties()); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("slidingCurve", exception.ParamName); + } + + [Test] + public void Constructor_UpliftVanCalculationGridNull_ThrowsArgumentNullException() + { + // Setup + MacroStabilityInwardsSlidingCurveResult curve = MacroStabilityInwardsSlidingCurveResultTestFactory.Create(); + + // Call + TestDelegate call = () => new MacroStabilityInwardsCalculatorResult(curve, null, new MacroStabilityInwardsCalculatorResult.ConstructionProperties()); ; + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("upliftVanCalculationGrid", exception.ParamName); + } + + [Test] public void Constructor_ConstructionPropertiesNull_ThrowsArgumentNullException() { // Setup Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/MacroStabilityInwardsCalculatorTest.cs =================================================================== diff -u -r966dc7335defa901104fd4168d57c08315db2de0 -r8df85402c4de8eb335483bcda5e4ff23ce0dd5ef --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/MacroStabilityInwardsCalculatorTest.cs (.../MacroStabilityInwardsCalculatorTest.cs) (revision 966dc7335defa901104fd4168d57c08315db2de0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/MacroStabilityInwardsCalculatorTest.cs (.../MacroStabilityInwardsCalculatorTest.cs) (revision 8df85402c4de8eb335483bcda5e4ff23ce0dd5ef) @@ -101,6 +101,7 @@ calculator.ForbiddenZonesAutomaticallyCalculated = random.NextBoolean(); calculator.GridAutomaticallyCalculated = random.NextBoolean(); calculator.SlidingCurveResult = SlidingDualCircleTestFactory.Create(); + calculator.SlipPlaneResult = SlipPlaneUpliftVanTestFactory.Create(); // Call MacroStabilityInwardsCalculatorResult actual = new MacroStabilityInwardsCalculator(input, testMacroStabilityInwardsSubCalculatorFactory).Calculate(); @@ -113,7 +114,10 @@ Assert.AreEqual(calculator.ForbiddenZonesXEntryMin, actual.ForbiddenZonesXEntryMin); Assert.AreEqual(calculator.ForbiddenZonesAutomaticallyCalculated, actual.ForbiddenZonesAutomaticallyCalculated); Assert.AreEqual(calculator.GridAutomaticallyCalculated, actual.GridAutomaticallyCalculated); - MacroStabilityInwardsSlidingCurveResultHelper.AssertSlidingCurve(MacroStabilityInwardsSlidingCurveResultCreator.Create(calculator.SlidingCurveResult), actual.SlidingCurve); + MacroStabilityInwardsCalculatorResultHelper.AssertSlidingCurve(MacroStabilityInwardsSlidingCurveResultCreator.Create(calculator.SlidingCurveResult), + actual.SlidingCurve); + MacroStabilityInwardsCalculatorResultHelper.AssertSlipPlaneGrid(MacroStabilityInwardsUpliftVanCalculationGridResultCreator.Create(calculator.SlipPlaneResult), + actual.UpliftVanCalculationGrid); Assert.IsTrue(testMacroStabilityInwardsSubCalculatorFactory.LastCreatedUpliftVanCalculator.Calculated); } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test/SlipPlaneUpliftVanTestFactoryTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test/SlipPlaneUpliftVanTestFactoryTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test/SlipPlaneUpliftVanTestFactoryTest.cs (revision 8df85402c4de8eb335483bcda5e4ff23ce0dd5ef) @@ -0,0 +1,53 @@ +// 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 Deltares.WTIStability; +using NUnit.Framework; + +namespace Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test +{ + [TestFixture] + public class SlipPlaneUpliftVanTestFactoryTest + { + [Test] + public void Create_Always_ReturnSlipPlaneUpliftVan() + { + // Call + SlipPlaneUpliftVan slipPlaneUpliftVan = SlipPlaneUpliftVanTestFactory.Create(); + + // Assert + SlipCircleGrid leftGrid = slipPlaneUpliftVan.SlipPlaneLeftGrid; + Assert.AreEqual(0.1, leftGrid.GridXLeft); + Assert.AreEqual(0.2, leftGrid.GridXRight); + Assert.AreEqual(0.3, leftGrid.GridZTop); + Assert.AreEqual(0.4, leftGrid.GridZBottom); + Assert.AreEqual(1, leftGrid.GridXNumber); + Assert.AreEqual(2, leftGrid.GridZNumber); + SlipCircleGrid rightGrid = slipPlaneUpliftVan.SlipPlaneRightGrid; + Assert.AreEqual(0.5, rightGrid.GridXLeft); + Assert.AreEqual(0.6, rightGrid.GridXRight); + Assert.AreEqual(0.7, rightGrid.GridZTop); + Assert.AreEqual(0.8, rightGrid.GridZBottom); + Assert.AreEqual(3, rightGrid.GridXNumber); + Assert.AreEqual(4, rightGrid.GridZNumber); + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/Result/MacroStabilityInwardsCalculatorResultHelper.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/Result/MacroStabilityInwardsCalculatorResultHelper.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/Result/MacroStabilityInwardsCalculatorResultHelper.cs (revision 8df85402c4de8eb335483bcda5e4ff23ce0dd5ef) @@ -0,0 +1,117 @@ +// 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.Linq; +using NUnit.Framework; +using Ringtoets.MacroStabilityInwards.KernelWrapper.Result; + +namespace Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Result +{ + /// + /// Helper that can be used in tests. + /// + public static class MacroStabilityInwardsCalculatorResultHelper + { + /// + /// Assert whether the is equal to the . + /// + /// The expected values. + /// The actual values. + /// Thrown when the + /// is not equal to the . + public static void AssertSlidingCurve(MacroStabilityInwardsSlidingCurveResult expected, MacroStabilityInwardsSlidingCurveResult actual) + { + Assert.AreEqual(expected.IteratedHorizontalForce, actual.IteratedHorizontalForce); + Assert.AreEqual(expected.NonIteratedHorizontalForce, actual.NonIteratedHorizontalForce); + AssertCircle(expected.LeftCircle, actual.LeftCircle); + AssertCircle(expected.RightCircle, actual.RightCircle); + + AssertSlices(expected.Slices.ToArray(), actual.Slices.ToArray()); + } + + public static void AssertSlipPlaneGrid(MacroStabilityInwardsUpliftVanCalculationGridResult expected, MacroStabilityInwardsUpliftVanCalculationGridResult actual) + { + CollectionAssert.AreEqual(expected.TangentLines, actual.TangentLines); + AssertGrid(expected.LeftGrid, actual.LeftGrid); + AssertGrid(expected.RightGrid, actual.RightGrid); + } + + private static void AssertGrid(MacroStabilityInwardsGridResult expected, MacroStabilityInwardsGridResult actual) + { + Assert.AreEqual(expected.XLeft, actual.XLeft); + Assert.AreEqual(expected.XRight, actual.XRight); + Assert.AreEqual(expected.ZTop, actual.ZTop); + Assert.AreEqual(expected.ZBottom, actual.ZBottom); + Assert.AreEqual(expected.NumberOfHorizontalPoints, actual.NumberOfHorizontalPoints); + Assert.AreEqual(expected.NumberOfVerticalPoints, actual.NumberOfVerticalPoints); + } + + private static void AssertCircle(MacroStabilityInwardsSlidingCircleResult expected, MacroStabilityInwardsSlidingCircleResult actual) + { + Assert.AreEqual(expected.Center, actual.Center); + Assert.AreEqual(expected.Radius, actual.Radius); + Assert.AreEqual(expected.IsActive, actual.IsActive); + Assert.AreEqual(expected.NonIteratedForce, actual.NonIteratedForce); + Assert.AreEqual(expected.IteratedForce, actual.IteratedForce); + Assert.AreEqual(expected.DrivingMoment, actual.DrivingMoment); + Assert.AreEqual(expected.ResistingMoment, actual.ResistingMoment); + } + + private static void AssertSlices(MacroStabilityInwardsSliceResult[] expectedSlices, MacroStabilityInwardsSliceResult[] actualSlices) + { + Assert.AreEqual(expectedSlices.Length, actualSlices.Length); + + for (var i = 0; i < expectedSlices.Length; i++) + { + Assert.AreEqual(expectedSlices[i].Cohesion, actualSlices[i].Cohesion); + Assert.AreEqual(expectedSlices[i].FrictionAngle, actualSlices[i].FrictionAngle); + Assert.AreEqual(expectedSlices[i].CriticalPressure, actualSlices[i].CriticalPressure); + Assert.AreEqual(expectedSlices[i].OverConsolidationRatio, actualSlices[i].OverConsolidationRatio); + Assert.AreEqual(expectedSlices[i].Pop, actualSlices[i].Pop); + Assert.AreEqual(expectedSlices[i].DegreeOfConsolidationPorePressureSoil, actualSlices[i].DegreeOfConsolidationPorePressureSoil); + Assert.AreEqual(expectedSlices[i].DegreeOfConsolidationPorePressureLoad, actualSlices[i].DegreeOfConsolidationPorePressureLoad); + Assert.AreEqual(expectedSlices[i].Dilatancy, actualSlices[i].Dilatancy); + Assert.AreEqual(expectedSlices[i].ExternalLoad, actualSlices[i].ExternalLoad); + Assert.AreEqual(expectedSlices[i].HydrostaticPorePressure, actualSlices[i].HydrostaticPorePressure); + Assert.AreEqual(expectedSlices[i].LeftForce, actualSlices[i].LeftForce); + Assert.AreEqual(expectedSlices[i].LeftForceAngle, actualSlices[i].LeftForceAngle); + Assert.AreEqual(expectedSlices[i].LeftForceY, actualSlices[i].LeftForceY); + Assert.AreEqual(expectedSlices[i].RightForce, actualSlices[i].RightForce); + Assert.AreEqual(expectedSlices[i].RightForceAngle, actualSlices[i].RightForceAngle); + Assert.AreEqual(expectedSlices[i].RightForceY, actualSlices[i].RightForceY); + Assert.AreEqual(expectedSlices[i].LoadStress, actualSlices[i].LoadStress); + Assert.AreEqual(expectedSlices[i].NormalStress, actualSlices[i].NormalStress); + Assert.AreEqual(expectedSlices[i].PorePressure, actualSlices[i].PorePressure); + Assert.AreEqual(expectedSlices[i].HorizontalPorePressure, actualSlices[i].HorizontalPorePressure); + Assert.AreEqual(expectedSlices[i].VerticalPorePressure, actualSlices[i].VerticalPorePressure); + Assert.AreEqual(expectedSlices[i].PiezometricPorePressure, actualSlices[i].PiezometricPorePressure); + Assert.AreEqual(expectedSlices[i].EffectiveStress, actualSlices[i].EffectiveStress); + Assert.AreEqual(expectedSlices[i].EffectiveStressDaily, actualSlices[i].EffectiveStressDaily); + Assert.AreEqual(expectedSlices[i].ExcessPorePressure, actualSlices[i].ExcessPorePressure); + Assert.AreEqual(expectedSlices[i].ShearStress, actualSlices[i].ShearStress); + Assert.AreEqual(expectedSlices[i].SoilStress, actualSlices[i].SoilStress); + Assert.AreEqual(expectedSlices[i].TotalPorePressure, actualSlices[i].TotalPorePressure); + Assert.AreEqual(expectedSlices[i].TotalStress, actualSlices[i].TotalStress); + Assert.AreEqual(expectedSlices[i].Weight, actualSlices[i].Weight); + } + } + } +} \ No newline at end of file Fisheye: Tag 8df85402c4de8eb335483bcda5e4ff23ce0dd5ef refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/Result/MacroStabilityInwardsSlidingCurveResultHelper.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.csproj =================================================================== diff -u -r966dc7335defa901104fd4168d57c08315db2de0 -r8df85402c4de8eb335483bcda5e4ff23ce0dd5ef --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.csproj) (revision 966dc7335defa901104fd4168d57c08315db2de0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.csproj) (revision 8df85402c4de8eb335483bcda5e4ff23ce0dd5ef) @@ -59,9 +59,10 @@ - + + Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/SlipPlaneUpliftVanTestFactory.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/SlipPlaneUpliftVanTestFactory.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/SlipPlaneUpliftVanTestFactory.cs (revision 8df85402c4de8eb335483bcda5e4ff23ce0dd5ef) @@ -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. + +using Deltares.WTIStability; + +namespace Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil +{ + /// + /// Factory to create simple + /// instances that can be used for testing. + /// + public static class SlipPlaneUpliftVanTestFactory + { + /// + /// Creates a simple . + /// + /// A simple with default values. + public static SlipPlaneUpliftVan Create() + { + return new SlipPlaneUpliftVan + { + SlipPlaneLeftGrid = new SlipCircleGrid + { + GridXLeft = 0.1, + GridXRight = 0.2, + GridZTop = 0.3, + GridZBottom = 0.4, + GridXNumber = 1, + GridZNumber = 2 + }, + SlipPlaneRightGrid = new SlipCircleGrid + { + GridXLeft = 0.5, + GridXRight = 0.6, + GridZTop = 0.7, + GridZBottom = 0.8, + GridXNumber = 3, + GridZNumber = 4 + }, + SlipPlaneTangentLine = new SlipCircleTangentLine + { + BoundaryHeights = + { + new TangentLine(1.1), + new TangentLine(2.2) + } + } + }; + } + } +} \ No newline at end of file