Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/UpliftVanCalculator.cs =================================================================== diff -u -r7e9a99c5e23b3b955a2ad505e01ee967985aa0d3 -r52a4ba388df217931f26d1815d64b72f36676612 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/UpliftVanCalculator.cs (.../UpliftVanCalculator.cs) (revision 7e9a99c5e23b3b955a2ad505e01ee967985aa0d3) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/UpliftVanCalculator.cs (.../UpliftVanCalculator.cs) (revision 52a4ba388df217931f26d1815d64b72f36676612) @@ -48,11 +48,11 @@ { if (input == null) { - throw new ArgumentNullException(nameof(input), @"MacroStabilityInwardsCalculatorInput required for creating a MacroStabilityInwardsCalculator."); + throw new ArgumentNullException(nameof(input), @"UpliftVanCalculatorInput required for creating a MacroStabilityInwardsCalculator."); } if (factory == null) { - throw new ArgumentNullException(nameof(factory), @"IMacroStabilityInwardsSubCalculatorFactory required for creating a MacroStabilityInwardsCalculator."); + throw new ArgumentNullException(nameof(factory), @"IMacroStabilityInwardsKernelFactory required for creating a MacroStabilityInwardsCalculator."); } this.input = input; this.factory = factory; Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/UpliftVanCalculatorTest.cs =================================================================== diff -u -r7e9a99c5e23b3b955a2ad505e01ee967985aa0d3 -r52a4ba388df217931f26d1815d64b72f36676612 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/UpliftVanCalculatorTest.cs (.../UpliftVanCalculatorTest.cs) (revision 7e9a99c5e23b3b955a2ad505e01ee967985aa0d3) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/UpliftVanCalculatorTest.cs (.../UpliftVanCalculatorTest.cs) (revision 52a4ba388df217931f26d1815d64b72f36676612) @@ -51,7 +51,7 @@ TestDelegate call = () => new UpliftVanCalculator(null, factory); // Assert - const string expectedMessage = "MacroStabilityInwardsCalculatorInput required for creating a MacroStabilityInwardsCalculator."; + const string expectedMessage = "UpliftVanCalculatorInput required for creating a MacroStabilityInwardsCalculator."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); mocks.VerifyAll(); } @@ -64,7 +64,7 @@ TestDelegate call = () => new UpliftVanCalculator(input, null); // Assert - const string expectedMessage = "IMacroStabilityInwardsSubCalculatorFactory required for creating a MacroStabilityInwardsCalculator."; + const string expectedMessage = "IMacroStabilityInwardsKernelFactory required for creating a MacroStabilityInwardsCalculator."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); } @@ -127,10 +127,10 @@ { // Setup var input = new UpliftVanCalculatorInput(CreateSimpleConstructionProperties()); - var testMacroStabilityInwardsSubCalculatorFactory = new TestMacroStabilityInwardsKernelFactory(); + var testMacroStabilityInwardsKernelFactory = new TestMacroStabilityInwardsKernelFactory(); // Call - List validationResult = new UpliftVanCalculator(input, testMacroStabilityInwardsSubCalculatorFactory).Validate(); + List validationResult = new UpliftVanCalculator(input, testMacroStabilityInwardsKernelFactory).Validate(); // Assert CollectionAssert.IsEmpty(validationResult); Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test/Kernel/MacroStabilityInwardsKernelFactoryConfigTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test/Kernel/MacroStabilityInwardsKernelFactoryConfigTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test/Kernel/MacroStabilityInwardsKernelFactoryConfigTest.cs (revision 52a4ba388df217931f26d1815d64b72f36676612) @@ -0,0 +1,67 @@ +// 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 NUnit.Framework; +using Ringtoets.MacroStabilityInwards.KernelWrapper.Kernel; +using Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Kernel; + +namespace Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test.Kernel +{ + [TestFixture] + public class MacroStabilityInwardsKernelFactoryConfigTest + { + [Test] + public void Constructor_NewInstanceCanBeDisposed() + { + // Call + var factory = new MacroStabilityInwardsKernelFactoryConfig(); + + // Assert + Assert.IsInstanceOf(factory); + Assert.DoesNotThrow(() => factory.Dispose()); + } + + [Test] + public void Constructor_SetsTestFactoryForMacroStabilityInwardsKernelWrapperFactory() + { + // Call + using (new MacroStabilityInwardsKernelFactoryConfig()) + { + // Assert + Assert.IsInstanceOf(MacroStabilityInwardsKernelWrapperFactory.Instance); + } + } + + [Test] + public void Dispose_Always_ResetsFactoryToPreviousValue() + { + // Setup + IMacroStabilityInwardsKernelFactory expectedFactory = MacroStabilityInwardsKernelWrapperFactory.Instance; + + // Call + using (new MacroStabilityInwardsKernelFactoryConfig()) {} + + // Assert + Assert.AreSame(expectedFactory, MacroStabilityInwardsKernelWrapperFactory.Instance); + } + } +} \ No newline at end of file Fisheye: Tag 52a4ba388df217931f26d1815d64b72f36676612 refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test/Kernel/MacroStabilityInwardsSubCalculatorFactoryConfigTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 52a4ba388df217931f26d1815d64b72f36676612 refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test/MacroStabilityInwardsCalculatorResultTestFactoryTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test.csproj =================================================================== diff -u -r7e9a99c5e23b3b955a2ad505e01ee967985aa0d3 -r52a4ba388df217931f26d1815d64b72f36676612 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test.csproj) (revision 7e9a99c5e23b3b955a2ad505e01ee967985aa0d3) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test.csproj) (revision 52a4ba388df217931f26d1815d64b72f36676612) @@ -52,13 +52,13 @@ Properties\GlobalAssembly.cs - + - + Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test/UpliftVanCalculatorResultTestFactoryTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test/UpliftVanCalculatorResultTestFactoryTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test/UpliftVanCalculatorResultTestFactoryTest.cs (revision 52a4ba388df217931f26d1815d64b72f36676612) @@ -0,0 +1,93 @@ +// 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; + +namespace Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Test +{ + [TestFixture] + public class UpliftVanCalculatorResultTestFactoryTest + { + [Test] + public void Create_Always_ReturnResultWithDefaultValues() + { + // Call + UpliftVanCalculatorResult result = UpliftVanCalculatorResultTestFactory.Create(); + + // Assert + Assert.AreEqual(0.1, result.FactorOfStability); + Assert.AreEqual(0.2, result.ZValue); + Assert.AreEqual(0.3, result.ForbiddenZonesXEntryMin); + Assert.AreEqual(0.4, result.ForbiddenZonesXEntryMax); + Assert.IsTrue(result.GridAutomaticallyCalculated); + Assert.IsTrue(result.ForbiddenZonesAutomaticallyCalculated); + + AssertSlidingCurve(result.SlidingCurveResult); + AssertUpliftVanCalculationGrid(result.CalculationGridResult); + } + + private static void AssertSlidingCurve(UpliftVanSlidingCurveResult slidingCurve) + { + AssertCircle(slidingCurve.LeftCircle); + AssertCircle(slidingCurve.RightCircle); + + Assert.AreEqual(0, slidingCurve.IteratedHorizontalForce); + Assert.AreEqual(0, slidingCurve.NonIteratedHorizontalForce); + CollectionAssert.IsEmpty(slidingCurve.Slices); + } + + private static void AssertCircle(UpliftVanSlidingCircleResult 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); + } + + private static void AssertUpliftVanCalculationGrid(UpliftVanCalculationGridResult upliftVanCalculationGrid) + { + AssertGrid(upliftVanCalculationGrid.LeftGrid); + AssertGrid(upliftVanCalculationGrid.RightGrid); + + CollectionAssert.AreEqual(new[] + { + 3, + 2, + 1.5 + }, upliftVanCalculationGrid.TangentLines); + } + + private static void AssertGrid(UpliftVanGridResult grid) + { + Assert.AreEqual(0.1, grid.XLeft); + Assert.AreEqual(0.2, grid.XRight); + Assert.AreEqual(0.3, grid.ZTop); + Assert.AreEqual(0.4, grid.ZBottom); + Assert.AreEqual(1, grid.NumberOfHorizontalPoints); + Assert.AreEqual(2, grid.NumberOfVerticalPoints); + } + } +} \ No newline at end of file Fisheye: Tag 52a4ba388df217931f26d1815d64b72f36676612 refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/MacroStabilityInwardsCalculatorResultTestFactory.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.csproj =================================================================== diff -u -r7e9a99c5e23b3b955a2ad505e01ee967985aa0d3 -r52a4ba388df217931f26d1815d64b72f36676612 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.csproj) (revision 7e9a99c5e23b3b955a2ad505e01ee967985aa0d3) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.csproj) (revision 52a4ba388df217931f26d1815d64b72f36676612) @@ -57,7 +57,7 @@ Properties\GlobalAssembly.cs - + Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/SlidingDualCircleTestFactory.cs =================================================================== diff -u -r966dc7335defa901104fd4168d57c08315db2de0 -r52a4ba388df217931f26d1815d64b72f36676612 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/SlidingDualCircleTestFactory.cs (.../SlidingDualCircleTestFactory.cs) (revision 966dc7335defa901104fd4168d57c08315db2de0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/SlidingDualCircleTestFactory.cs (.../SlidingDualCircleTestFactory.cs) (revision 52a4ba388df217931f26d1815d64b72f36676612) @@ -31,7 +31,7 @@ public static class SlidingDualCircleTestFactory { /// - /// Creates a simple . + /// Creates a simple . /// /// A simple with default values. public static SlidingDualCircle Create() Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/SlipPlaneUpliftVanTestFactory.cs =================================================================== diff -u -r8df85402c4de8eb335483bcda5e4ff23ce0dd5ef -r52a4ba388df217931f26d1815d64b72f36676612 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/SlipPlaneUpliftVanTestFactory.cs (.../SlipPlaneUpliftVanTestFactory.cs) (revision 8df85402c4de8eb335483bcda5e4ff23ce0dd5ef) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/SlipPlaneUpliftVanTestFactory.cs (.../SlipPlaneUpliftVanTestFactory.cs) (revision 52a4ba388df217931f26d1815d64b72f36676612) @@ -30,7 +30,7 @@ public static class SlipPlaneUpliftVanTestFactory { /// - /// Creates a simple . + /// Creates a simple . /// /// A simple with default values. public static SlipPlaneUpliftVan Create() Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/UpliftVanCalculatorResultTestFactory.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/UpliftVanCalculatorResultTestFactory.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/UpliftVanCalculatorResultTestFactory.cs (revision 52a4ba388df217931f26d1815d64b72f36676612) @@ -0,0 +1,61 @@ +// 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 Ringtoets.MacroStabilityInwards.KernelWrapper.Result; +using Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.Result; + +namespace Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil +{ + /// + /// Factory to create simple + /// instances that can be used for testing. + /// + public static class UpliftVanCalculatorResultTestFactory + { + /// + /// Creates a new . + /// + /// The created . + public static UpliftVanCalculatorResult Create() + { + return new UpliftVanCalculatorResult( + UpliftVanSlidingCurveResultTestFactory.Create(), + new UpliftVanCalculationGridResult( + UpliftVanGridResultTestFactory.Create(), + UpliftVanGridResultTestFactory.Create(), + new[] + { + 3, + 2, + 1.5 + }), + new UpliftVanCalculatorResult.ConstructionProperties + { + FactorOfStability = 0.1, + ZValue = 0.2, + ForbiddenZonesXEntryMin = 0.3, + ForbiddenZonesXEntryMax = 0.4, + GridAutomaticallyCalculated = true, + ForbiddenZonesAutomaticallyCalculated = true + }); + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/UpliftVanCalculatorStub.cs =================================================================== diff -u -r497172e737ffc201c0f905e85a246cdba3c0cb1c -r52a4ba388df217931f26d1815d64b72f36676612 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/UpliftVanCalculatorStub.cs (.../UpliftVanCalculatorStub.cs) (revision 497172e737ffc201c0f905e85a246cdba3c0cb1c) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/UpliftVanCalculatorStub.cs (.../UpliftVanCalculatorStub.cs) (revision 52a4ba388df217931f26d1815d64b72f36676612) @@ -34,7 +34,7 @@ public UpliftVanCalculatorResult Calculate() { - return Output ?? (Output = MacroStabilityInwardsCalculatorResultTestFactory.Create()); + return Output ?? (Output = UpliftVanCalculatorResultTestFactory.Create()); } public List Validate()