Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/MacroStabilityInwardsCalculator.cs =================================================================== diff -u -r171b5961353dab92f39de485f07a2f495b01a89d -re95718a891fa178feab8e70bee2db77e9dedc790 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/MacroStabilityInwardsCalculator.cs (.../MacroStabilityInwardsCalculator.cs) (revision 171b5961353dab92f39de485f07a2f495b01a89d) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/MacroStabilityInwardsCalculator.cs (.../MacroStabilityInwardsCalculator.cs) (revision e95718a891fa178feab8e70bee2db77e9dedc790) @@ -70,7 +70,9 @@ { IUpliftVanCalculator upliftVanCalculator = CalculateUpliftVan(); - return new MacroStabilityInwardsCalculatorResult(null, null, + return new MacroStabilityInwardsCalculatorResult( + MacroStabilityInwardsSlidingCurveResultCreator.Create(upliftVanCalculator.SlidingCurve), + null, new MacroStabilityInwardsCalculatorResult.ConstructionProperties { FactorOfStability = upliftVanCalculator.FactoryOfStability, Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/MacroStabilityInwardsCalculatorTest.cs =================================================================== diff -u -r171b5961353dab92f39de485f07a2f495b01a89d -re95718a891fa178feab8e70bee2db77e9dedc790 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/MacroStabilityInwardsCalculatorTest.cs (.../MacroStabilityInwardsCalculatorTest.cs) (revision 171b5961353dab92f39de485f07a2f495b01a89d) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/MacroStabilityInwardsCalculatorTest.cs (.../MacroStabilityInwardsCalculatorTest.cs) (revision e95718a891fa178feab8e70bee2db77e9dedc790) @@ -25,6 +25,9 @@ using Core.Common.Base.Geometry; using Core.Common.TestUtil; using NUnit.Framework; +using Ringtoets.MacroStabilityInwards.KernelWrapper.Creators; +using Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil; +using Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Result; using Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.SubCalculator; using Ringtoets.MacroStabilityInwards.Primitives; using Ringtoets.MacroStabilityInwards.Primitives.MacroStabilityInwardsSoilUnderSurfaceLine; @@ -72,6 +75,7 @@ calculator.ForbiddenZonesXEntryMin = random.NextDouble(); calculator.ForbiddenZonesAutomaticallyCalculated = random.NextBoolean(); calculator.GridAutomaticallyCalculated = random.NextBoolean(); + calculator.SlidingCurve = SlidingDualCircleTestFactory.Create(); // Call MacroStabilityInwardsCalculatorResult actual = new MacroStabilityInwardsCalculator(input, testMacroStabilityInwardsSubCalculatorFactory).Calculate(); @@ -86,6 +90,7 @@ Assert.AreEqual(calculator.GridAutomaticallyCalculated, actual.GridAutomaticallyCalculated); Assert.IsTrue(testMacroStabilityInwardsSubCalculatorFactory.LastCreatedUpliftVanCalculator.Calculated); + MacroStabilityInwardsSlidingCurveResultHelper.AssertSlidingCurve(MacroStabilityInwardsSlidingCurveResultCreator.Create(calculator.SlidingCurve), actual.SlidingCurve); } [Test] Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test/Result/MacroStabilityInwardsSlidingCurveResultTestFactoryTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test/Result/MacroStabilityInwardsSlidingCurveResultTestFactoryTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test/Result/MacroStabilityInwardsSlidingCurveResultTestFactoryTest.cs (revision e95718a891fa178feab8e70bee2db77e9dedc790) @@ -0,0 +1,58 @@ +// 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 Core.Common.Base.Geometry; +using NUnit.Framework; +using Ringtoets.MacroStabilityInwards.KernelWrapper.Result; +using Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Result; + +namespace Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test.Result +{ + [TestFixture] + public class MacroStabilityInwardsSlidingCurveResultTestFactoryTest + { + [Test] + public void Create_Always_ReturnSlidingCurveResult() + { + // Call + MacroStabilityInwardsSlidingCurveResult curve = MacroStabilityInwardsSlidingCurveResultTestFactory.Create(); + + // Assert + AssertCircle(curve.LeftCircle); + AssertCircle(curve.RightCircle); + + Assert.AreEqual(0, curve.IteratedHorizontalForce); + Assert.AreEqual(0, curve.NonIteratedHorizontalForce); + CollectionAssert.IsEmpty(curve.Slices); + } + + private static void AssertCircle(MacroStabilityInwardsSlidingCircleResult circle) + { + Assert.AreEqual(new Point2D(0, 0), circle.Center); + Assert.AreEqual(0.1, circle.Radius); + Assert.IsTrue(circle.IsActive); + Assert.AreEqual(0.2, circle.NonIteratedForce); + Assert.AreEqual(0.3, circle.IteratedForce); + Assert.AreEqual(0.4, circle.DrivingMoment); + Assert.AreEqual(0.5, circle.ResistingMoment); + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test.csproj =================================================================== diff -u -r248fce84b11164afd0673d39c05fc7c661a2d40b -re95718a891fa178feab8e70bee2db77e9dedc790 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test.csproj) (revision 248fce84b11164afd0673d39c05fc7c661a2d40b) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test.csproj) (revision e95718a891fa178feab8e70bee2db77e9dedc790) @@ -53,6 +53,7 @@ + Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/Result/MacroStabilityInwardsSlidingCurveResultHelper.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/Result/MacroStabilityInwardsSlidingCurveResultHelper.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/Result/MacroStabilityInwardsSlidingCurveResultHelper.cs (revision e95718a891fa178feab8e70bee2db77e9dedc790) @@ -0,0 +1,101 @@ +// 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 MacroStabilityInwardsSlidingCurveResultHelper + { + /// + /// 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()); + + } + + 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 Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.csproj =================================================================== diff -u -r248fce84b11164afd0673d39c05fc7c661a2d40b -re95718a891fa178feab8e70bee2db77e9dedc790 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.csproj) (revision 248fce84b11164afd0673d39c05fc7c661a2d40b) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.csproj) (revision e95718a891fa178feab8e70bee2db77e9dedc790) @@ -41,6 +41,10 @@ MinimumRecommendedRules.ruleset + + ..\..\..\..\packages\NUnit.3.8.1\lib\net40\nunit.framework.dll + True + @@ -54,6 +58,7 @@ + @@ -82,6 +87,7 @@ Copying.licenseheader + + + + + \ No newline at end of file