Index: Ringtoets.sln =================================================================== diff -u -rff06d226982b6cf8fb15fd087598d2eae377fd21 -rd037959013b6997c5edc0b2f8c6b55a92c4e4ced --- Ringtoets.sln (.../Ringtoets.sln) (revision ff06d226982b6cf8fb15fd087598d2eae377fd21) +++ Ringtoets.sln (.../Ringtoets.sln) (revision d037959013b6997c5edc0b2f8c6b55a92c4e4ced) @@ -1182,7 +1182,7 @@ {C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ringtoets.Piping.Integration.TestUtils", "Ringtoets\Piping\test\Ringtoets.Piping.Integration.TestUtils\Ringtoets.Piping.Integration.TestUtils.csproj", "{A4972765-DDBB-4A1E-B17C-7185577E5591}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ringtoets.Piping.Integration.TestUtil", "Ringtoets\Piping\test\Ringtoets.Piping.Integration.TestUtil\Ringtoets.Piping.Integration.TestUtil.csproj", "{A4972765-DDBB-4A1E-B17C-7185577E5591}" ProjectSection(ProjectDependencies) = postProject {C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC} EndProjectSection @@ -1393,7 +1393,7 @@ {C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ringtoets.Piping.Integration.TestUtils.Test", "Ringtoets\Piping\test\Ringtoets.Piping.Integration.TestUtils.Test\Ringtoets.Piping.Integration.TestUtils.Test.csproj", "{070DC87D-520B-4A84-8965-ED5012875FCC}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ringtoets.Piping.Integration.TestUtil.Test", "Ringtoets\Piping\test\Ringtoets.Piping.Integration.TestUtil.Test\Ringtoets.Piping.Integration.TestUtil.Test.csproj", "{070DC87D-520B-4A84-8965-ED5012875FCC}" ProjectSection(ProjectDependencies) = postProject {C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC} EndProjectSection @@ -1584,12 +1584,12 @@ {C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ringtoets.MacroStabilityInwards.Integration.TestUtils", "Ringtoets\MacroStabilityInwards\test\Ringtoets.MacroStabilityInwards.Integration.TestUtils\Ringtoets.MacroStabilityInwards.Integration.TestUtils.csproj", "{FC576B83-0FB4-49C1-AE53-47FF9779110F}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ringtoets.MacroStabilityInwards.Integration.TestUtil", "Ringtoets\MacroStabilityInwards\test\Ringtoets.MacroStabilityInwards.Integration.TestUtil\Ringtoets.MacroStabilityInwards.Integration.TestUtil.csproj", "{FC576B83-0FB4-49C1-AE53-47FF9779110F}" ProjectSection(ProjectDependencies) = postProject {C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ringtoets.MacroStabilityInwards.Integration.TestUtils.Test", "Ringtoets\MacroStabilityInwards\test\Ringtoets.MacroStabilityInwards.Integration.TestUtils.Test\Ringtoets.MacroStabilityInwards.Integration.TestUtils.Test.csproj", "{371F39A4-B48D-4298-A7F9-53BABB55DE03}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ringtoets.MacroStabilityInwards.Integration.TestUtil.Test", "Ringtoets\MacroStabilityInwards\test\Ringtoets.MacroStabilityInwards.Integration.TestUtil.Test\Ringtoets.MacroStabilityInwards.Integration.TestUtil.Test.csproj", "{371F39A4-B48D-4298-A7F9-53BABB55DE03}" ProjectSection(ProjectDependencies) = postProject {C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC} EndProjectSection Index: Ringtoets/Integration/test/Ringtoets.Integration.TestUtils.Test/Ringtoets.Integration.TestUtils.Test.csproj =================================================================== diff -u -r650fc7b43cb6729baee51d079f0377df8d7a3de9 -rd037959013b6997c5edc0b2f8c6b55a92c4e4ced --- Ringtoets/Integration/test/Ringtoets.Integration.TestUtils.Test/Ringtoets.Integration.TestUtils.Test.csproj (.../Ringtoets.Integration.TestUtils.Test.csproj) (revision 650fc7b43cb6729baee51d079f0377df8d7a3de9) +++ Ringtoets/Integration/test/Ringtoets.Integration.TestUtils.Test/Ringtoets.Integration.TestUtils.Test.csproj (.../Ringtoets.Integration.TestUtils.Test.csproj) (revision d037959013b6997c5edc0b2f8c6b55a92c4e4ced) @@ -108,7 +108,7 @@ {14C6F716-64E2-4BC4-A1EF-05865FCEFA4C} Ringtoets.Piping.Primitives - + {A4972765-DDBB-4A1E-B17C-7185577E5591} Ringtoets.Piping.Integration.TestUtils Index: Ringtoets/Integration/test/Ringtoets.Integration.TestUtils/Ringtoets.Integration.TestUtils.csproj =================================================================== diff -u -r650fc7b43cb6729baee51d079f0377df8d7a3de9 -rd037959013b6997c5edc0b2f8c6b55a92c4e4ced --- Ringtoets/Integration/test/Ringtoets.Integration.TestUtils/Ringtoets.Integration.TestUtils.csproj (.../Ringtoets.Integration.TestUtils.csproj) (revision 650fc7b43cb6729baee51d079f0377df8d7a3de9) +++ Ringtoets/Integration/test/Ringtoets.Integration.TestUtils/Ringtoets.Integration.TestUtils.csproj (.../Ringtoets.Integration.TestUtils.csproj) (revision d037959013b6997c5edc0b2f8c6b55a92c4e4ced) @@ -151,7 +151,7 @@ {14c6f716-64e2-4bc4-a1ef-05865fcefa4c} Ringtoets.Piping.Primitives - + {a4972765-ddbb-4a1e-b17c-7185577e5591} Ringtoets.Piping.Integration.TestUtils Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Ringtoets.MacroStabilityInwards.IO.Test.csproj =================================================================== diff -u -rf03b47d0d73983de35188874a094ae07f1ea13fa -rd037959013b6997c5edc0b2f8c6b55a92c4e4ced --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Ringtoets.MacroStabilityInwards.IO.Test.csproj (.../Ringtoets.MacroStabilityInwards.IO.Test.csproj) (revision f03b47d0d73983de35188874a094ae07f1ea13fa) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Ringtoets.MacroStabilityInwards.IO.Test.csproj (.../Ringtoets.MacroStabilityInwards.IO.Test.csproj) (revision d037959013b6997c5edc0b2f8c6b55a92c4e4ced) @@ -140,9 +140,9 @@ {2b78cf04-4785-4f27-a6e5-45bddbb7bf04} Ringtoets.MacroStabilityInwards.Data.TestUtil - + {fc576b83-0fb4-49c1-ae53-47ff9779110f} - Ringtoets.MacroStabilityInwards.Integration.TestUtils + Ringtoets.MacroStabilityInwards.Integration.TestUtil {24c46a06-c6b0-4601-9f30-b3108b0df3a8} Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtil.Test/MacroStabilityInwardsTestDataGeneratorTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtil.Test/MacroStabilityInwardsTestDataGeneratorTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtil.Test/MacroStabilityInwardsTestDataGeneratorTest.cs (revision d037959013b6997c5edc0b2f8c6b55a92c4e4ced) @@ -0,0 +1,230 @@ +// 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.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.MacroStabilityInwards.Data; + +namespace Ringtoets.MacroStabilityInwards.Integration.TestUtils.Test +{ + [TestFixture] + public class MacroStabilityInwardsTestDataGeneratorTest + { + [Test] + public void GetMacroStabilityInwardsFailureMechanismWithAllCalculationConfigurations_ReturnsFailureMechanismWithAllConfigurations() + { + // Call + MacroStabilityInwardsFailureMechanism failureMechanism = MacroStabilityInwardsTestDataGenerator.GetMacroStabilityInwardsFailureMechanismWithAllCalculationConfigurations(); + + // Assert + MacroStabilityInwardsTestDataGeneratorHelper.AssertHasStochasticSoilModels(failureMechanism); + MacroStabilityInwardsTestDataGeneratorHelper.AssertHasSurfaceLines(failureMechanism); + MacroStabilityInwardsTestDataGeneratorHelper.AssertHasAllPossibleCalculationConfigurationsWithOutputs(failureMechanism); + MacroStabilityInwardsTestDataGeneratorHelper.AssertHasAllPossibleCalculationConfigurationsWithoutOutputs(failureMechanism); + } + + [Test] + public void ConfigureFailureMechanismWithAllCalculationConfigurations_ReturnsFailureMechanismWithAllConfigurations() + { + // Setup + var failureMechanism = new MacroStabilityInwardsFailureMechanism(); + HydraulicBoundaryLocation hydraulicBoundaryLocation = TestHydraulicBoundaryLocation.CreateFullyCalculated(); + + // Call + MacroStabilityInwardsTestDataGenerator.ConfigureFailureMechanismWithAllCalculationConfigurations(failureMechanism, hydraulicBoundaryLocation); + + // Assert + MacroStabilityInwardsTestDataGeneratorHelper.AssertHasStochasticSoilModels(failureMechanism); + MacroStabilityInwardsTestDataGeneratorHelper.AssertHasSurfaceLines(failureMechanism); + MacroStabilityInwardsTestDataGeneratorHelper.AssertHasAllPossibleCalculationConfigurationsWithOutputs(failureMechanism); + MacroStabilityInwardsTestDataGeneratorHelper.AssertHasAllPossibleCalculationConfigurationsWithoutOutputs(failureMechanism); + + AssertCalculationsHasSameHydraulicBoundaryLocation(failureMechanism.CalculationsGroup, hydraulicBoundaryLocation); + + CalculationGroup nestedCalculationGroup = failureMechanism.CalculationsGroup.Children.OfType().First(); + AssertCalculationsHasSameHydraulicBoundaryLocation(nestedCalculationGroup, hydraulicBoundaryLocation); + } + + [Test] + public void GetMacroStabilityInwardsCalculation_Always_ReturnCalculationWithDataSet() + { + // Call + MacroStabilityInwardsCalculation calculation = MacroStabilityInwardsTestDataGenerator.GetMacroStabilityInwardsCalculation(); + + // Assert + AssertCalculation(calculation); + } + + [Test] + public void GetMacroStabilityInwardsCalculationWithoutHydraulicLocationAndAssessmentLevel_Always_ReturnCalculationWithoutHydraulicLocationAndAssessmentLevel() + { + // Call + MacroStabilityInwardsCalculation calculation = MacroStabilityInwardsTestDataGenerator.GetMacroStabilityInwardsCalculationWithoutHydraulicLocationAndAssessmentLevel(); + + // Assert + AssertCalculation(calculation, false); + } + + [Test] + public void GetMacroStabilityInwardsCalculationWithAssessmentLevel_Always_ReturnCalculationWithAssessmentLevel() + { + // Call + MacroStabilityInwardsCalculation calculation = MacroStabilityInwardsTestDataGenerator.GetMacroStabilityInwardsCalculationWithAssessmentLevel(); + + // Assert + AssertCalculation(calculation, false, true); + } + + [Test] + public void GetMacroStabilityInwardsCalculationWithoutSurfaceLine_Always_ReturnCalculationWithoutSurfaceLine() + { + // Call + MacroStabilityInwardsCalculation calculation = MacroStabilityInwardsTestDataGenerator.GetMacroStabilityInwardsCalculationWithoutSurfaceLine(); + + // Assert + AssertCalculation(calculation, true, false, false); + } + + [Test] + public void GetMacroStabilityInwardsCalculationWithoutSoilModel_Always_ReturnCalculationWithoutSoilModel() + { + // Call + MacroStabilityInwardsCalculation calculation = MacroStabilityInwardsTestDataGenerator.GetMacroStabilityInwardsCalculationWithoutSoilModel(); + + // Assert + AssertCalculation(calculation, true, false, true, false); + } + + [Test] + public void GetMacroStabilityInwardsCalculationWithoutSoilProfile_Always_ReturnCalculationWithoutSoilProfile() + { + // Call + MacroStabilityInwardsCalculation calculation = MacroStabilityInwardsTestDataGenerator.GetMacroStabilityInwardsCalculationWithoutSoilProfile(); + + // Assert + AssertCalculation(calculation, true, false, true, true, false); + } + + [Test] + public void GetMacroStabilityInwardsCalculationWithNaNs_Always_ReturnCalculationWithNaNs() + { + // Call + MacroStabilityInwardsCalculation calculation = MacroStabilityInwardsTestDataGenerator.GetMacroStabilityInwardsCalculationWithNaNs(); + + // Assert + Assert.AreEqual("PK001_0001 W1-6_0_1D1", calculation.Name); + Assert.AreEqual(double.NaN, calculation.InputParameters.AssessmentLevel.Value); + Assert.AreEqual("PK001_0001", calculation.InputParameters.SurfaceLine.Name); + Assert.AreEqual("PK001_0001_Macrostabiliteit", calculation.InputParameters.StochasticSoilModel.Name); + Assert.AreEqual("W1-6_0_1D1", calculation.InputParameters.StochasticSoilProfile.SoilProfile.Name); + } + + [Test] + public void GetMacroStabilityInwardsCalculationWithInfinities_Always_ReturnCalculationWithInfinities() + { + // Call + MacroStabilityInwardsCalculation calculation = MacroStabilityInwardsTestDataGenerator.GetMacroStabilityInwardsCalculationWithInfinities(); + + // Assert + Assert.AreEqual("PK001_0001 W1-6_0_1D1", calculation.Name); + Assert.AreEqual(double.NegativeInfinity, calculation.InputParameters.AssessmentLevel.Value); + Assert.AreEqual("PK001_0001", calculation.InputParameters.SurfaceLine.Name); + Assert.AreEqual("PK001_0001_Macrostabiliteit", calculation.InputParameters.StochasticSoilModel.Name); + Assert.AreEqual("W1-6_0_1D1", calculation.InputParameters.StochasticSoilProfile.SoilProfile.Name); + } + + private static void AssertCalculation(MacroStabilityInwardsCalculation calculation, + bool hasHydraulicLocation = true, + bool hasAssessmentLevel = false, + bool hasSurfaceLine = true, + bool hasSoilModel = true, + bool hasSoilProfile = true) + { + Assert.AreEqual("PK001_0001 W1-6_0_1D1", calculation.Name); + + if (hasHydraulicLocation) + { + Assert.AreEqual(1, calculation.InputParameters.HydraulicBoundaryLocation.Id); + Assert.AreEqual("PUNT_KAT_18", calculation.InputParameters.HydraulicBoundaryLocation.Name); + } + else + { + Assert.IsNull(calculation.InputParameters.HydraulicBoundaryLocation); + } + + if (hasAssessmentLevel) + { + Assert.IsNull(calculation.InputParameters.HydraulicBoundaryLocation); + Assert.IsTrue(calculation.InputParameters.UseAssessmentLevelManualInput); + Assert.AreEqual(3, calculation.InputParameters.AssessmentLevel.Value); + } + + if (hasSurfaceLine) + { + Assert.AreEqual("PK001_0001", calculation.InputParameters.SurfaceLine.Name); + } + else + { + Assert.IsNull(calculation.InputParameters.SurfaceLine); + } + + if (hasSoilModel) + { + Assert.AreEqual(1, calculation.InputParameters.StochasticSoilModel.Id); + Assert.AreEqual("PK001_0001_Macrostabiliteit", calculation.InputParameters.StochasticSoilModel.Name); + + if (hasSoilProfile) + { + Assert.IsNotNull(calculation.InputParameters.StochasticSoilProfile); + Assert.AreEqual("W1-6_0_1D1", calculation.InputParameters.StochasticSoilProfile.SoilProfile.Name); + Assert.AreEqual(1, calculation.InputParameters.StochasticSoilProfile.SoilProfile.Layers.Count()); + } + else + { + Assert.IsNull(calculation.InputParameters.StochasticSoilProfile); + } + } + else + { + Assert.IsNull(calculation.InputParameters.StochasticSoilModel); + Assert.IsNull(calculation.InputParameters.StochasticSoilProfile); + } + } + + private static void AssertCalculationsHasSameHydraulicBoundaryLocation(CalculationGroup calculationGroup, + HydraulicBoundaryLocation hydraulicBoundaryLocation) + { + IEnumerable calculationsWithHydraulicBoundaryLocation = + calculationGroup.Children + .OfType() + .Where(calc => calc.InputParameters.HydraulicBoundaryLocation != null); + + foreach (MacroStabilityInwardsCalculation calculation in calculationsWithHydraulicBoundaryLocation) + { + Assert.AreSame(hydraulicBoundaryLocation, calculation.InputParameters.HydraulicBoundaryLocation); + } + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtil.Test/Properties/AssemblyInfo.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtil.Test/Properties/AssemblyInfo.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtil.Test/Properties/AssemblyInfo.cs (revision d037959013b6997c5edc0b2f8c6b55a92c4e4ced) @@ -0,0 +1,27 @@ +// 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.Reflection; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Ringtoets.MacroStabilityInwards.Integration.TestUtils.Test")] +[assembly: AssemblyProduct("Ringtoets.MacroStabilityInwards.Integration.TestUtils.Test")] +[assembly: Guid("cf7c2e5c-3762-4929-b2c2-566dd01adfd7")] \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtil.Test/Ringtoets.MacroStabilityInwards.Integration.TestUtil.Test.csproj =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtil.Test/Ringtoets.MacroStabilityInwards.Integration.TestUtil.Test.csproj (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtil.Test/Ringtoets.MacroStabilityInwards.Integration.TestUtil.Test.csproj (revision d037959013b6997c5edc0b2f8c6b55a92c4e4ced) @@ -0,0 +1,96 @@ + + + + Debug + x86 + {371F39A4-B48D-4298-A7F9-53BABB55DE03} + Library + Properties + Ringtoets.MacroStabilityInwards.Integration.TestUtil.Test + Ringtoets.MacroStabilityInwards.Integration.TestUtil.Test + v4.0 + 512 + + + true + bin\Debug\ + DEBUG;TRACE + full + x86 + prompt + MinimumRecommendedRules.ruleset + + + bin\Release\ + TRACE + true + none + x86 + prompt + MinimumRecommendedRules.ruleset + + + bin\ReleaseForCodeCoverage\ + TRACE + true + none + x86 + prompt + MinimumRecommendedRules.ruleset + + + + ..\..\..\..\packages\NUnit.3.6.0\lib\net40\nunit.framework.dll + True + + + + + + + Properties\GlobalAssembly.cs + + + + + + + Copying.licenseheader + + + + + + {3bbfd65b-b277-4e50-ae6d-bd24c3434609} + Core.Common.Base + + + {D4200F43-3F72-4F42-AF0A-8CED416A38EC} + Ringtoets.Common.Data + + + {4843d6e5-066f-4795-94f5-1d53932dd03c} + Ringtoets.Common.Data.TestUtil + + + {83d6b73e-91d5-46b0-9218-955da1f75f7c} + Ringtoets.MacroStabilityInwards.Data + + + {e9b39743-2dc9-4922-9e0f-6ba3e0e54189} + Ringtoets.MacroStabilityInwards.Primitives + + + {fc576b83-0fb4-49c1-ae53-47ff9779110f} + Ringtoets.MacroStabilityInwards.Integration.TestUtil + + + + + \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtil.Test/packages.config =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtil.Test/packages.config (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtil.Test/packages.config (revision d037959013b6997c5edc0b2f8c6b55a92c4e4ced) @@ -0,0 +1,25 @@ + + + + \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtil/MacroStabilityInwardsTestDataGenerator.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtil/MacroStabilityInwardsTestDataGenerator.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtil/MacroStabilityInwardsTestDataGenerator.cs (revision d037959013b6997c5edc0b2f8c6b55a92c4e4ced) @@ -0,0 +1,362 @@ +// 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.Data; +using Core.Common.Base.Geometry; +using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.MacroStabilityInwards.Data; +using Ringtoets.MacroStabilityInwards.Data.TestUtil; +using Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil; +using Ringtoets.MacroStabilityInwards.Primitives; + +namespace Ringtoets.MacroStabilityInwards.Integration.TestUtils +{ + /// + /// Class responsible for generating test data configurations. + /// + public static class MacroStabilityInwardsTestDataGenerator + { + /// + /// Gets a fully configured with all + /// possible parent and nested calculation configurations. + /// + public static MacroStabilityInwardsFailureMechanism GetMacroStabilityInwardsFailureMechanismWithAllCalculationConfigurations() + { + var failureMechanism = new MacroStabilityInwardsFailureMechanism(); + var hydroLocation = new HydraulicBoundaryLocation(1, "", 0, 0); + ConfigureFailureMechanismWithAllCalculationConfigurations(failureMechanism, hydroLocation); + + return failureMechanism; + } + + /// + /// Gets a without hydraulic boundary location or design water level. + /// + /// A without hydraulic boundary location or design water level. + public static MacroStabilityInwardsCalculation GetMacroStabilityInwardsCalculationWithoutHydraulicLocationAndAssessmentLevel() + { + MacroStabilityInwardsCalculation calculation = GetMacroStabilityInwardsCalculation(); + calculation.InputParameters.HydraulicBoundaryLocation = null; + + return calculation; + } + + /// + /// Gets a with manual design water level set. + /// + /// A with a manual design water level. + public static MacroStabilityInwardsCalculation GetMacroStabilityInwardsCalculationWithAssessmentLevel() + { + MacroStabilityInwardsCalculation calculation = GetMacroStabilityInwardsCalculation(); + calculation.InputParameters.UseAssessmentLevelManualInput = true; + calculation.InputParameters.AssessmentLevel = (RoundedDouble) 3.0; + + return calculation; + } + + /// + /// Gets a without surface line. + /// + /// A without surface line. + public static MacroStabilityInwardsCalculation GetMacroStabilityInwardsCalculationWithoutSurfaceLine() + { + MacroStabilityInwardsCalculation calculation = GetMacroStabilityInwardsCalculation(); + calculation.InputParameters.SurfaceLine = null; + + return calculation; + } + + /// + /// Gets a without soil model. + /// + /// A without soil model . + public static MacroStabilityInwardsCalculation GetMacroStabilityInwardsCalculationWithoutSoilModel() + { + MacroStabilityInwardsCalculation calculation = GetMacroStabilityInwardsCalculation(); + calculation.InputParameters.StochasticSoilModel = null; + calculation.InputParameters.StochasticSoilProfile = null; + + return calculation; + } + + /// + /// Gets a without soil profile. + /// + /// A without soil profile. + public static MacroStabilityInwardsCalculation GetMacroStabilityInwardsCalculationWithoutSoilProfile() + { + MacroStabilityInwardsCalculation calculation = GetMacroStabilityInwardsCalculation(); + calculation.InputParameters.StochasticSoilProfile = null; + + return calculation; + } + + /// + /// Gets a . + /// + /// A . + public static MacroStabilityInwardsCalculation GetMacroStabilityInwardsCalculation() + { + var surfaceline = new RingtoetsMacroStabilityInwardsSurfaceLine + { + ReferenceLineIntersectionWorldPoint = new Point2D(0, 5), + Name = "PK001_0001" + }; + surfaceline.SetGeometry(new[] + { + new Point3D(0, 0, 0), + new Point3D(0, 10, 0) + }); + + var calculation = new MacroStabilityInwardsCalculation(new GeneralMacroStabilityInwardsInput()) + { + Name = "PK001_0001 W1-6_0_1D1", + InputParameters = + { + HydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "PUNT_KAT_18", 0, 0), + SurfaceLine = surfaceline, + StochasticSoilModel = new StochasticSoilModel(1, "PK001_0001_Macrostabiliteit", string.Empty), + StochasticSoilProfile = new StochasticSoilProfile(0, SoilProfileType.SoilProfile1D, 0) + { + SoilProfile = new MacroStabilityInwardsSoilProfile("W1-6_0_1D1", 0, new[] + { + new MacroStabilityInwardsSoilLayer(0) + }, SoilProfileType.SoilProfile1D, 0) + } + } + }; + + return calculation; + } + + /// + /// Gets a with double.NaN values set. + /// + /// A with double.NaN values. + public static MacroStabilityInwardsCalculation GetMacroStabilityInwardsCalculationWithNaNs() + { + MacroStabilityInwardsCalculation calculation = GetMacroStabilityInwardsCalculationWithAssessmentLevel(); + calculation.InputParameters.AssessmentLevel = RoundedDouble.NaN; + + return calculation; + } + + /// + /// Gets a with double.NegativeInfinity and double.PositiveInfinity values set. + /// + /// A with double.NegativeInfinity and double.PositiveInfinity values. + public static MacroStabilityInwardsCalculation GetMacroStabilityInwardsCalculationWithInfinities() + { + MacroStabilityInwardsCalculation calculation = GetMacroStabilityInwardsCalculationWithAssessmentLevel(); + + calculation.InputParameters.SurfaceLine.SetGeometry(new[] + { + new Point3D(0, double.NegativeInfinity, 0), + new Point3D(0, double.PositiveInfinity, 0) + }); + + calculation.InputParameters.AssessmentLevel = (RoundedDouble) double.NegativeInfinity; + + return calculation; + } + + /// + /// Configures a to a fully configured failure + /// mechanism with all possible parent and nested calculation configurations. + /// + /// The failure mechanism to be updated. + /// The hydraulic boundary location used + /// by calculations. + /// This method assumes is a newly + /// created instance. + public static void ConfigureFailureMechanismWithAllCalculationConfigurations(MacroStabilityInwardsFailureMechanism failureMechanism, + HydraulicBoundaryLocation hydraulicBoundaryLocation) + { + var surfaceline1 = new RingtoetsMacroStabilityInwardsSurfaceLine + { + ReferenceLineIntersectionWorldPoint = new Point2D(0, 5), + Name = "Line A" + }; + surfaceline1.SetGeometry(new[] + { + new Point3D(0, 0, 0), + new Point3D(0, 10, 0) + }); + var surfaceline2 = new RingtoetsMacroStabilityInwardsSurfaceLine + { + ReferenceLineIntersectionWorldPoint = new Point2D(10, 5), + Name = "Line B" + }; + surfaceline2.SetGeometry(new[] + { + new Point3D(10, 0, 0), + new Point3D(10, 10, 0) + }); + + failureMechanism.SurfaceLines.AddRange(new[] + { + surfaceline1, + surfaceline2 + }, "some/path/to/surfacelines"); + var stochasticSoilModel1 = new StochasticSoilModel(1, "A", "B") + { + Geometry = + { + new Point2D(-5, 5), + new Point2D(5, 5) + }, + StochasticSoilProfiles = + { + new StochasticSoilProfile(1.0, SoilProfileType.SoilProfile1D, 1) + } + }; + var stochasticSoilModel2 = new StochasticSoilModel(2, "C", "D") + { + Geometry = + { + new Point2D(5, 5), + new Point2D(15, 5) + }, + StochasticSoilProfiles = + { + new StochasticSoilProfile(1.0, SoilProfileType.SoilProfile2D, 2) + } + }; + + failureMechanism.StochasticSoilModels.AddRange(new[] + { + stochasticSoilModel1, + stochasticSoilModel2 + }, "some/path/to/stochasticsoilmodels"); + + var calculation = new MacroStabilityInwardsCalculationScenario(new GeneralMacroStabilityInwardsInput()); + var calculationWithOutput = new MacroStabilityInwardsCalculationScenario(new GeneralMacroStabilityInwardsInput()) + { + InputParameters = + { + HydraulicBoundaryLocation = hydraulicBoundaryLocation, + SurfaceLine = surfaceline1, + StochasticSoilModel = stochasticSoilModel1 + }, + Output = new TestMacroStabilityInwardsOutput(), + SemiProbabilisticOutput = new TestMacroStabilityInwardsSemiProbabilisticOutput() + }; + var calculationWithSurfaceLineAndSoilModel = new MacroStabilityInwardsCalculationScenario(new GeneralMacroStabilityInwardsInput()) + { + InputParameters = + { + HydraulicBoundaryLocation = hydraulicBoundaryLocation, + SurfaceLine = surfaceline1, + StochasticSoilModel = stochasticSoilModel1, + StochasticSoilProfile = stochasticSoilModel1.StochasticSoilProfiles[0] + } + }; + var calculationWithOutputAndHydraulicBoundaryLocation = new MacroStabilityInwardsCalculationScenario(new GeneralMacroStabilityInwardsInput()) + { + InputParameters = + { + HydraulicBoundaryLocation = hydraulicBoundaryLocation, + SurfaceLine = surfaceline2, + StochasticSoilModel = stochasticSoilModel2 + }, + Output = new TestMacroStabilityInwardsOutput(), + SemiProbabilisticOutput = new TestMacroStabilityInwardsSemiProbabilisticOutput() + }; + var calculationWithHydraulicBoundaryLocation = new MacroStabilityInwardsCalculationScenario(new GeneralMacroStabilityInwardsInput()) + { + InputParameters = + { + HydraulicBoundaryLocation = hydraulicBoundaryLocation + } + }; + var calculationWithSurfaceLineAndStochasticSoilModel = new MacroStabilityInwardsCalculationScenario(new GeneralMacroStabilityInwardsInput()) + { + InputParameters = + { + SurfaceLine = surfaceline1, + StochasticSoilModel = stochasticSoilModel2, + StochasticSoilProfile = stochasticSoilModel2.StochasticSoilProfiles[0] + } + }; + + var subCalculation = new MacroStabilityInwardsCalculationScenario(new GeneralMacroStabilityInwardsInput()); + var subCalculationWithOutput = new MacroStabilityInwardsCalculationScenario(new GeneralMacroStabilityInwardsInput()) + { + InputParameters = + { + HydraulicBoundaryLocation = hydraulicBoundaryLocation, + SurfaceLine = surfaceline2, + StochasticSoilModel = stochasticSoilModel2, + StochasticSoilProfile = stochasticSoilModel2.StochasticSoilProfiles[0] + }, + Output = new TestMacroStabilityInwardsOutput(), + SemiProbabilisticOutput = new TestMacroStabilityInwardsSemiProbabilisticOutput() + }; + var subCalculationWithOutputAndHydraulicBoundaryLocation = new MacroStabilityInwardsCalculationScenario(new GeneralMacroStabilityInwardsInput()) + { + InputParameters = + { + HydraulicBoundaryLocation = hydraulicBoundaryLocation, + SurfaceLine = surfaceline1, + StochasticSoilModel = stochasticSoilModel1, + StochasticSoilProfile = stochasticSoilModel1.StochasticSoilProfiles[0] + }, + Output = new TestMacroStabilityInwardsOutput(), + SemiProbabilisticOutput = new TestMacroStabilityInwardsSemiProbabilisticOutput() + }; + var subCalculationWithHydraulicBoundaryLocation = new MacroStabilityInwardsCalculationScenario(new GeneralMacroStabilityInwardsInput()) + { + InputParameters = + { + HydraulicBoundaryLocation = hydraulicBoundaryLocation + } + }; + var subCalculationWithSurfaceLineAndStochasticSoilModel = new MacroStabilityInwardsCalculationScenario(new GeneralMacroStabilityInwardsInput()) + { + InputParameters = + { + SurfaceLine = surfaceline1, + StochasticSoilModel = stochasticSoilModel2, + StochasticSoilProfile = stochasticSoilModel2.StochasticSoilProfiles[0] + } + }; + + failureMechanism.CalculationsGroup.Children.Add(calculation); + failureMechanism.CalculationsGroup.Children.Add(calculationWithOutput); + failureMechanism.CalculationsGroup.Children.Add(calculationWithSurfaceLineAndSoilModel); + failureMechanism.CalculationsGroup.Children.Add(calculationWithOutputAndHydraulicBoundaryLocation); + failureMechanism.CalculationsGroup.Children.Add(calculationWithSurfaceLineAndStochasticSoilModel); + failureMechanism.CalculationsGroup.Children.Add(calculationWithHydraulicBoundaryLocation); + failureMechanism.CalculationsGroup.Children.Add(new CalculationGroup + { + Children = + { + subCalculation, + subCalculationWithOutput, + subCalculationWithOutputAndHydraulicBoundaryLocation, + subCalculationWithHydraulicBoundaryLocation, + subCalculationWithSurfaceLineAndStochasticSoilModel + } + }); + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtil/MacroStabilityInwardsTestDataGeneratorHelper.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtil/MacroStabilityInwardsTestDataGeneratorHelper.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtil/MacroStabilityInwardsTestDataGeneratorHelper.cs (revision d037959013b6997c5edc0b2f8c6b55a92c4e4ced) @@ -0,0 +1,100 @@ +// 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.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using Ringtoets.Common.Data.Calculation; +using Ringtoets.MacroStabilityInwards.Data; +using Ringtoets.MacroStabilityInwards.Primitives; + +namespace Ringtoets.MacroStabilityInwards.Integration.TestUtils +{ + /// + /// Class to help asserting the . + /// + public static class MacroStabilityInwardsTestDataGeneratorHelper + { + /// + /// Asserts that the contains all possible calculation configurations + /// for the parent and nested calculations with output. + /// + /// The failure mechanism to assert. + public static void AssertHasAllPossibleCalculationConfigurationsWithOutputs(MacroStabilityInwardsFailureMechanism failureMechanism) + { + IEnumerable calculationRoot = failureMechanism.CalculationsGroup.Children; + AssertCalculationGroupWithOutput(calculationRoot.OfType()); + + CalculationGroup nestedCalculations = calculationRoot.OfType().First(); + AssertCalculationGroupWithOutput(nestedCalculations.Children.OfType()); + } + + /// + /// Asserts that the contains all possible calculation configurations + /// for the parent and nested calculations without output. + /// + /// The failure mechanism to assert. + public static void AssertHasAllPossibleCalculationConfigurationsWithoutOutputs(MacroStabilityInwardsFailureMechanism failureMechanism) + { + IEnumerable calculationRoot = failureMechanism.CalculationsGroup.Children; + AssertCalculationGroupWithoutOutput(calculationRoot.OfType()); + + CalculationGroup nestedCalculations = calculationRoot.OfType().First(); + AssertCalculationGroupWithoutOutput(nestedCalculations.Children.OfType()); + } + + /// + /// Asserts that the contains . + /// + /// The failure mechanism to assert. + public static void AssertHasStochasticSoilModels(MacroStabilityInwardsFailureMechanism failureMechanism) + { + CollectionAssert.IsNotEmpty(failureMechanism.StochasticSoilModels); + } + + /// + /// Asserts sthat the contains . + /// + /// The failure mechanism to assert. + public static void AssertHasSurfaceLines(MacroStabilityInwardsFailureMechanism failureMechanism) + { + CollectionAssert.IsNotEmpty(failureMechanism.SurfaceLines); + } + + private static void AssertCalculationGroupWithOutput(IEnumerable children) + { + AssertCalculationConfig(children, true, true); + } + + private static void AssertCalculationGroupWithoutOutput(IEnumerable children) + { + AssertCalculationConfig(children, false, false); + AssertCalculationConfig(children, true, false); + } + + private static void AssertCalculationConfig( + IEnumerable children, bool hasHydraulicBoundaryLocation, bool hasOutput) + { + Assert.NotNull(children.FirstOrDefault(calc => calc.InputParameters.HydraulicBoundaryLocation != null == hasHydraulicBoundaryLocation + && calc.HasOutput == hasOutput)); + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtil/Properties/AssemblyInfo.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtil/Properties/AssemblyInfo.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtil/Properties/AssemblyInfo.cs (revision d037959013b6997c5edc0b2f8c6b55a92c4e4ced) @@ -0,0 +1,27 @@ +// 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.Reflection; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Ringtoets.MacroStabilityInwards.Integration.TestUtils")] +[assembly: AssemblyProduct("Ringtoets.MacroStabilityInwards.Integration.TestUtils")] +[assembly: Guid("8e0055e0-7e51-4bcc-badb-33ca07bf4174")] \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtil/Ringtoets.MacroStabilityInwards.Integration.TestUtil.csproj =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtil/Ringtoets.MacroStabilityInwards.Integration.TestUtil.csproj (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtil/Ringtoets.MacroStabilityInwards.Integration.TestUtil.csproj (revision d037959013b6997c5edc0b2f8c6b55a92c4e4ced) @@ -0,0 +1,97 @@ + + + + Debug + x86 + {FC576B83-0FB4-49C1-AE53-47FF9779110F} + Library + Properties + Ringtoets.MacroStabilityInwards.Integration.TestUtil + Ringtoets.MacroStabilityInwards.Integration.TestUtil + v4.0 + 512 + + + true + bin\Debug\ + DEBUG;TRACE + full + x86 + prompt + MinimumRecommendedRules.ruleset + + + bin\Release\ + TRACE + true + none + x86 + prompt + MinimumRecommendedRules.ruleset + + + bin\ReleaseForCodeCoverage\ + TRACE + true + pdbonly + x86 + prompt + MinimumRecommendedRules.ruleset + + + + ..\..\..\..\packages\NUnit.3.6.0\lib\net40\nunit.framework.dll + True + + + + + + + Properties\GlobalAssembly.cs + + + + + + + + {3bbfd65b-b277-4e50-ae6d-bd24c3434609} + Core.Common.Base + + + {d4200f43-3f72-4f42-af0a-8ced416a38ec} + Ringtoets.Common.Data + + + {83d6b73e-91d5-46b0-9218-955da1f75f7c} + Ringtoets.MacroStabilityInwards.Data + + + {e9b39743-2dc9-4922-9e0f-6ba3e0e54189} + Ringtoets.MacroStabilityInwards.Primitives + + + {2b78cf04-4785-4f27-a6e5-45bddbb7bf04} + Ringtoets.MacroStabilityInwards.Data.TestUtil + + + {3810d738-6412-47d1-8bc0-729d55bc951f} + Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil + + + + + Copying.licenseheader + + + + + + \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtil/packages.config =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtil/packages.config (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtil/packages.config (revision d037959013b6997c5edc0b2f8c6b55a92c4e4ced) @@ -0,0 +1,25 @@ + + + + \ No newline at end of file Fisheye: Tag d037959013b6997c5edc0b2f8c6b55a92c4e4ced refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtils.Test/MacroStabilityInwardsTestDataGeneratorTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag d037959013b6997c5edc0b2f8c6b55a92c4e4ced refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtils.Test/Properties/AssemblyInfo.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag d037959013b6997c5edc0b2f8c6b55a92c4e4ced refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtils.Test/Ringtoets.MacroStabilityInwards.Integration.TestUtils.Test.csproj'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag d037959013b6997c5edc0b2f8c6b55a92c4e4ced refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtils.Test/packages.config'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag d037959013b6997c5edc0b2f8c6b55a92c4e4ced refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtils/MacroStabilityInwardsTestDataGenerator.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag d037959013b6997c5edc0b2f8c6b55a92c4e4ced refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtils/MacroStabilityInwardsTestDataGeneratorHelper.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag d037959013b6997c5edc0b2f8c6b55a92c4e4ced refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtils/Properties/AssemblyInfo.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag d037959013b6997c5edc0b2f8c6b55a92c4e4ced refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtils/Ringtoets.MacroStabilityInwards.Integration.TestUtils.csproj'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag d037959013b6997c5edc0b2f8c6b55a92c4e4ced refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.TestUtils/packages.config'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/Ringtoets.MacroStabilityInwards.Service.Test.csproj =================================================================== diff -u -r650fc7b43cb6729baee51d079f0377df8d7a3de9 -rd037959013b6997c5edc0b2f8c6b55a92c4e4ced --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/Ringtoets.MacroStabilityInwards.Service.Test.csproj (.../Ringtoets.MacroStabilityInwards.Service.Test.csproj) (revision 650fc7b43cb6729baee51d079f0377df8d7a3de9) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/Ringtoets.MacroStabilityInwards.Service.Test.csproj (.../Ringtoets.MacroStabilityInwards.Service.Test.csproj) (revision d037959013b6997c5edc0b2f8c6b55a92c4e4ced) @@ -101,9 +101,9 @@ {2b78cf04-4785-4f27-a6e5-45bddbb7bf04} Ringtoets.MacroStabilityInwards.Data.TestUtil - + {fc576b83-0fb4-49c1-ae53-47ff9779110f} - Ringtoets.MacroStabilityInwards.Integration.TestUtils + Ringtoets.MacroStabilityInwards.Integration.TestUtil {3810d738-6412-47d1-8bc0-729d55bc951f} Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj =================================================================== diff -u -r6df044b18d205d87d4f38a623cc6e29146d4e95e -rd037959013b6997c5edc0b2f8c6b55a92c4e4ced --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj (.../Ringtoets.Piping.IO.Test.csproj) (revision 6df044b18d205d87d4f38a623cc6e29146d4e95e) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj (.../Ringtoets.Piping.IO.Test.csproj) (revision d037959013b6997c5edc0b2f8c6b55a92c4e4ced) @@ -142,7 +142,7 @@ {955E574D-67CE-4347-AA6B-7DF8A04ED754} Ringtoets.Piping.Data.TestUtil - + {A4972765-DDBB-4A1E-B17C-7185577E5591} Ringtoets.Piping.Integration.TestUtils Index: Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtil.Test/PipingTestDataGeneratorTest.cs =================================================================== diff -u --- Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtil.Test/PipingTestDataGeneratorTest.cs (revision 0) +++ Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtil.Test/PipingTestDataGeneratorTest.cs (revision d037959013b6997c5edc0b2f8c6b55a92c4e4ced) @@ -0,0 +1,247 @@ +// 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.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Piping.Data; + +namespace Ringtoets.Piping.Integration.TestUtils.Test +{ + [TestFixture] + public class PipingTestDataGeneratorTest + { + [Test] + public void GetPipingFailureMechanismWithAllCalculationConfigurations_ReturnsFailureMechanismWithAllConfigurations() + { + // Call + PipingFailureMechanism failureMechanism = PipingTestDataGenerator.GetPipingFailureMechanismWithAllCalculationConfigurations(); + + // Assert + PipingTestDataGeneratorHelper.AssertHasStochasticSoilModels(failureMechanism); + PipingTestDataGeneratorHelper.AssertHasSurfaceLines(failureMechanism); + PipingTestDataGeneratorHelper.AssertHasAllPossibleCalculationConfigurationsWithOutputs(failureMechanism); + PipingTestDataGeneratorHelper.AssertHasAllPossibleCalculationConfigurationsWithoutOutputs(failureMechanism); + } + + [Test] + public void ConfigureFailureMechanismWithAllCalculationConfigurations_ReturnsFailureMechanismWithAllConfigurations() + { + // Setup + var failureMechanism = new PipingFailureMechanism(); + HydraulicBoundaryLocation hydraulicBoundaryLocation = TestHydraulicBoundaryLocation.CreateFullyCalculated(); + + // Call + PipingTestDataGenerator.ConfigureFailureMechanismWithAllCalculationConfigurations(failureMechanism, hydraulicBoundaryLocation); + + // Assert + PipingTestDataGeneratorHelper.AssertHasStochasticSoilModels(failureMechanism); + PipingTestDataGeneratorHelper.AssertHasSurfaceLines(failureMechanism); + PipingTestDataGeneratorHelper.AssertHasAllPossibleCalculationConfigurationsWithOutputs(failureMechanism); + PipingTestDataGeneratorHelper.AssertHasAllPossibleCalculationConfigurationsWithoutOutputs(failureMechanism); + + AssertCalculationsHasSameHydraulicBoundaryLocation(failureMechanism.CalculationsGroup, hydraulicBoundaryLocation); + + CalculationGroup nestedCalculationGroup = failureMechanism.CalculationsGroup.Children.OfType().First(); + AssertCalculationsHasSameHydraulicBoundaryLocation(nestedCalculationGroup, hydraulicBoundaryLocation); + } + + [Test] + public void GetPipingCalculation_Always_ReturnCalculationWithDataSet() + { + // Call + PipingCalculation calculation = PipingTestDataGenerator.GetPipingCalculation(); + + // Assert + AssertCalculation(calculation); + } + + [Test] + public void GetPipingCalculationWithoutHydraulicLocationAndAssessmentLevel_Always_ReturnCalculationWithoutHydraulicLocationAndAssessmentLevel() + { + // Call + PipingCalculation calculation = PipingTestDataGenerator.GetPipingCalculationWithoutHydraulicLocationAndAssessmentLevel(); + + // Assert + AssertCalculation(calculation, false); + } + + [Test] + public void GetPipingCalculationWithAssessmentLevel_Always_ReturnCalculationWithAssessmentLevel() + { + // Call + PipingCalculation calculation = PipingTestDataGenerator.GetPipingCalculationWithAssessmentLevel(); + + // Assert + AssertCalculation(calculation, false, true); + } + + [Test] + public void GetPipingCalculationWithoutSurfaceLine_Always_ReturnCalculationWithoutSurfaceLine() + { + // Call + PipingCalculation calculation = PipingTestDataGenerator.GetPipingCalculationWithoutSurfaceLine(); + + // Assert + AssertCalculation(calculation, true, false, false); + } + + [Test] + public void GetPipingCalculationWithoutSoilModel_Always_ReturnCalculationWithoutSoilModel() + { + // Call + PipingCalculation calculation = PipingTestDataGenerator.GetPipingCalculationWithoutSoilModel(); + + // Assert + AssertCalculation(calculation, true, false, true, false); + } + + [Test] + public void GetPipingCalculationWithoutSoilProfile_Always_ReturnCalculationWithoutSoilProfile() + { + // Call + PipingCalculation calculation = PipingTestDataGenerator.GetPipingCalculationWithoutSoilProfile(); + + // Assert + AssertCalculation(calculation, true, false, true, true, false); + } + + [Test] + public void GetPipingCalculationWithNaNs_Always_ReturnCalculationWithNaNs() + { + // Call + PipingCalculation calculation = PipingTestDataGenerator.GetPipingCalculationWithNaNs(); + + // Assert + Assert.AreEqual("PK001_0001 W1-6_0_1D1", calculation.Name); + Assert.AreEqual(double.NaN, calculation.InputParameters.AssessmentLevel.Value); + Assert.AreEqual("PK001_0001", calculation.InputParameters.SurfaceLine.Name); + Assert.AreEqual(double.NaN, calculation.InputParameters.EntryPointL.Value); + Assert.AreEqual(double.NaN, calculation.InputParameters.ExitPointL.Value); + Assert.AreEqual("PK001_0001_Piping", calculation.InputParameters.StochasticSoilModel.Name); + Assert.AreEqual("W1-6_0_1D1", calculation.InputParameters.StochasticSoilProfile.SoilProfile.Name); + Assert.AreEqual(double.NaN, calculation.InputParameters.PhreaticLevelExit.Mean.Value); + Assert.AreEqual(double.NaN, calculation.InputParameters.PhreaticLevelExit.StandardDeviation.Value); + Assert.AreEqual(double.NaN, calculation.InputParameters.DampingFactorExit.Mean.Value); + Assert.AreEqual(double.NaN, calculation.InputParameters.DampingFactorExit.StandardDeviation.Value); + } + + [Test] + public void GetPipingCalculationWithInfinities_Always_ReturnCalculationWithInfinities() + { + // Call + PipingCalculation calculation = PipingTestDataGenerator.GetPipingCalculationWithInfinities(); + + // Assert + Assert.AreEqual("PK001_0001 W1-6_0_1D1", calculation.Name); + Assert.AreEqual(double.NegativeInfinity, calculation.InputParameters.AssessmentLevel.Value); + Assert.AreEqual("PK001_0001", calculation.InputParameters.SurfaceLine.Name); + Assert.AreEqual(double.NegativeInfinity, calculation.InputParameters.EntryPointL.Value); + Assert.AreEqual(double.PositiveInfinity, calculation.InputParameters.ExitPointL.Value); + Assert.AreEqual("PK001_0001_Piping", calculation.InputParameters.StochasticSoilModel.Name); + Assert.AreEqual("W1-6_0_1D1", calculation.InputParameters.StochasticSoilProfile.SoilProfile.Name); + Assert.AreEqual(double.NegativeInfinity, calculation.InputParameters.PhreaticLevelExit.Mean.Value); + Assert.AreEqual(double.PositiveInfinity, calculation.InputParameters.PhreaticLevelExit.StandardDeviation.Value); + Assert.AreEqual(double.PositiveInfinity, calculation.InputParameters.DampingFactorExit.Mean.Value); + Assert.AreEqual(double.PositiveInfinity, calculation.InputParameters.DampingFactorExit.StandardDeviation.Value); + } + + private static void AssertCalculation(PipingCalculation calculation, + bool hasHydraulicLocation = true, + bool hasAssessmentLevel = false, + bool hasSurfaceLine = true, + bool hasSoilModel = true, + bool hasSoilProfile = true) + { + Assert.AreEqual("PK001_0001 W1-6_0_1D1", calculation.Name); + + if (hasHydraulicLocation) + { + Assert.AreEqual(1, calculation.InputParameters.HydraulicBoundaryLocation.Id); + Assert.AreEqual("PUNT_KAT_18", calculation.InputParameters.HydraulicBoundaryLocation.Name); + } + else + { + Assert.IsNull(calculation.InputParameters.HydraulicBoundaryLocation); + } + + if (hasAssessmentLevel) + { + Assert.IsNull(calculation.InputParameters.HydraulicBoundaryLocation); + Assert.IsTrue(calculation.InputParameters.UseAssessmentLevelManualInput); + Assert.AreEqual(3, calculation.InputParameters.AssessmentLevel.Value); + } + + if (hasSurfaceLine) + { + Assert.AreEqual("PK001_0001", calculation.InputParameters.SurfaceLine.Name); + } + else + { + Assert.IsNull(calculation.InputParameters.SurfaceLine); + } + + if (hasSoilModel) + { + Assert.AreEqual(1, calculation.InputParameters.StochasticSoilModel.Id); + Assert.AreEqual("PK001_0001_Piping", calculation.InputParameters.StochasticSoilModel.Name); + + if (hasSoilProfile) + { + Assert.IsNotNull(calculation.InputParameters.StochasticSoilProfile); + Assert.AreEqual("W1-6_0_1D1", calculation.InputParameters.StochasticSoilProfile.SoilProfile.Name); + Assert.AreEqual(1, calculation.InputParameters.StochasticSoilProfile.SoilProfile.Layers.Count()); + } + else + { + Assert.IsNull(calculation.InputParameters.StochasticSoilProfile); + } + } + else + { + Assert.IsNull(calculation.InputParameters.StochasticSoilModel); + Assert.IsNull(calculation.InputParameters.StochasticSoilProfile); + } + + Assert.AreEqual(0, calculation.InputParameters.PhreaticLevelExit.Mean.Value); + Assert.AreEqual(0.1, calculation.InputParameters.PhreaticLevelExit.StandardDeviation.Value); + Assert.AreEqual(0.7, calculation.InputParameters.DampingFactorExit.Mean.Value); + Assert.AreEqual(0.1, calculation.InputParameters.DampingFactorExit.StandardDeviation.Value); + } + + private static void AssertCalculationsHasSameHydraulicBoundaryLocation(CalculationGroup calculationGroup, + HydraulicBoundaryLocation hydraulicBoundaryLocation) + { + IEnumerable calculationsWithHydraulicBoundaryLocation = + calculationGroup.Children + .OfType() + .Where(calc => calc.InputParameters.HydraulicBoundaryLocation != null); + + foreach (PipingCalculation calculation in calculationsWithHydraulicBoundaryLocation) + { + Assert.AreSame(hydraulicBoundaryLocation, calculation.InputParameters.HydraulicBoundaryLocation); + } + } + } +} \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtil.Test/Properties/AssemblyInfo.cs =================================================================== diff -u --- Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtil.Test/Properties/AssemblyInfo.cs (revision 0) +++ Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtil.Test/Properties/AssemblyInfo.cs (revision d037959013b6997c5edc0b2f8c6b55a92c4e4ced) @@ -0,0 +1,27 @@ +// 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.Reflection; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Ringtoets.Piping.Integration.TestUtils.Test")] +[assembly: AssemblyProduct("Ringtoets.Piping.Integration.TestUtils.Test")] +[assembly: Guid("070dc87d-520b-4a84-8965-ed5012875fcc")] \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtil.Test/Ringtoets.Piping.Integration.TestUtil.Test.csproj =================================================================== diff -u --- Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtil.Test/Ringtoets.Piping.Integration.TestUtil.Test.csproj (revision 0) +++ Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtil.Test/Ringtoets.Piping.Integration.TestUtil.Test.csproj (revision d037959013b6997c5edc0b2f8c6b55a92c4e4ced) @@ -0,0 +1,96 @@ + + + + Debug + x86 + {070DC87D-520B-4A84-8965-ED5012875FCC} + Library + Properties + Ringtoets.Piping.Integration.TestUtil.Test + Ringtoets.Piping.Integration.TestUtil.Test + v4.0 + 512 + + + true + bin\Debug\ + DEBUG;TRACE + full + x86 + prompt + MinimumRecommendedRules.ruleset + + + bin\Release\ + TRACE + true + none + x86 + prompt + MinimumRecommendedRules.ruleset + + + bin\ReleaseForCodeCoverage\ + TRACE + true + none + x86 + prompt + MinimumRecommendedRules.ruleset + + + + ..\..\..\..\packages\NUnit.3.6.0\lib\net40\nunit.framework.dll + True + + + + + + + Properties\GlobalAssembly.cs + + + + + + + Copying.licenseheader + + + + + + {3bbfd65b-b277-4e50-ae6d-bd24c3434609} + Core.Common.Base + + + {D4200F43-3F72-4F42-AF0A-8CED416A38EC} + Ringtoets.Common.Data + + + {4843d6e5-066f-4795-94f5-1d53932dd03c} + Ringtoets.Common.Data.TestUtil + + + {CE994CC9-6F6A-48AC-B4BE-02C30A21F4DB} + Ringtoets.Piping.Data + + + {14c6f716-64e2-4bc4-a1ef-05865fcefa4c} + Ringtoets.Piping.Primitives + + + {A4972765-DDBB-4A1E-B17C-7185577E5591} + Ringtoets.Piping.Integration.TestUtil + + + + + \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtil.Test/packages.config =================================================================== diff -u --- Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtil.Test/packages.config (revision 0) +++ Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtil.Test/packages.config (revision d037959013b6997c5edc0b2f8c6b55a92c4e4ced) @@ -0,0 +1,25 @@ + + + + \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtil/PipingTestDataGenerator.cs =================================================================== diff -u --- Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtil/PipingTestDataGenerator.cs (revision 0) +++ Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtil/PipingTestDataGenerator.cs (revision d037959013b6997c5edc0b2f8c6b55a92c4e4ced) @@ -0,0 +1,397 @@ +// 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.Data; +using Core.Common.Base.Geometry; +using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Data.Probabilistics; +using Ringtoets.Piping.Data; +using Ringtoets.Piping.Data.TestUtil; +using Ringtoets.Piping.KernelWrapper.TestUtil; +using Ringtoets.Piping.Primitives; + +namespace Ringtoets.Piping.Integration.TestUtils +{ + /// + /// Class responsible for generating test data configurations. + /// + public static class PipingTestDataGenerator + { + /// + /// Gets a fully configured with all + /// possible parent and nested calculation configurations. + /// + public static PipingFailureMechanism GetPipingFailureMechanismWithAllCalculationConfigurations() + { + var failureMechanism = new PipingFailureMechanism(); + var hydroLocation = new HydraulicBoundaryLocation(1, "", 0, 0); + ConfigureFailureMechanismWithAllCalculationConfigurations(failureMechanism, hydroLocation); + + return failureMechanism; + } + + /// + /// Gets a without hydraulic boundary location or design water level. + /// + /// A without hydraulic boundary location or design water level. + public static PipingCalculation GetPipingCalculationWithoutHydraulicLocationAndAssessmentLevel() + { + PipingCalculation calculation = GetPipingCalculation(); + calculation.InputParameters.HydraulicBoundaryLocation = null; + + return calculation; + } + + /// + /// Gets a with manual design water level set. + /// + /// A with a manual design water level. + public static PipingCalculation GetPipingCalculationWithAssessmentLevel() + { + PipingCalculation calculation = GetPipingCalculation(); + calculation.InputParameters.UseAssessmentLevelManualInput = true; + calculation.InputParameters.AssessmentLevel = (RoundedDouble) 3.0; + + return calculation; + } + + /// + /// Gets a without surface line. + /// + /// A without surface line. + public static PipingCalculation GetPipingCalculationWithoutSurfaceLine() + { + PipingCalculation calculation = GetPipingCalculation(); + calculation.InputParameters.SurfaceLine = null; + + return calculation; + } + + /// + /// Gets a without soil model. + /// + /// A without soil model . + public static PipingCalculation GetPipingCalculationWithoutSoilModel() + { + PipingCalculation calculation = GetPipingCalculation(); + calculation.InputParameters.StochasticSoilModel = null; + calculation.InputParameters.StochasticSoilProfile = null; + + return calculation; + } + + /// + /// Gets a without soil profile. + /// + /// A without soil profile. + public static PipingCalculation GetPipingCalculationWithoutSoilProfile() + { + PipingCalculation calculation = GetPipingCalculation(); + calculation.InputParameters.StochasticSoilProfile = null; + + return calculation; + } + + /// + /// Gets a . + /// + /// A . + public static PipingCalculation GetPipingCalculation() + { + var surfaceline = new RingtoetsPipingSurfaceLine + { + ReferenceLineIntersectionWorldPoint = new Point2D(0, 5), + Name = "PK001_0001" + }; + surfaceline.SetGeometry(new[] + { + new Point3D(0, 0, 0), + new Point3D(0, 10, 0) + }); + + var calculation = new PipingCalculation(new GeneralPipingInput()) + { + Name = "PK001_0001 W1-6_0_1D1", + InputParameters = + { + HydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "PUNT_KAT_18", 0, 0), + SurfaceLine = surfaceline, + StochasticSoilModel = new StochasticSoilModel(1, "PK001_0001_Piping", string.Empty), + StochasticSoilProfile = new StochasticSoilProfile(0, SoilProfileType.SoilProfile1D, 0) + { + SoilProfile = new PipingSoilProfile("W1-6_0_1D1", 0, new[] + { + new PipingSoilLayer(0) + }, SoilProfileType.SoilProfile1D, 0) + }, + PhreaticLevelExit = + { + Mean = (RoundedDouble) 0, + StandardDeviation = (RoundedDouble) 0.1 + }, + DampingFactorExit = + { + Mean = (RoundedDouble) 0.7, + StandardDeviation = (RoundedDouble) 0.1 + } + } + }; + + return calculation; + } + + /// + /// Gets a with double.NaN values set. + /// + /// A with double.NaN values. + public static PipingCalculation GetPipingCalculationWithNaNs() + { + PipingCalculation calculation = GetPipingCalculationWithAssessmentLevel(); + calculation.InputParameters.AssessmentLevel = RoundedDouble.NaN; + calculation.InputParameters.EntryPointL = RoundedDouble.NaN; + calculation.InputParameters.ExitPointL = RoundedDouble.NaN; + calculation.InputParameters.PhreaticLevelExit = new NormalDistribution + { + Mean = RoundedDouble.NaN, + StandardDeviation = RoundedDouble.NaN + }; + calculation.InputParameters.DampingFactorExit = new LogNormalDistribution + { + Mean = RoundedDouble.NaN, + StandardDeviation = RoundedDouble.NaN + }; + + return calculation; + } + + /// + /// Gets a with double.NegativeInfinity and double.PositiveInfinity values set. + /// + /// A with double.NegativeInfinity and double.PositiveInfinity values. + public static PipingCalculation GetPipingCalculationWithInfinities() + { + PipingCalculation calculation = GetPipingCalculationWithAssessmentLevel(); + + calculation.InputParameters.SurfaceLine.SetGeometry(new[] + { + new Point3D(0, double.NegativeInfinity, 0), + new Point3D(0, double.PositiveInfinity, 0) + }); + + calculation.InputParameters.AssessmentLevel = (RoundedDouble) double.NegativeInfinity; + calculation.InputParameters.EntryPointL = (RoundedDouble) double.NegativeInfinity; + calculation.InputParameters.ExitPointL = (RoundedDouble) double.PositiveInfinity; + calculation.InputParameters.PhreaticLevelExit = new NormalDistribution + { + Mean = (RoundedDouble) double.NegativeInfinity, + StandardDeviation = (RoundedDouble) double.PositiveInfinity + }; + calculation.InputParameters.DampingFactorExit = new LogNormalDistribution + { + Mean = (RoundedDouble) double.PositiveInfinity, + StandardDeviation = (RoundedDouble) double.PositiveInfinity + }; + + return calculation; + } + + /// + /// Configures a to a fully configured failure + /// mechanism with all possible parent and nested calculation configurations. + /// + /// The failure mechanism to be updated. + /// The hydraulic boundary location used + /// by calculations. + /// This method assumes is a newly + /// created instance. + public static void ConfigureFailureMechanismWithAllCalculationConfigurations(PipingFailureMechanism failureMechanism, + HydraulicBoundaryLocation hydraulicBoundaryLocation) + { + var surfaceline1 = new RingtoetsPipingSurfaceLine + { + ReferenceLineIntersectionWorldPoint = new Point2D(0, 5), + Name = "Line A" + }; + surfaceline1.SetGeometry(new[] + { + new Point3D(0, 0, 0), + new Point3D(0, 10, 0) + }); + var surfaceline2 = new RingtoetsPipingSurfaceLine + { + ReferenceLineIntersectionWorldPoint = new Point2D(10, 5), + Name = "Line B" + }; + surfaceline2.SetGeometry(new[] + { + new Point3D(10, 0, 0), + new Point3D(10, 10, 0) + }); + + failureMechanism.SurfaceLines.AddRange(new[] + { + surfaceline1, + surfaceline2 + }, "some/path/to/surfacelines"); + var stochasticSoilModel1 = new StochasticSoilModel(1, "A", "B") + { + Geometry = + { + new Point2D(-5, 5), + new Point2D(5, 5) + }, + StochasticSoilProfiles = + { + new StochasticSoilProfile(1.0, SoilProfileType.SoilProfile1D, 1) + } + }; + var stochasticSoilModel2 = new StochasticSoilModel(2, "C", "D") + { + Geometry = + { + new Point2D(5, 5), + new Point2D(15, 5) + }, + StochasticSoilProfiles = + { + new StochasticSoilProfile(1.0, SoilProfileType.SoilProfile2D, 2) + } + }; + + failureMechanism.StochasticSoilModels.AddRange(new[] + { + stochasticSoilModel1, + stochasticSoilModel2 + }, "some/path/to/stochasticsoilmodels"); + + var calculation = new PipingCalculationScenario(new GeneralPipingInput()); + var calculationWithOutput = new PipingCalculationScenario(new GeneralPipingInput()) + { + InputParameters = + { + HydraulicBoundaryLocation = hydraulicBoundaryLocation, + SurfaceLine = surfaceline1, + StochasticSoilModel = stochasticSoilModel1 + }, + Output = new TestPipingOutput(), + SemiProbabilisticOutput = new TestPipingSemiProbabilisticOutput() + }; + var calculationWithSurfaceLineAndSoilModel = new PipingCalculationScenario(new GeneralPipingInput()) + { + InputParameters = + { + HydraulicBoundaryLocation = hydraulicBoundaryLocation, + SurfaceLine = surfaceline1, + StochasticSoilModel = stochasticSoilModel1, + StochasticSoilProfile = stochasticSoilModel1.StochasticSoilProfiles[0] + } + }; + var calculationWithOutputAndHydraulicBoundaryLocation = new PipingCalculationScenario(new GeneralPipingInput()) + { + InputParameters = + { + HydraulicBoundaryLocation = hydraulicBoundaryLocation, + SurfaceLine = surfaceline2, + StochasticSoilModel = stochasticSoilModel2 + }, + Output = new TestPipingOutput(), + SemiProbabilisticOutput = new TestPipingSemiProbabilisticOutput() + }; + var calculationWithHydraulicBoundaryLocation = new PipingCalculationScenario(new GeneralPipingInput()) + { + InputParameters = + { + HydraulicBoundaryLocation = hydraulicBoundaryLocation + } + }; + var calculationWithSurfaceLineAndStochasticSoilModel = new PipingCalculationScenario(new GeneralPipingInput()) + { + InputParameters = + { + SurfaceLine = surfaceline1, + StochasticSoilModel = stochasticSoilModel2, + StochasticSoilProfile = stochasticSoilModel2.StochasticSoilProfiles[0] + } + }; + + var subCalculation = new PipingCalculationScenario(new GeneralPipingInput()); + var subCalculationWithOutput = new PipingCalculationScenario(new GeneralPipingInput()) + { + InputParameters = + { + HydraulicBoundaryLocation = hydraulicBoundaryLocation, + SurfaceLine = surfaceline2, + StochasticSoilModel = stochasticSoilModel2, + StochasticSoilProfile = stochasticSoilModel2.StochasticSoilProfiles[0] + }, + Output = new TestPipingOutput(), + SemiProbabilisticOutput = new TestPipingSemiProbabilisticOutput() + }; + var subCalculationWithOutputAndHydraulicBoundaryLocation = new PipingCalculationScenario(new GeneralPipingInput()) + { + InputParameters = + { + HydraulicBoundaryLocation = hydraulicBoundaryLocation, + SurfaceLine = surfaceline1, + StochasticSoilModel = stochasticSoilModel1, + StochasticSoilProfile = stochasticSoilModel1.StochasticSoilProfiles[0] + }, + Output = new TestPipingOutput(), + SemiProbabilisticOutput = new TestPipingSemiProbabilisticOutput() + }; + var subCalculationWithHydraulicBoundaryLocation = new PipingCalculationScenario(new GeneralPipingInput()) + { + InputParameters = + { + HydraulicBoundaryLocation = hydraulicBoundaryLocation + } + }; + var subCalculationWithSurfaceLineAndStochasticSoilModel = new PipingCalculationScenario(new GeneralPipingInput()) + { + InputParameters = + { + SurfaceLine = surfaceline1, + StochasticSoilModel = stochasticSoilModel2, + StochasticSoilProfile = stochasticSoilModel2.StochasticSoilProfiles[0] + } + }; + + failureMechanism.CalculationsGroup.Children.Add(calculation); + failureMechanism.CalculationsGroup.Children.Add(calculationWithOutput); + failureMechanism.CalculationsGroup.Children.Add(calculationWithSurfaceLineAndSoilModel); + failureMechanism.CalculationsGroup.Children.Add(calculationWithOutputAndHydraulicBoundaryLocation); + failureMechanism.CalculationsGroup.Children.Add(calculationWithSurfaceLineAndStochasticSoilModel); + failureMechanism.CalculationsGroup.Children.Add(calculationWithHydraulicBoundaryLocation); + failureMechanism.CalculationsGroup.Children.Add(new CalculationGroup + { + Children = + { + subCalculation, + subCalculationWithOutput, + subCalculationWithOutputAndHydraulicBoundaryLocation, + subCalculationWithHydraulicBoundaryLocation, + subCalculationWithSurfaceLineAndStochasticSoilModel + } + }); + } + } +} \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtil/PipingTestDataGeneratorHelper.cs =================================================================== diff -u --- Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtil/PipingTestDataGeneratorHelper.cs (revision 0) +++ Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtil/PipingTestDataGeneratorHelper.cs (revision d037959013b6997c5edc0b2f8c6b55a92c4e4ced) @@ -0,0 +1,100 @@ +// 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.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using Ringtoets.Common.Data.Calculation; +using Ringtoets.Piping.Data; +using Ringtoets.Piping.Primitives; + +namespace Ringtoets.Piping.Integration.TestUtils +{ + /// + /// Class to help asserting the . + /// + public static class PipingTestDataGeneratorHelper + { + /// + /// Asserts that the contains all possible calculation configurations + /// for the parent and nested calculations with output. + /// + /// The failure mechanism to assert. + public static void AssertHasAllPossibleCalculationConfigurationsWithOutputs(PipingFailureMechanism failureMechanism) + { + IEnumerable calculationRoot = failureMechanism.CalculationsGroup.Children; + AssertPipingCalculationGroupWithOutput(calculationRoot.OfType()); + + CalculationGroup nestedCalculations = calculationRoot.OfType().First(); + AssertPipingCalculationGroupWithOutput(nestedCalculations.Children.OfType()); + } + + /// + /// Asserts that the contains all possible calculation configurations + /// for the parent and nested calculations without output. + /// + /// The failure mechanism to assert. + public static void AssertHasAllPossibleCalculationConfigurationsWithoutOutputs(PipingFailureMechanism failureMechanism) + { + IEnumerable calculationRoot = failureMechanism.CalculationsGroup.Children; + AssertPipingCalculationGroupWithoutOutput(calculationRoot.OfType()); + + CalculationGroup nestedCalculations = calculationRoot.OfType().First(); + AssertPipingCalculationGroupWithoutOutput(nestedCalculations.Children.OfType()); + } + + /// + /// Asserts that the contains . + /// + /// The failure mechanism to assert. + public static void AssertHasStochasticSoilModels(PipingFailureMechanism failureMechanism) + { + CollectionAssert.IsNotEmpty(failureMechanism.StochasticSoilModels); + } + + /// + /// Asserts sthat the contains . + /// + /// The failure mechanism to assert. + public static void AssertHasSurfaceLines(PipingFailureMechanism failureMechanism) + { + CollectionAssert.IsNotEmpty(failureMechanism.SurfaceLines); + } + + private static void AssertPipingCalculationGroupWithOutput(IEnumerable children) + { + AssertCalculationConfig(children, true, true); + } + + private static void AssertPipingCalculationGroupWithoutOutput(IEnumerable children) + { + AssertCalculationConfig(children, false, false); + AssertCalculationConfig(children, true, false); + } + + private static void AssertCalculationConfig( + IEnumerable children, bool hasHydraulicBoundaryLocation, bool hasOutput) + { + Assert.NotNull(children.FirstOrDefault(calc => calc.InputParameters.HydraulicBoundaryLocation != null == hasHydraulicBoundaryLocation + && calc.HasOutput == hasOutput)); + } + } +} \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtil/Properties/AssemblyInfo.cs =================================================================== diff -u --- Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtil/Properties/AssemblyInfo.cs (revision 0) +++ Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtil/Properties/AssemblyInfo.cs (revision d037959013b6997c5edc0b2f8c6b55a92c4e4ced) @@ -0,0 +1,27 @@ +// 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.Reflection; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Ringtoets.Piping.Integration.TestUtils")] +[assembly: AssemblyProduct("Ringtoets.Piping.Integration.TestUtils")] +[assembly: Guid("73ccaa49-4c40-4083-978b-cb516693236a")] \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtil/Ringtoets.Piping.Integration.TestUtil.csproj =================================================================== diff -u --- Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtil/Ringtoets.Piping.Integration.TestUtil.csproj (revision 0) +++ Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtil/Ringtoets.Piping.Integration.TestUtil.csproj (revision d037959013b6997c5edc0b2f8c6b55a92c4e4ced) @@ -0,0 +1,97 @@ + + + + Debug + x86 + {A4972765-DDBB-4A1E-B17C-7185577E5591} + Library + Properties + Ringtoets.Piping.Integration.TestUtil + Ringtoets.Piping.Integration.TestUtil + v4.0 + 512 + + + true + bin\Debug\ + DEBUG;TRACE + full + x86 + prompt + MinimumRecommendedRules.ruleset + + + bin\Release\ + TRACE + true + none + x86 + prompt + MinimumRecommendedRules.ruleset + + + bin\ReleaseForCodeCoverage\ + TRACE + true + pdbonly + x86 + prompt + MinimumRecommendedRules.ruleset + + + + ..\..\..\..\packages\NUnit.3.6.0\lib\net40\nunit.framework.dll + True + + + + + + + Properties\GlobalAssembly.cs + + + + + + + + {3bbfd65b-b277-4e50-ae6d-bd24c3434609} + Core.Common.Base + + + {d4200f43-3f72-4f42-af0a-8ced416a38ec} + Ringtoets.Common.Data + + + {ce994cc9-6f6a-48ac-b4be-02c30a21f4db} + Ringtoets.Piping.Data + + + {14c6f716-64e2-4bc4-a1ef-05865fcefa4c} + Ringtoets.Piping.Primitives + + + {955e574d-67ce-4347-aa6b-7df8a04ed754} + Ringtoets.Piping.Data.TestUtil + + + {27e0a5c9-3abf-426a-a3da-7d0b83a218c8} + Ringtoets.Piping.KernelWrapper.TestUtil + + + + + Copying.licenseheader + + + + + + \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtil/packages.config =================================================================== diff -u --- Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtil/packages.config (revision 0) +++ Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtil/packages.config (revision d037959013b6997c5edc0b2f8c6b55a92c4e4ced) @@ -0,0 +1,25 @@ + + + + \ No newline at end of file Fisheye: Tag d037959013b6997c5edc0b2f8c6b55a92c4e4ced refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtils.Test/PipingTestDataGeneratorTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag d037959013b6997c5edc0b2f8c6b55a92c4e4ced refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtils.Test/Properties/AssemblyInfo.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag d037959013b6997c5edc0b2f8c6b55a92c4e4ced refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtils.Test/Ringtoets.Piping.Integration.TestUtils.Test.csproj'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag d037959013b6997c5edc0b2f8c6b55a92c4e4ced refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtils.Test/packages.config'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag d037959013b6997c5edc0b2f8c6b55a92c4e4ced refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtils/PipingTestDataGenerator.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag d037959013b6997c5edc0b2f8c6b55a92c4e4ced refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtils/PipingTestDataGeneratorHelper.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag d037959013b6997c5edc0b2f8c6b55a92c4e4ced refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtils/Properties/AssemblyInfo.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag d037959013b6997c5edc0b2f8c6b55a92c4e4ced refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtils/Ringtoets.Piping.Integration.TestUtils.csproj'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag d037959013b6997c5edc0b2f8c6b55a92c4e4ced refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.Integration.TestUtils/packages.config'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/Ringtoets.Piping.Service.Test.csproj =================================================================== diff -u -r570695e818fcf887563710ad6d26df301be56227 -rd037959013b6997c5edc0b2f8c6b55a92c4e4ced --- Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/Ringtoets.Piping.Service.Test.csproj (.../Ringtoets.Piping.Service.Test.csproj) (revision 570695e818fcf887563710ad6d26df301be56227) +++ Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/Ringtoets.Piping.Service.Test.csproj (.../Ringtoets.Piping.Service.Test.csproj) (revision d037959013b6997c5edc0b2f8c6b55a92c4e4ced) @@ -101,7 +101,7 @@ {CE994CC9-6F6A-48AC-B4BE-02C30A21F4DB} Ringtoets.Piping.Data - + {a4972765-ddbb-4a1e-b17c-7185577e5591} Ringtoets.Piping.Integration.TestUtils