Index: Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil.Test/StochasticSoilModelTestFactoryTest.cs =================================================================== diff -u -r73249f7fc6ef30fad46c98b2b90d69d1bbfcedf9 -r30b4bd298c03a8c2162f5dd306d282453428c609 --- Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil.Test/StochasticSoilModelTestFactoryTest.cs (.../StochasticSoilModelTestFactoryTest.cs) (revision 73249f7fc6ef30fad46c98b2b90d69d1bbfcedf9) +++ Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil.Test/StochasticSoilModelTestFactoryTest.cs (.../StochasticSoilModelTestFactoryTest.cs) (revision 30b4bd298c03a8c2162f5dd306d282453428c609) @@ -65,37 +65,5 @@ new Point2D(3, 4) }, model.Geometry); } - - [Test] - public void CreateStochasticSoilModelWithGeometry_WithSoilProfilesAndFailureMechanismType_ReturnsStochasticSoilModelWithExpectedPropertiesSet() - { - // Setup - var random = new Random(21); - var failureMechanismType = random.NextEnumValue(); - - var mocks = new MockRepository(); - var soilProfile = mocks.Stub(); - mocks.ReplayAll(); - - var stochasticSoilProfiles = new[] - { - new StochasticSoilProfile(random.NextDouble(), soilProfile) - }; - - // Call - StochasticSoilModel model = StochasticSoilModelTestFactory.CreateStochasticSoilModelWithGeometry(failureMechanismType, - stochasticSoilProfiles); - - // Assert - Assert.AreEqual("Stochastic Soil Model", model.Name); - Assert.AreEqual(failureMechanismType, model.FailureMechanismType); - CollectionAssert.AreEqual(stochasticSoilProfiles, model.StochasticSoilProfiles); - CollectionAssert.AreEqual(new[] - { - new Point2D(1, 2), - new Point2D(3, 4) - }, model.Geometry); - - } } } \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil/StochasticSoilModelTestFactory.cs =================================================================== diff -u -r73249f7fc6ef30fad46c98b2b90d69d1bbfcedf9 -r30b4bd298c03a8c2162f5dd306d282453428c609 --- Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil/StochasticSoilModelTestFactory.cs (.../StochasticSoilModelTestFactory.cs) (revision 73249f7fc6ef30fad46c98b2b90d69d1bbfcedf9) +++ Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil/StochasticSoilModelTestFactory.cs (.../StochasticSoilModelTestFactory.cs) (revision 30b4bd298c03a8c2162f5dd306d282453428c609) @@ -58,18 +58,5 @@ return model; } - - /// - /// Creates a with a predefined geometry. - /// - /// The failure mechanism type of the stochastic soil model. - /// The stochastic soil profiles belonging to the soil model. - /// A configured with a predefined geometry. - /// Throw when is null. - public static StochasticSoilModel CreateStochasticSoilModelWithGeometry(FailureMechanismType failureMechanismType, - IEnumerable stochasticSoilProfiles) - { - return CreateStochasticSoilModelWithGeometry("Stochastic Soil Model", failureMechanismType, stochasticSoilProfiles); - } } } \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Ringtoets.MacroStabilityInwards.IO.Test.csproj =================================================================== diff -u -r59adecfc7f82ab8277440ecae147453f5cbddbbf -r30b4bd298c03a8c2162f5dd306d282453428c609 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Ringtoets.MacroStabilityInwards.IO.Test.csproj (.../Ringtoets.MacroStabilityInwards.IO.Test.csproj) (revision 59adecfc7f82ab8277440ecae147453f5cbddbbf) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Ringtoets.MacroStabilityInwards.IO.Test.csproj (.../Ringtoets.MacroStabilityInwards.IO.Test.csproj) (revision 30b4bd298c03a8c2162f5dd306d282453428c609) @@ -119,6 +119,10 @@ {2b78cf04-4785-4f27-a6e5-45bddbb7bf04} Ringtoets.MacroStabilityInwards.Data.TestUtil + + {c83b2091-339a-4f35-a874-a4c807f55cae} + Ringtoets.MacroStabilityInwards.IO.TestUtil + Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SoilProfiles/MacroStabilityInwardsStochasticSoilModelTransformerTest.cs =================================================================== diff -u -r73249f7fc6ef30fad46c98b2b90d69d1bbfcedf9 -r30b4bd298c03a8c2162f5dd306d282453428c609 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SoilProfiles/MacroStabilityInwardsStochasticSoilModelTransformerTest.cs (.../MacroStabilityInwardsStochasticSoilModelTransformerTest.cs) (revision 73249f7fc6ef30fad46c98b2b90d69d1bbfcedf9) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SoilProfiles/MacroStabilityInwardsStochasticSoilModelTransformerTest.cs (.../MacroStabilityInwardsStochasticSoilModelTransformerTest.cs) (revision 30b4bd298c03a8c2162f5dd306d282453428c609) @@ -32,6 +32,7 @@ using Ringtoets.MacroStabilityInwards.Data; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; using Ringtoets.MacroStabilityInwards.IO.SoilProfiles; +using Ringtoets.MacroStabilityInwards.IO.TestUtil; namespace Ringtoets.MacroStabilityInwards.IO.Test.SoilProfiles { @@ -103,8 +104,8 @@ public void Transform_StochasticSoilModelWithoutStochasticSoilProfiles_ThrowsImportedDataException() { // Setup - StochasticSoilModel stochasticSoilModel = StochasticSoilModelTestFactory.CreateStochasticSoilModelWithGeometry(FailureMechanismType.Stability, - Enumerable.Empty()); + StochasticSoilModel stochasticSoilModel = + MacroStabilityInwardsStochasticSoilModelTestFactory.CreateMacroStabilityInwardsStochasticSoilModelWithGeometry(Enumerable.Empty()); var transformer = new MacroStabilityInwardsStochasticSoilModelTransformer(); @@ -129,15 +130,14 @@ const double top = 4; var transformer = new MacroStabilityInwardsStochasticSoilModelTransformer(); - StochasticSoilModel soilModel = StochasticSoilModelTestFactory.CreateStochasticSoilModelWithGeometry("some name", - FailureMechanismType.Stability, - new[] - { - new StochasticSoilProfile(probability, new SoilProfile1D(2, "test", 3, new[] - { - SoilLayer1DTestFactory.CreateSoilLayer1DWithValidAquifer(top) - })) - }); + StochasticSoilModel soilModel = + MacroStabilityInwardsStochasticSoilModelTestFactory.CreateMacroStabilityInwardsStochasticSoilModelWithGeometry("some name", new[] + { + new StochasticSoilProfile(probability, new SoilProfile1D(2, "test", 3, new[] + { + SoilLayer1DTestFactory.CreateSoilLayer1DWithValidAquifer(top) + })) + }); // Call MacroStabilityInwardsStochasticSoilModel transformedModel = transformer.Transform(soilModel); @@ -170,14 +170,14 @@ double probability = random.NextDouble(); var transformer = new MacroStabilityInwardsStochasticSoilModelTransformer(); - StochasticSoilModel soilModel = StochasticSoilModelTestFactory.CreateStochasticSoilModelWithGeometry("some name", - FailureMechanismType.Stability, new[] - { - new StochasticSoilProfile(probability, new SoilProfile2D(2, "test", new[] - { - SoilLayer2DTestFactory.CreateSoilLayer2DWithValidAquifer() - }, Enumerable.Empty())) - }); + StochasticSoilModel soilModel = + MacroStabilityInwardsStochasticSoilModelTestFactory.CreateMacroStabilityInwardsStochasticSoilModelWithGeometry("some name", new[] + { + new StochasticSoilProfile(probability, new SoilProfile2D(2, "test", new[] + { + SoilLayer2DTestFactory.CreateSoilLayer2DWithValidAquifer() + }, Enumerable.Empty())) + }); // Call MacroStabilityInwardsStochasticSoilModel transformedModel = transformer.Transform(soilModel); @@ -222,12 +222,12 @@ layer }, Enumerable.Empty()); - StochasticSoilModel soilModel1 = StochasticSoilModelTestFactory.CreateStochasticSoilModelWithGeometry(FailureMechanismType.Stability, new[] + StochasticSoilModel soilModel1 = MacroStabilityInwardsStochasticSoilModelTestFactory.CreateMacroStabilityInwardsStochasticSoilModelWithGeometry(new[] { StochasticSoilProfileTestFactory.CreateStochasticSoilProfileWithValidProbability(profile) }); - StochasticSoilModel soilModel2 = StochasticSoilModelTestFactory.CreateStochasticSoilModelWithGeometry(FailureMechanismType.Stability, new[] + StochasticSoilModel soilModel2 = MacroStabilityInwardsStochasticSoilModelTestFactory.CreateMacroStabilityInwardsStochasticSoilModelWithGeometry(new[] { StochasticSoilProfileTestFactory.CreateStochasticSoilProfileWithValidProbability(profile) }); @@ -257,13 +257,12 @@ const string soilModelName = "name"; const double originalProfileOneProbability = 0.2; const double originalProfileTwoProbability = 0.7; - StochasticSoilModel soilModel = StochasticSoilModelTestFactory.CreateStochasticSoilModelWithGeometry(soilModelName, - FailureMechanismType.Stability, - new[] - { - new StochasticSoilProfile(originalProfileOneProbability, soilProfile), - new StochasticSoilProfile(originalProfileTwoProbability, soilProfile) - }); + StochasticSoilModel soilModel = + MacroStabilityInwardsStochasticSoilModelTestFactory.CreateMacroStabilityInwardsStochasticSoilModelWithGeometry(soilModelName, new[] + { + new StochasticSoilProfile(originalProfileOneProbability, soilProfile), + new StochasticSoilProfile(originalProfileTwoProbability, soilProfile) + }); var transformer = new MacroStabilityInwardsStochasticSoilModelTransformer(); MacroStabilityInwardsStochasticSoilModel transformed = null; @@ -293,8 +292,7 @@ new StochasticSoilProfile(0.9, soilProfile), new StochasticSoilProfile(0.9, soilProfile) }; - StochasticSoilModel soilModel = StochasticSoilModelTestFactory.CreateStochasticSoilModelWithGeometry(FailureMechanismType.Stability, - stochasticSoilProfiles); + StochasticSoilModel soilModel = MacroStabilityInwardsStochasticSoilModelTestFactory.CreateMacroStabilityInwardsStochasticSoilModelWithGeometry(stochasticSoilProfiles); var transformer = new MacroStabilityInwardsStochasticSoilModelTransformer(); @@ -314,14 +312,12 @@ public void Transform_ValidStochasticSoilModelWithProfileInvalidProbability_ThrowsImportedDataException(StochasticSoilProfile profile) { // Setup - const string soilModelName = "name"; + StochasticSoilModel soilModel = + MacroStabilityInwardsStochasticSoilModelTestFactory.CreateMacroStabilityInwardsStochasticSoilModelWithGeometry(new[] + { + profile + }); - StochasticSoilModel soilModel = StochasticSoilModelTestFactory.CreateStochasticSoilModelWithGeometry(soilModelName, - FailureMechanismType.Stability, new[] - { - profile - }); - var transformer = new MacroStabilityInwardsStochasticSoilModelTransformer(); // Call @@ -357,7 +353,7 @@ }); var stochasticSoilProfile1D = new StochasticSoilProfile(random.NextDouble(), soilProfile1D); - StochasticSoilModel soilModel = StochasticSoilModelTestFactory.CreateStochasticSoilModelWithGeometry(FailureMechanismType.Stability, new[] + StochasticSoilModel soilModel = MacroStabilityInwardsStochasticSoilModelTestFactory.CreateMacroStabilityInwardsStochasticSoilModelWithGeometry(new[] { stochasticSoilProfile2D, stochasticSoilProfile1D Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.TestUtil.Test/MacroStabilityInwardsStochasticSoilModelTestFactoryTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.TestUtil.Test/MacroStabilityInwardsStochasticSoilModelTestFactoryTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.TestUtil.Test/MacroStabilityInwardsStochasticSoilModelTestFactoryTest.cs (revision 30b4bd298c03a8c2162f5dd306d282453428c609) @@ -0,0 +1,97 @@ +// 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 Core.Common.Base.Geometry; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.IO.SoilProfile; +using Ringtoets.Common.IO.SoilProfile.Schema; + +namespace Ringtoets.MacroStabilityInwards.IO.TestUtil.Test +{ + [TestFixture] + public class MacroStabilityInwardsStochasticSoilModelTestFactoryTest + { + [Test] + public void CreateMacroStabilityInwardsStochasticSoilModelWithGeometry_WithNameAndStochasticSoilProfiles_ReturnsStochasticSoilModelWithExpectedPropertiesSet() + { + // Setup + const string soilModelName = "some name"; + + var random = new Random(21); + + var mocks = new MockRepository(); + var soilProfile = mocks.Stub(); + mocks.ReplayAll(); + + var stochasticSoilProfiles = new[] + { + new StochasticSoilProfile(random.NextDouble(), soilProfile) + }; + + // Call + StochasticSoilModel model = + MacroStabilityInwardsStochasticSoilModelTestFactory.CreateMacroStabilityInwardsStochasticSoilModelWithGeometry(soilModelName, + stochasticSoilProfiles); + + // Assert + Assert.AreEqual(soilModelName, model.Name); + Assert.AreEqual(FailureMechanismType.Stability, model.FailureMechanismType); + CollectionAssert.AreEqual(stochasticSoilProfiles, model.StochasticSoilProfiles); + CollectionAssert.AreEqual(new[] + { + new Point2D(1, 2), + new Point2D(3, 4) + }, model.Geometry); + } + + [Test] + public void CreateMacroStabilityInwardsStochasticSoilModelWithGeometry_WithStochasticSoilProfiles_ReturnsStochasticSoilModelWithExpectedPropertiesSet() + { + // Setup + var random = new Random(21); + + var mocks = new MockRepository(); + var soilProfile = mocks.Stub(); + mocks.ReplayAll(); + + var stochasticSoilProfiles = new[] + { + new StochasticSoilProfile(random.NextDouble(), soilProfile) + }; + + // Call + StochasticSoilModel model = + MacroStabilityInwardsStochasticSoilModelTestFactory.CreateMacroStabilityInwardsStochasticSoilModelWithGeometry(stochasticSoilProfiles); + + // Assert + Assert.AreEqual("Macro Stability Inwards Stochastic Soil Model", model.Name); + Assert.AreEqual(FailureMechanismType.Stability, model.FailureMechanismType); + CollectionAssert.AreEqual(stochasticSoilProfiles, model.StochasticSoilProfiles); + CollectionAssert.AreEqual(new[] + { + new Point2D(1, 2), + new Point2D(3, 4) + }, model.Geometry); + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.TestUtil.Test/Ringtoets.MacroStabilityInwards.IO.TestUtil.Test.csproj =================================================================== diff -u -rdd560ccdd00ae08ac2b5afad2cf300942f24d55e -r30b4bd298c03a8c2162f5dd306d282453428c609 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.TestUtil.Test/Ringtoets.MacroStabilityInwards.IO.TestUtil.Test.csproj (.../Ringtoets.MacroStabilityInwards.IO.TestUtil.Test.csproj) (revision dd560ccdd00ae08ac2b5afad2cf300942f24d55e) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.TestUtil.Test/Ringtoets.MacroStabilityInwards.IO.TestUtil.Test.csproj (.../Ringtoets.MacroStabilityInwards.IO.TestUtil.Test.csproj) (revision 30b4bd298c03a8c2162f5dd306d282453428c609) @@ -37,6 +37,14 @@ none + + ..\..\..\..\packages\NUnit.3.8.1\lib\net40\nunit.framework.dll + True + + + ..\..\..\..\packages\RhinoMocks.3.6.1\lib\net\Rhino.Mocks.dll + True + @@ -46,12 +54,32 @@ GlobalAssembly.cs + Copying.licenseheader + + + + {3BBFD65B-B277-4E50-AE6D-BD24C3434609} + Core.Common.Base + + + {52BA7627-CBAB-4209-BE77-3B5F31378277} + Ringtoets.Common.IO + + + {33508d7c-1602-4c0d-8503-73aae98c19e5} + Ringtoets.Common.IO.TestUtil + + + {c83b2091-339a-4f35-a874-a4c807f55cae} + Ringtoets.MacroStabilityInwards.IO.TestUtil + +