Fisheye: Tag b3ce286cbc2264994426d07eaf15975b01fcf5f7 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/Application.Ringtoets.Storage.TestUtil.csproj'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag b3ce286cbc2264994426d07eaf15975b01fcf5f7 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/Hydraulics/HydraulicLocationEntityTestFactory.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag b3ce286cbc2264994426d07eaf15975b01fcf5f7 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/IllustrationPoints/GeneralResultEntityTestHelper.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag b3ce286cbc2264994426d07eaf15975b01fcf5f7 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/MacroStabilityInwards/MacroStabilityInwardsCalculationEntityTestHelper.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag b3ce286cbc2264994426d07eaf15975b01fcf5f7 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/MacroStabilityInwards/MacroStabilityInwardsCalculationOutputEntityTestHelper.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag b3ce286cbc2264994426d07eaf15975b01fcf5f7 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/MacroStabilityInwards/MacroStabilityInwardsSoilLayerTwoDEntityTestFactory.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag b3ce286cbc2264994426d07eaf15975b01fcf5f7 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilProfileEntityTestFactory.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag b3ce286cbc2264994426d07eaf15975b01fcf5f7 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/MigratedDatabaseReader.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag b3ce286cbc2264994426d07eaf15975b01fcf5f7 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/MigrationLogTestHelper.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag b3ce286cbc2264994426d07eaf15975b01fcf5f7 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/PipingStochasticSoilProfileEntityTestFactory.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag b3ce286cbc2264994426d07eaf15975b01fcf5f7 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/Properties/AssemblyInfo.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag b3ce286cbc2264994426d07eaf15975b01fcf5f7 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectMigrationTestHelper.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag b3ce286cbc2264994426d07eaf15975b01fcf5f7 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectTestHelper.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag b3ce286cbc2264994426d07eaf15975b01fcf5f7 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/SqLiteDatabaseHelper.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag b3ce286cbc2264994426d07eaf15975b01fcf5f7 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/TestFailureMechanismSection.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag b3ce286cbc2264994426d07eaf15975b01fcf5f7 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/packages.config'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/Application.Ringtoets.Storage.TestUtil.csproj =================================================================== diff -u --- Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/Application.Ringtoets.Storage.TestUtil.csproj (revision 0) +++ Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/Application.Ringtoets.Storage.TestUtil.csproj (revision b3ce286cbc2264994426d07eaf15975b01fcf5f7) @@ -0,0 +1,170 @@ + + + + {03DBE353-99F7-47D6-B826-60D694FFB9AC} + Application.Ringtoets.Storage.TestUtil + Application.Ringtoets.Storage.TestUtil + + + + + ..\..\..\..\packages\NUnit.3.8.1\lib\net40\nunit.framework.dll + True + + + + + + ..\..\..\..\packages\System.Data.SQLite.Core.1.0.106.0\lib\net40\System.Data.SQLite.dll + True + + + + + + + + + + + + + + + + + + + + + + Copying.licenseheader + + + + + + {3BBFD65B-B277-4E50-AE6D-BD24C3434609} + Core.Common.Base + + + {E344867E-9AC9-44C8-88A5-8185681679A9} + Core.Common.IO + + + {D749EE4C-CE50-4C17-BF01-9A953028C126} + Core.Common.TestUtil + + + {420ED9C3-0C33-47EA-B893-121A9C0DB4F1} + Ringtoets.AssemblyTool.Data + + + {C6309704-D67B-434C-BC98-9F8910BC1D10} + Ringtoets.ClosingStructures.Data + + + {f5b43c29-6169-4e9a-859e-09090330b94e} + Ringtoets.ClosingStructures.Data.TestUtil + + + {78AA56F5-431D-465C-AC50-3173D7E90AC1} + Ringtoets.Common.Primitives + + + {6A074D65-A81C-4C1C-8E24-F36C916E4ED7} + Ringtoets.Common.Util + + + {4843D6E5-066F-4795-94F5-1D53932DD03C} + Ringtoets.Common.Data.TestUtil + + + {D1068432-C172-4AA6-847B-D9DEB4C6DE26} + Ringtoets.DuneErosion.Data + + + {f67e8ae8-1ff0-4680-9817-99e025cd9ff6} + Ringtoets.HeightStructures.Data.TestUtil + + + {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 + + + {955E574D-67CE-4347-AA6B-7DF8A04ED754} + Ringtoets.Piping.Data.TestUtil + + + {6F568E38-592A-4F99-A901-86B74C4F24D2} + Ringtoets.Piping.Primitives.TestUtil + + + {87C2C553-C0BC-40BF-B1EA-B83BFF357F27} + Ringtoets.Revetment.Data + + + {3D4B9740-8348-4434-8D77-B611FC6EE57F} + Ringtoets.StabilityPointStructures.Data + + + {e9ac095b-8f10-41d2-9456-4a85e3ba91ad} + Ringtoets.StabilityPointStructures.Data.TestUtil + + + {567E0B69-5280-41CE-ADD6-443725A61C86} + Ringtoets.WaveImpactAsphaltCover.Data + + + {d4200f43-3f72-4f42-af0a-8ced416a38ec} + Ringtoets.Common.Data + + + {90DE728E-48EF-4665-AB38-3D88E41D9F4D} + Ringtoets.GrassCoverErosionInwards.Data + + + {e7225477-577f-4a17-b7ec-6721158e1543} + Ringtoets.GrassCoverErosionOutwards.Data + + + {1C0017D8-35B5-4CA0-8FC7-A83F46DBDC99} + Ringtoets.HeightStructures.Data + + + {11F1F874-45AF-43E4-8AE5-15A5C9593E28} + Ringtoets.Integration.Data + + + {CE994CC9-6F6A-48AC-B4BE-02C30A21F4DB} + Ringtoets.Piping.Data + + + {14C6F716-64E2-4BC4-A1EF-05865FCEFA4C} + Ringtoets.Piping.Primitives + + + {b479e3af-7c34-488c-bb73-d324100d36c9} + Ringtoets.StabilityStoneCover.Data + + + {FAC55B92-E259-43D6-B9A1-5BDA6C834359} + Application.Ringtoets.Migration.Core + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + \ No newline at end of file Index: Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/Hydraulics/HydraulicLocationEntityTestFactory.cs =================================================================== diff -u --- Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/Hydraulics/HydraulicLocationEntityTestFactory.cs (revision 0) +++ Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/Hydraulics/HydraulicLocationEntityTestFactory.cs (revision b3ce286cbc2264994426d07eaf15975b01fcf5f7) @@ -0,0 +1,44 @@ +// 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 Application.Ringtoets.Storage.DbContext; + +namespace Application.Ringtoets.Storage.TestUtil.Hydraulics +{ + /// + /// Factory for creating + /// which cam be used for testing. + /// + public static class HydraulicLocationEntityTestFactory + { + /// + /// Creates a minimal with a configured name. + /// + /// A valid . + public static HydraulicLocationEntity CreateHydraulicLocationEntity() + { + return new HydraulicLocationEntity + { + Name = "A" + }; + } + } +} \ No newline at end of file Index: Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/IllustrationPoints/GeneralResultEntityTestHelper.cs =================================================================== diff -u --- Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/IllustrationPoints/GeneralResultEntityTestHelper.cs (revision 0) +++ Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/IllustrationPoints/GeneralResultEntityTestHelper.cs (revision b3ce286cbc2264994426d07eaf15975b01fcf5f7) @@ -0,0 +1,73 @@ +// 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 System.Linq; +using Application.Ringtoets.Storage.DbContext; +using NUnit.Framework; +using Ringtoets.Common.Data.IllustrationPoints; +using Ringtoets.Common.Data.TestUtil; + +namespace Application.Ringtoets.Storage.TestUtil.IllustrationPoints +{ + /// + /// Class to assert the properties of general result entities. + /// + public static class GeneralResultEntityTestHelper + { + /// + /// Determines for each property of whether the matching + /// property of has an equal value. + /// + /// The to compare. + /// The + /// to compare. + /// Thrown if any of the argument is null. + /// Thrown when: + /// + /// The values of the governing wind direction name and angles do not match. + /// The count of the stochasts do not match. + /// The count of the top level illustration points do not match. + /// + /// This only asserts the properties of the + /// that are directly associated with it, but not the values of the items it is composed of. + public static void AssertGeneralResultPropertyValues(GeneralResult generalResult, + GeneralResultFaultTreeIllustrationPointEntity generalResultEntity) + { + if (generalResult == null) + { + throw new ArgumentNullException(nameof(generalResult)); + } + if (generalResultEntity == null) + { + throw new ArgumentNullException(nameof(generalResultEntity)); + } + + WindDirection governingWindDirection = generalResult.GoverningWindDirection; + Assert.AreEqual(governingWindDirection.Name, generalResultEntity.GoverningWindDirectionName); + Assert.AreEqual(governingWindDirection.Angle, generalResultEntity.GoverningWindDirectionAngle, + governingWindDirection.Angle.GetAccuracy()); + + Assert.AreEqual(generalResult.Stochasts.Count(), generalResultEntity.StochastEntities.Count); + Assert.AreEqual(generalResult.TopLevelIllustrationPoints.Count(), generalResultEntity.TopLevelFaultTreeIllustrationPointEntities.Count); + } + } +} \ No newline at end of file Index: Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/MacroStabilityInwards/MacroStabilityInwardsCalculationEntityTestHelper.cs =================================================================== diff -u --- Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/MacroStabilityInwards/MacroStabilityInwardsCalculationEntityTestHelper.cs (revision 0) +++ Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/MacroStabilityInwards/MacroStabilityInwardsCalculationEntityTestHelper.cs (revision b3ce286cbc2264994426d07eaf15975b01fcf5f7) @@ -0,0 +1,165 @@ +// 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 Application.Ringtoets.Storage.DbContext; +using Core.Common.Base.Data; +using NUnit.Framework; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.MacroStabilityInwards.Data; +using Ringtoets.MacroStabilityInwards.Primitives; + +namespace Application.Ringtoets.Storage.TestUtil.MacroStabilityInwards +{ + /// + /// Class to assert the properties of macro stability inwards calculation entities. + /// + public static class MacroStabilityInwardsCalculationEntityTestHelper + { + /// + /// Determines for each property of + /// whether the matching property have the expected value. + /// + /// The to compare. + /// The + /// to compare. + /// Thrown if any of the arguments is null. + /// Thrown when any of the values of the + /// and its nested elements do not match. + /// + /// This method does not assert the values of: + /// + /// + /// and . + /// . + /// . + /// The string related properties and comments. + /// + public static void AssertCalculationScenarioPropertyValues(MacroStabilityInwardsCalculationScenario scenario, MacroStabilityInwardsCalculationEntity entity) + { + if (scenario == null) + { + throw new ArgumentNullException(nameof(scenario)); + } + if (entity == null) + { + throw new ArgumentNullException(nameof(entity)); + } + + Assert.AreEqual(Convert.ToByte(scenario.IsRelevant), entity.RelevantForScenario); + AssertAreEqual(scenario.Contribution, entity.ScenarioContribution); + + AssertInputParameters(scenario.InputParameters, entity); + } + + private static void AssertInputParameters(MacroStabilityInwardsInput input, MacroStabilityInwardsCalculationEntity entity) + { + AssertAreEqual(input.AssessmentLevel, entity.AssessmentLevel); + Assert.AreEqual(Convert.ToByte(input.UseAssessmentLevelManualInput), entity.UseAssessmentLevelManualInput); + AssertAreEqual(input.SlipPlaneMinimumDepth, entity.SlipPlaneMinimumDepth); + AssertAreEqual(input.SlipPlaneMinimumLength, entity.SlipPlaneMinimumLength); + AssertAreEqual(input.MaximumSliceWidth, entity.MaximumSliceWidth); + Assert.AreEqual(Convert.ToByte(input.MoveGrid), entity.MoveGrid); + Assert.AreEqual(Convert.ToByte(input.DikeSoilScenario), entity.DikeSoilScenario); + AssertAreEqual(input.WaterLevelRiverAverage, entity.WaterLevelRiverAverage); + Assert.AreEqual(Convert.ToByte(input.DrainageConstructionPresent), entity.DrainageConstructionPresent); + AssertAreEqual(input.XCoordinateDrainageConstruction, entity.DrainageConstructionCoordinateX); + AssertAreEqual(input.ZCoordinateDrainageConstruction, entity.DrainageConstructionCoordinateZ); + AssertAreEqual(input.MinimumLevelPhreaticLineAtDikeTopRiver, entity.MinimumLevelPhreaticLineAtDikeTopRiver); + AssertAreEqual(input.MinimumLevelPhreaticLineAtDikeTopPolder, entity.MinimumLevelPhreaticLineAtDikeTopPolder); + + AssertLocationInputs(input.LocationInputExtreme, input.LocationInputDaily, entity); + + Assert.AreEqual(Convert.ToByte(input.AdjustPhreaticLine3And4ForUplift), entity.AdjustPhreaticLine3And4ForUplift); + AssertAreEqual(input.LeakageLengthOutwardsPhreaticLine3, entity.LeakageLengthOutwardsPhreaticLine3); + AssertAreEqual(input.LeakageLengthInwardsPhreaticLine3, entity.LeakageLengthInwardsPhreaticLine3); + AssertAreEqual(input.LeakageLengthOutwardsPhreaticLine4, entity.LeakageLengthOutwardsPhreaticLine4); + AssertAreEqual(input.LeakageLengthInwardsPhreaticLine4, entity.LeakageLengthInwardsPhreaticLine4); + AssertAreEqual(input.PiezometricHeadPhreaticLine2Outwards, entity.PiezometricHeadPhreaticLine2Outwards); + AssertAreEqual(input.PiezometricHeadPhreaticLine2Inwards, entity.PiezometricHeadPhreaticLine2Inwards); + + Assert.AreEqual(Convert.ToByte(input.GridDeterminationType), entity.GridDeterminationType); + Assert.AreEqual(Convert.ToByte(input.TangentLineDeterminationType), entity.TangentLineDeterminationType); + + AssertAreEqual(input.TangentLineZTop, entity.TangentLineZTop); + AssertAreEqual(input.TangentLineZBottom, entity.TangentLineZBottom); + Assert.AreEqual(input.TangentLineNumber, entity.TangentLineNumber); + + AssertGridInputs(input.LeftGrid, input.RightGrid, entity); + + Assert.AreEqual(Convert.ToByte(input.CreateZones), entity.CreateZones); + Assert.AreEqual(Convert.ToByte(input.ZoningBoundariesDeterminationType), entity.ZoningBoundariesDeterminationType); + AssertAreEqual(input.ZoneBoundaryLeft, entity.ZoneBoundaryLeft); + AssertAreEqual(input.ZoneBoundaryRight, entity.ZoneBoundaryRight); + } + + private static void AssertGridInputs(MacroStabilityInwardsGrid leftGrid, + MacroStabilityInwardsGrid rightGrid, + MacroStabilityInwardsCalculationEntity entity) + { + AssertAreEqual(leftGrid.XLeft, entity.LeftGridXLeft); + AssertAreEqual(leftGrid.XRight, entity.LeftGridXRight); + Assert.AreEqual(leftGrid.NumberOfHorizontalPoints, entity.LeftGridNrOfHorizontalPoints); + AssertAreEqual(leftGrid.ZTop, entity.LeftGridZTop); + AssertAreEqual(leftGrid.ZBottom, entity.LeftGridZBottom); + Assert.AreEqual(leftGrid.NumberOfVerticalPoints, entity.LeftGridNrOfVerticalPoints); + + AssertAreEqual(rightGrid.XLeft, entity.RightGridXLeft); + AssertAreEqual(rightGrid.XRight, entity.RightGridXRight); + Assert.AreEqual(rightGrid.NumberOfHorizontalPoints, entity.RightGridNrOfHorizontalPoints); + AssertAreEqual(rightGrid.ZTop, entity.RightGridZTop); + AssertAreEqual(rightGrid.ZBottom, entity.RightGridZBottom); + Assert.AreEqual(rightGrid.NumberOfVerticalPoints, entity.RightGridNrOfVerticalPoints); + } + + private static void AssertLocationInputs(IMacroStabilityInwardsLocationInputExtreme locationInputExtreme, + IMacroStabilityInwardsLocationInputDaily locationInputDaily, + MacroStabilityInwardsCalculationEntity entity) + { + AssertAreEqual(locationInputExtreme.WaterLevelPolder, entity.LocationInputExtremeWaterLevelPolder); + Assert.AreEqual(Convert.ToByte(locationInputExtreme.UseDefaultOffsets), entity.LocationInputExtremeUseDefaultOffsets); + AssertAreEqual(locationInputExtreme.PhreaticLineOffsetBelowDikeTopAtRiver, entity.LocationInputExtremePhreaticLineOffsetBelowDikeTopAtRiver); + AssertAreEqual(locationInputExtreme.PhreaticLineOffsetBelowDikeTopAtPolder, entity.LocationInputExtremePhreaticLineOffsetBelowDikeTopAtPolder); + AssertAreEqual(locationInputExtreme.PhreaticLineOffsetBelowShoulderBaseInside, entity.LocationInputExtremePhreaticLineOffsetBelowShoulderBaseInside); + AssertAreEqual(locationInputExtreme.PhreaticLineOffsetBelowDikeToeAtPolder, entity.LocationInputExtremePhreaticLineOffsetDikeToeAtPolder); + AssertAreEqual(locationInputExtreme.PenetrationLength, entity.LocationInputExtremePenetrationLength); + + AssertAreEqual(locationInputDaily.WaterLevelPolder, entity.LocationInputDailyWaterLevelPolder); + Assert.AreEqual(Convert.ToByte(locationInputDaily.UseDefaultOffsets), entity.LocationInputDailyUseDefaultOffsets); + AssertAreEqual(locationInputDaily.PhreaticLineOffsetBelowDikeTopAtRiver, entity.LocationInputDailyPhreaticLineOffsetBelowDikeTopAtRiver); + AssertAreEqual(locationInputDaily.PhreaticLineOffsetBelowDikeTopAtPolder, entity.LocationInputDailyPhreaticLineOffsetBelowDikeTopAtPolder); + AssertAreEqual(locationInputDaily.PhreaticLineOffsetBelowShoulderBaseInside, entity.LocationInputDailyPhreaticLineOffsetBelowShoulderBaseInside); + AssertAreEqual(locationInputDaily.PhreaticLineOffsetBelowDikeToeAtPolder, entity.LocationInputDailyPhreaticLineOffsetDikeToeAtPolder); + } + + private static void AssertAreEqual(RoundedDouble expectedDouble, double? actualDouble) + { + if (double.IsNaN(expectedDouble)) + { + Assert.IsNull(actualDouble); + } + else + { + Assert.AreEqual(expectedDouble, actualDouble, expectedDouble.GetAccuracy()); + } + } + } +} \ No newline at end of file Index: Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/MacroStabilityInwards/MacroStabilityInwardsCalculationOutputEntityTestHelper.cs =================================================================== diff -u --- Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/MacroStabilityInwards/MacroStabilityInwardsCalculationOutputEntityTestHelper.cs (revision 0) +++ Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/MacroStabilityInwards/MacroStabilityInwardsCalculationOutputEntityTestHelper.cs (revision b3ce286cbc2264994426d07eaf15975b01fcf5f7) @@ -0,0 +1,146 @@ +// 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 Application.Ringtoets.Storage.DbContext; +using Application.Ringtoets.Storage.Serializers; +using Core.Common.Base.Data; +using NUnit.Framework; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.MacroStabilityInwards.Data; + +namespace Application.Ringtoets.Storage.TestUtil.MacroStabilityInwards +{ + /// + /// Class to assert the properties of macro stability inwards calculation output entities. + /// + public static class MacroStabilityInwardsCalculationOutputEntityTestHelper + { + /// + /// Determines for each property of whether the matching + /// property of has an equal value. + /// + /// The to compare. + /// The + /// to compare. + /// Thrown if any of the argument is null. + /// Thrown when any of the values of the + /// and its nested elements do not match. + /// + public static void AssertOutputPropertyValues(MacroStabilityInwardsOutput output, + MacroStabilityInwardsCalculationOutputEntity entity) + { + if (output == null) + { + throw new ArgumentNullException(nameof(output)); + } + if (entity == null) + { + throw new ArgumentNullException(nameof(entity)); + } + + AssertAreEqual(output.FactorOfStability, entity.FactorOfStability); + AssertAreEqual(output.ForbiddenZonesXEntryMin, entity.ForbiddenZonesXEntryMin); + AssertAreEqual(output.ForbiddenZonesXEntryMax, entity.ForbiddenZonesXEntryMax); + AssertAreEqual(output.ZValue, entity.ZValue); + + AssertSlidingCurveProperties(output.SlidingCurve, entity); + AssertSlipPlaneProperties(output.SlipPlane, entity); + } + + private static void AssertSlipPlaneProperties(MacroStabilityInwardsSlipPlaneUpliftVan slipPlane, + MacroStabilityInwardsCalculationOutputEntity entity) + { + string expectedTangentLinesXml = new TangentLinesXmlSerializer().ToXml(slipPlane.TangentLines); + Assert.AreEqual(expectedTangentLinesXml, entity.SlipPlaneTangentLinesXml); + + MacroStabilityInwardsGrid leftGrid = slipPlane.LeftGrid; + AssertAreEqual(leftGrid.XLeft, entity.SlipPlaneLeftGridXLeft); + AssertAreEqual(leftGrid.XRight, entity.SlipPlaneLeftGridXRight); + Assert.AreEqual(leftGrid.NumberOfHorizontalPoints, entity.SlipPlaneLeftGridNrOfHorizontalPoints); + AssertAreEqual(leftGrid.ZTop, entity.SlipPlaneLeftGridZTop); + AssertAreEqual(leftGrid.ZBottom, entity.SlipPlaneLeftGridZBottom); + Assert.AreEqual(leftGrid.NumberOfVerticalPoints, entity.SlipPlaneLeftGridNrOfVerticalPoints); + + MacroStabilityInwardsGrid rightGrid = slipPlane.RightGrid; + AssertAreEqual(rightGrid.XLeft, entity.SlipPlaneRightGridXLeft); + AssertAreEqual(rightGrid.XRight, entity.SlipPlaneRightGridXRight); + Assert.AreEqual(rightGrid.NumberOfHorizontalPoints, entity.SlipPlaneRightGridNrOfHorizontalPoints); + AssertAreEqual(rightGrid.ZTop, entity.SlipPlaneRightGridZTop); + AssertAreEqual(rightGrid.ZBottom, entity.SlipPlaneRightGridZBottom); + Assert.AreEqual(rightGrid.NumberOfVerticalPoints, entity.SlipPlaneRightGridNrOfVerticalPoints); + } + + private static void AssertSlidingCurveProperties(MacroStabilityInwardsSlidingCurve slidingCurve, + MacroStabilityInwardsCalculationOutputEntity entity) + { + string expectedSlicesXml = new MacroStabilityInwardsSliceXmlSerializer().ToXml(slidingCurve.Slices); + Assert.AreEqual(expectedSlicesXml, entity.SlidingCurveSliceXML); + + AssertAreEqual(slidingCurve.IteratedHorizontalForce, entity.SlidingCurveIteratedHorizontalForce); + AssertAreEqual(slidingCurve.NonIteratedHorizontalForce, entity.SlidingCurveNonIteratedHorizontalForce); + + MacroStabilityInwardsSlidingCircle leftCircle = slidingCurve.LeftCircle; + AssertAreEqual(leftCircle.Center.X, entity.SlidingCurveLeftSlidingCircleCenterX); + AssertAreEqual(leftCircle.Center.Y, entity.SlidingCurveLeftSlidingCircleCenterY); + AssertAreEqual(leftCircle.Radius, entity.SlidingCurveLeftSlidingCircleRadius); + Assert.AreEqual(Convert.ToByte(leftCircle.IsActive), entity.SlidingCurveLeftSlidingCircleIsActive); + AssertAreEqual(leftCircle.IteratedForce, entity.SlidingCurveLeftSlidingCircleIteratedForce); + AssertAreEqual(leftCircle.NonIteratedForce, entity.SlidingCurveLeftSlidingCircleNonIteratedForce); + AssertAreEqual(leftCircle.DrivingMoment, entity.SlidingCurveLeftSlidingCircleDrivingMoment); + AssertAreEqual(leftCircle.ResistingMoment, entity.SlidingCurveLeftSlidingCircleResistingMoment); + + MacroStabilityInwardsSlidingCircle rightCircle = slidingCurve.RightCircle; + AssertAreEqual(rightCircle.Center.X, entity.SlidingCurveRightSlidingCircleCenterX); + AssertAreEqual(rightCircle.Center.Y, entity.SlidingCurveRightSlidingCircleCenterY); + AssertAreEqual(rightCircle.Radius, entity.SlidingCurveRightSlidingCircleRadius); + Assert.AreEqual(Convert.ToByte(rightCircle.IsActive), entity.SlidingCurveRightSlidingCircleIsActive); + AssertAreEqual(rightCircle.IteratedForce, entity.SlidingCurveRightSlidingCircleIteratedForce); + AssertAreEqual(rightCircle.NonIteratedForce, entity.SlidingCurveRightSlidingCircleNonIteratedForce); + AssertAreEqual(rightCircle.DrivingMoment, entity.SlidingCurveRightSlidingCircleDrivingMoment); + AssertAreEqual(rightCircle.ResistingMoment, entity.SlidingCurveRightSlidingCircleResistingMoment); + } + + private static void AssertAreEqual(double expectedDouble, double? actualDouble) + { + if (double.IsNaN(expectedDouble)) + { + Assert.IsNull(actualDouble); + } + else + { + Assert.AreEqual(expectedDouble, actualDouble); + } + } + + private static void AssertAreEqual(RoundedDouble expectedDouble, double? actualDouble) + { + if (double.IsNaN(expectedDouble)) + { + Assert.IsNull(actualDouble); + } + else + { + Assert.AreEqual(expectedDouble, actualDouble, expectedDouble.GetAccuracy()); + } + } + } +} \ No newline at end of file Index: Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/MacroStabilityInwards/MacroStabilityInwardsSoilLayerTwoDEntityTestFactory.cs =================================================================== diff -u --- Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/MacroStabilityInwards/MacroStabilityInwardsSoilLayerTwoDEntityTestFactory.cs (revision 0) +++ Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/MacroStabilityInwards/MacroStabilityInwardsSoilLayerTwoDEntityTestFactory.cs (revision b3ce286cbc2264994426d07eaf15975b01fcf5f7) @@ -0,0 +1,54 @@ +// 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 Application.Ringtoets.Storage.DbContext; +using Application.Ringtoets.Storage.Serializers; +using Core.Common.Base.Geometry; + +namespace Application.Ringtoets.Storage.TestUtil.MacroStabilityInwards +{ + /// + /// Factory for creating a that can + /// be used for testing. + /// + public static class MacroStabilityInwardsSoilLayerTwoDEntityTestFactory + { + /// + /// Creates a valid . + /// + /// The created . + public static MacroStabilityInwardsSoilLayerTwoDEntity CreateMacroStabilityInwardsSoilLayerTwoDEntity() + { + var random = new Random(31); + var points = new[] + { + new Point2D(random.NextDouble(), random.NextDouble()), + new Point2D(random.NextDouble(), random.NextDouble()) + }; + + return new MacroStabilityInwardsSoilLayerTwoDEntity + { + OuterRingXml = new Point2DXmlSerializer().ToXml(points) + }; + } + } +} \ No newline at end of file Index: Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilProfileEntityTestFactory.cs =================================================================== diff -u --- Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilProfileEntityTestFactory.cs (revision 0) +++ Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilProfileEntityTestFactory.cs (revision b3ce286cbc2264994426d07eaf15975b01fcf5f7) @@ -0,0 +1,52 @@ +// 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 Application.Ringtoets.Storage.DbContext; + +namespace Application.Ringtoets.Storage.TestUtil.MacroStabilityInwards +{ + /// + /// Factory for creating a that can + /// be used for testing. + /// + public static class MacroStabilityInwardsStochasticSoilProfileEntityTestFactory + { + /// + /// Creates a valid . + /// + /// A valid . + public static MacroStabilityInwardsStochasticSoilProfileEntity CreateStochasticSoilProfileEntity() + { + return new MacroStabilityInwardsStochasticSoilProfileEntity + { + Probability = 0.34, + MacroStabilityInwardsSoilProfileOneDEntity = new MacroStabilityInwardsSoilProfileOneDEntity + { + Name = "Profile Name", + MacroStabilityInwardsSoilLayerOneDEntities = + { + new MacroStabilityInwardsSoilLayerOneDEntity() + } + } + }; + } + } +} \ No newline at end of file Index: Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/MigratedDatabaseReader.cs =================================================================== diff -u --- Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/MigratedDatabaseReader.cs (revision 0) +++ Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/MigratedDatabaseReader.cs (revision b3ce286cbc2264994426d07eaf15975b01fcf5f7) @@ -0,0 +1,66 @@ +// 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.Data; +using System.Data.SQLite; +using Core.Common.Base.IO; +using Core.Common.IO.Readers; +using NUnit.Framework; + +namespace Application.Ringtoets.Storage.TestUtil +{ + /// + /// Database reader for a migrated database. + /// + public class MigratedDatabaseReader : SqLiteDatabaseReaderBase + { + /// + /// Creates a new instance of . + /// + /// The path of the database file to open. + /// Thrown when: + /// + /// The contains invalid characters. + /// No file could be found at . + /// Unable to open database file. + /// + /// + public MigratedDatabaseReader(string databaseFilePath) : base(databaseFilePath) {} + + /// + /// Asserts that the results in one field with the value true. + /// + /// The query to execute. + /// The execution of + /// failed. + public void AssertReturnedDataIsValid(string queryString) + { + using (IDataReader dataReader = CreateDataReader(queryString)) + { + Assert.IsTrue(dataReader.Read(), "No data can be read from the data reader " + + $"when using query '{queryString}'."); + Assert.AreEqual(1, dataReader.FieldCount, $"Expected one field, was {dataReader.FieldCount} " + + $"fields when using query '{queryString}'."); + Assert.AreEqual(1, dataReader[0], $"Result should be 1 when using query '{queryString}'."); + } + } + } +} \ No newline at end of file Index: Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/MigrationLogTestHelper.cs =================================================================== diff -u --- Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/MigrationLogTestHelper.cs (revision 0) +++ Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/MigrationLogTestHelper.cs (revision b3ce286cbc2264994426d07eaf15975b01fcf5f7) @@ -0,0 +1,46 @@ +// 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 Application.Ringtoets.Migration.Core; +using NUnit.Framework; + +namespace Application.Ringtoets.Storage.TestUtil +{ + /// + /// Helper class for asserting content of migration log messages. + /// + public static class MigrationLogTestHelper + { + /// + /// Asserts whether corresponds to . + /// + /// The original . + /// The actual . + /// Thrown when + /// does not correspond to . + public static void AssertMigrationLogMessageEqual(MigrationLogMessage expected, MigrationLogMessage actual) + { + Assert.AreEqual(expected.ToVersion, actual.ToVersion); + Assert.AreEqual(expected.FromVersion, actual.FromVersion); + Assert.AreEqual(expected.Message, actual.Message); + } + } +} \ No newline at end of file Index: Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/PipingStochasticSoilProfileEntityTestFactory.cs =================================================================== diff -u --- Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/PipingStochasticSoilProfileEntityTestFactory.cs (revision 0) +++ Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/PipingStochasticSoilProfileEntityTestFactory.cs (revision b3ce286cbc2264994426d07eaf15975b01fcf5f7) @@ -0,0 +1,52 @@ +// 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 Application.Ringtoets.Storage.DbContext; + +namespace Application.Ringtoets.Storage.TestUtil +{ + /// + /// Factory for creating a that can + /// be used for testing. + /// + public static class PipingStochasticSoilProfileEntityTestFactory + { + /// + /// Creates a valid . + /// + /// A valid . + public static PipingStochasticSoilProfileEntity CreateStochasticSoilProfileEntity() + { + return new PipingStochasticSoilProfileEntity + { + Probability = 0.34, + PipingSoilProfileEntity = new PipingSoilProfileEntity + { + Name = "Profile Name", + PipingSoilLayerEntities = + { + new PipingSoilLayerEntity() + } + } + }; + } + } +} \ No newline at end of file Index: Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/Properties/AssemblyInfo.cs =================================================================== diff -u --- Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/Properties/AssemblyInfo.cs (revision 0) +++ Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/Properties/AssemblyInfo.cs (revision b3ce286cbc2264994426d07eaf15975b01fcf5f7) @@ -0,0 +1,25 @@ +// 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; + +[assembly: AssemblyTitle("Application.Ringtoets.Storage.TestUtil")] +[assembly: AssemblyProduct("Application.Ringtoets.Storage.TestUtil")] \ No newline at end of file Index: Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/RingtoetsProjectMigrationTestHelper.cs =================================================================== diff -u --- Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/RingtoetsProjectMigrationTestHelper.cs (revision 0) +++ Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/RingtoetsProjectMigrationTestHelper.cs (revision b3ce286cbc2264994426d07eaf15975b01fcf5f7) @@ -0,0 +1,88 @@ +// 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 Core.Common.TestUtil; +using Ringtoets.Common.Util; + +namespace Application.Ringtoets.Storage.TestUtil +{ + /// + /// Class which provides file paths of the Ringtoets project files that can + /// be used for testing migration functionality. + /// + public static class RingtoetsProjectMigrationTestHelper + { + private static readonly TestDataPath testDataPath = TestDataPath.Application.Ringtoets.Migration.Core; + + /// + /// Retrieves the file path of a Ringtoets project with the latest database version + /// format. + /// + /// A file path to a Ringtoets project file with the latest database version. + public static string GetLatestProjectFilePath() + { + string currentDatabaseVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion(); + string versionSuffix = currentDatabaseVersion.Replace(".", string.Empty); + string projectFileName = $"MigrationTestProject{versionSuffix}.rtd"; + + return TestHelper.GetTestDataPath(testDataPath, projectFileName); + } + + /// + /// Retrieves the file path of a Ringtoets project with an older database version, + /// which is supported for migration. + /// + /// A file path to an outdated Ringtoets project which is supported + /// for migration. + public static string GetOutdatedSupportedProjectFilePath() + { + const string projectFileName = "MigrationTestProject164.rtd"; + return TestHelper.GetTestDataPath(testDataPath, projectFileName); + } + + /// + /// Retrieves the version numbers of all Ringtoets projects with an older database version, + /// which are supported for the migration. + /// + /// An of all the version numbers of supported + /// outdated Ringtoets projects. + public static IEnumerable GetAllOutdatedSupportedProjectFileVersions() + { + yield return "164"; + yield return "171"; + yield return "172"; + yield return "173"; + } + + /// + /// Retrieves the file path of a Ringtoets project with an unsupported database version + /// which is unsupported for migration. + /// + /// A file path to an outdated Ringtoets project which is unsupported for + /// migration. + public static string GetOutdatedUnSupportedProjectFilePath() + { + const string projectFileName = "UnsupportedVersion8.rtd"; + return TestHelper.GetTestDataPath(testDataPath, projectFileName); + } + } +} \ No newline at end of file Index: Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/RingtoetsProjectTestHelper.cs =================================================================== diff -u --- Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/RingtoetsProjectTestHelper.cs (revision 0) +++ Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/RingtoetsProjectTestHelper.cs (revision b3ce286cbc2264994426d07eaf15975b01fcf5f7) @@ -0,0 +1,2198 @@ +// 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 System.Collections.Generic; +using System.Drawing; +using System.Linq; +using Core.Common.Base; +using Core.Common.Base.Data; +using Core.Common.Base.Geometry; +using Core.Common.TestUtil; +using Ringtoets.AssemblyTool.Data; +using Ringtoets.ClosingStructures.Data; +using Ringtoets.ClosingStructures.Data.TestUtil; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.Contribution; +using Ringtoets.Common.Data.DikeProfiles; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Data.IllustrationPoints; +using Ringtoets.Common.Data.Probabilistics; +using Ringtoets.Common.Data.Structures; +using Ringtoets.Common.Primitives; +using Ringtoets.DuneErosion.Data; +using Ringtoets.GrassCoverErosionInwards.Data; +using Ringtoets.GrassCoverErosionOutwards.Data; +using Ringtoets.HeightStructures.Data; +using Ringtoets.HeightStructures.Data.TestUtil; +using Ringtoets.Integration.Data; +using Ringtoets.Integration.Data.StandAlone; +using Ringtoets.Integration.Data.StandAlone.SectionResults; +using Ringtoets.MacroStabilityInwards.Data; +using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Data.TestUtil; +using Ringtoets.MacroStabilityInwards.Primitives; +using Ringtoets.Piping.Data; +using Ringtoets.Piping.Data.SoilProfile; +using Ringtoets.Piping.Data.TestUtil; +using Ringtoets.Piping.Primitives; +using Ringtoets.Piping.Primitives.TestUtil; +using Ringtoets.Revetment.Data; +using Ringtoets.StabilityPointStructures.Data; +using Ringtoets.StabilityPointStructures.Data.TestUtil; +using Ringtoets.StabilityStoneCover.Data; +using Ringtoets.WaveImpactAsphaltCover.Data; + +namespace Application.Ringtoets.Storage.TestUtil +{ + /// + /// This class can be used to create instances which have their properties set and can be used in tests. + /// + public static class RingtoetsProjectTestHelper + { + /// + /// Returns a new complete instance of . + /// + /// A new complete instance of . + public static RingtoetsProject GetFullTestProject() + { + var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike) + { + Name = "assessmentSection", + HydraulicBoundaryDatabase = + { + FilePath = "/temp/test", + Version = "1.0", + CanUsePreprocessor = true, + UsePreprocessor = true, + PreprocessorDirectory = "/temp/preprocessor" + }, + ReferenceLine = GetReferenceLine(), + Id = "12-2", + FailureMechanismContribution = + { + LowerLimitNorm = 1.0 / 10, + SignalingNorm = 1.0 / 1000000, + NormativeNorm = NormType.Signaling + } + }; + + ObservableList hydraulicBoundaryLocations = assessmentSection.HydraulicBoundaryDatabase.Locations; + hydraulicBoundaryLocations.AddRange(GetHydraulicBoundaryLocations()); + + assessmentSection.SetHydraulicBoundaryLocationCalculations(hydraulicBoundaryLocations); + assessmentSection.GrassCoverErosionOutwards.SetHydraulicBoundaryLocationCalculations(hydraulicBoundaryLocations); + ConfigureHydraulicBoundaryLocationCalculations(assessmentSection); + + MacroStabilityInwardsFailureMechanism macroStabilityInwardsFailureMechanism = assessmentSection.MacroStabilityInwards; + ConfigureMacroStabilityInwardsFailureMechanism(macroStabilityInwardsFailureMechanism, assessmentSection); + AddSections(macroStabilityInwardsFailureMechanism); + SetSectionResults(macroStabilityInwardsFailureMechanism.SectionResults); + + PipingFailureMechanism pipingFailureMechanism = assessmentSection.Piping; + ConfigurePipingFailureMechanism(pipingFailureMechanism, assessmentSection); + AddSections(pipingFailureMechanism); + SetSectionResults(pipingFailureMechanism.SectionResults); + + GrassCoverErosionInwardsFailureMechanism grassCoverErosionInwardsFailureMechanism = assessmentSection.GrassCoverErosionInwards; + ConfigureGrassCoverErosionInwardsFailureMechanism(grassCoverErosionInwardsFailureMechanism, assessmentSection); + AddSections(grassCoverErosionInwardsFailureMechanism); + SetSectionResults(grassCoverErosionInwardsFailureMechanism.SectionResults, + (GrassCoverErosionInwardsCalculation) grassCoverErosionInwardsFailureMechanism.Calculations.First()); + + GrassCoverErosionOutwardsFailureMechanism grassCoverErosionOutwardsFailureMechanism = assessmentSection.GrassCoverErosionOutwards; + AddForeshoreProfiles(grassCoverErosionOutwardsFailureMechanism.ForeshoreProfiles); + ConfigureGrassCoverErosionOutwardsFailureMechanism(grassCoverErosionOutwardsFailureMechanism, hydraulicBoundaryLocations); + AddSections(grassCoverErosionOutwardsFailureMechanism); + SetSectionResults(grassCoverErosionOutwardsFailureMechanism.SectionResults); + + StabilityStoneCoverFailureMechanism stabilityStoneCoverFailureMechanism = assessmentSection.StabilityStoneCover; + AddForeshoreProfiles(stabilityStoneCoverFailureMechanism.ForeshoreProfiles); + ConfigureStabilityStoneCoverFailureMechanism(stabilityStoneCoverFailureMechanism, assessmentSection); + AddSections(stabilityStoneCoverFailureMechanism); + SetSectionResults(stabilityStoneCoverFailureMechanism.SectionResults); + + WaveImpactAsphaltCoverFailureMechanism waveImpactAsphaltCoverFailureMechanism = assessmentSection.WaveImpactAsphaltCover; + AddForeshoreProfiles(waveImpactAsphaltCoverFailureMechanism.ForeshoreProfiles); + ConfigureWaveImpactAsphaltCoverFailureMechanism(waveImpactAsphaltCoverFailureMechanism, assessmentSection); + AddSections(waveImpactAsphaltCoverFailureMechanism); + SetSectionResults(waveImpactAsphaltCoverFailureMechanism.SectionResults); + + HeightStructuresFailureMechanism heightStructuresFailureMechanism = assessmentSection.HeightStructures; + AddForeshoreProfiles(heightStructuresFailureMechanism.ForeshoreProfiles); + ConfigureHeightStructuresFailureMechanism(heightStructuresFailureMechanism, assessmentSection); + AddSections(heightStructuresFailureMechanism); + SetSectionResults(heightStructuresFailureMechanism.SectionResults, + (StructuresCalculation) heightStructuresFailureMechanism.Calculations.First()); + + ClosingStructuresFailureMechanism closingStructuresFailureMechanism = assessmentSection.ClosingStructures; + AddForeshoreProfiles(closingStructuresFailureMechanism.ForeshoreProfiles); + ConfigureClosingStructuresFailureMechanism(closingStructuresFailureMechanism, assessmentSection); + AddSections(closingStructuresFailureMechanism); + SetSectionResults(closingStructuresFailureMechanism.SectionResults, + (StructuresCalculation) closingStructuresFailureMechanism.Calculations.First()); + + DuneErosionFailureMechanism duneErosionFailureMechanism = assessmentSection.DuneErosion; + ConfigureDuneErosionFailureMechanism(duneErosionFailureMechanism); + AddSections(duneErosionFailureMechanism); + SetSectionResults(duneErosionFailureMechanism.SectionResults); + + StabilityPointStructuresFailureMechanism stabilityPointStructuresFailureMechanism = assessmentSection.StabilityPointStructures; + AddForeshoreProfiles(stabilityPointStructuresFailureMechanism.ForeshoreProfiles); + ConfigureStabilityPointStructuresFailureMechanism(stabilityPointStructuresFailureMechanism, + assessmentSection); + AddSections(stabilityPointStructuresFailureMechanism); + SetSectionResults(stabilityPointStructuresFailureMechanism.SectionResults, + (StructuresCalculation) stabilityPointStructuresFailureMechanism.Calculations.First()); + + MacroStabilityOutwardsFailureMechanism macroStabilityOutwardsFailureMechanism = assessmentSection.MacroStabilityOutwards; + ConfigureMacroStabilityOutwardsFailureMechanism(macroStabilityOutwardsFailureMechanism); + AddSections(macroStabilityOutwardsFailureMechanism); + SetSectionResults(macroStabilityOutwardsFailureMechanism.SectionResults); + + PipingStructureFailureMechanism pipingStructureFailureMechanism = assessmentSection.PipingStructure; + ConfigurePipingStructureFailureMechanism(pipingStructureFailureMechanism); + AddSections(pipingStructureFailureMechanism); + SetSectionResults(pipingStructureFailureMechanism.SectionResults); + + AddSections(assessmentSection.Microstability); + SetSectionResults(assessmentSection.Microstability.SectionResults); + AddSections(assessmentSection.WaterPressureAsphaltCover); + SetSectionResults(assessmentSection.WaterPressureAsphaltCover.SectionResults); + AddSections(assessmentSection.GrassCoverSlipOffInwards); + SetSectionResults(assessmentSection.GrassCoverSlipOffInwards.SectionResults); + AddSections(assessmentSection.GrassCoverSlipOffOutwards); + SetSectionResults(assessmentSection.GrassCoverSlipOffOutwards.SectionResults); + AddSections(assessmentSection.StrengthStabilityLengthwiseConstruction); + SetSectionResults(assessmentSection.StrengthStabilityLengthwiseConstruction.SectionResults); + SetSectionResults(assessmentSection.DuneErosion.SectionResults); + AddSections(assessmentSection.TechnicalInnovation); + SetSectionResults(assessmentSection.TechnicalInnovation.SectionResults); + + var fullTestProject = new RingtoetsProject + { + Name = "tempProjectFile", + Description = "description", + AssessmentSections = + { + assessmentSection + } + }; + return fullTestProject; + } + + private static void SetSectionResults(IEnumerable sectionResults) + { + var random = new Random(39); + foreach (StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult sectionResult in sectionResults) + { + sectionResult.SimpleAssessmentResult = random.NextEnumValue(); + sectionResult.TailorMadeAssessmentResult = random.NextEnumValue(); + sectionResult.UseManualAssemblyCategoryGroup = random.NextBoolean(); + sectionResult.ManualAssemblyCategoryGroup = random.NextEnumValue(); + } + } + + private static void SetSectionResults(IEnumerable sectionResults) + { + var random = new Random(39); + foreach (TechnicalInnovationFailureMechanismSectionResult sectionResult in sectionResults) + { + sectionResult.SimpleAssessmentResult = random.NextEnumValue(); + sectionResult.TailorMadeAssessmentResult = random.NextEnumValue(); + sectionResult.UseManualAssemblyCategoryGroup = random.NextBoolean(); + sectionResult.ManualAssemblyCategoryGroup = random.NextEnumValue(); + } + } + + private static void SetSectionResults(IEnumerable sectionResults) + { + var random = new Random(39); + foreach (WaterPressureAsphaltCoverFailureMechanismSectionResult sectionResult in sectionResults) + { + sectionResult.SimpleAssessmentResult = random.NextEnumValue(); + sectionResult.TailorMadeAssessmentResult = random.NextEnumValue(); + sectionResult.UseManualAssemblyCategoryGroup = random.NextBoolean(); + sectionResult.ManualAssemblyCategoryGroup = random.NextEnumValue(); + } + } + + private static void SetSectionResults(IEnumerable sectionResults) + { + var random = new Random(21); + foreach (MacroStabilityOutwardsFailureMechanismSectionResult sectionResult in sectionResults) + { + sectionResult.SimpleAssessmentResult = random.NextEnumValue(); + sectionResult.DetailedAssessmentResult = random.NextEnumValue(); + sectionResult.DetailedAssessmentProbability = random.NextDouble(); + sectionResult.TailorMadeAssessmentResult = random.NextEnumValue(); + sectionResult.TailorMadeAssessmentProbability = random.NextDouble(); + sectionResult.UseManualAssemblyCategoryGroup = random.NextBoolean(); + sectionResult.ManualAssemblyCategoryGroup = random.NextEnumValue(); + } + } + + private static void SetSectionResults(IEnumerable sectionResults) + { + var random = new Random(39); + foreach (GrassCoverSlipOffInwardsFailureMechanismSectionResult sectionResult in sectionResults) + { + sectionResult.SimpleAssessmentResult = random.NextEnumValue(); + sectionResult.DetailedAssessmentResult = random.NextEnumValue(); + sectionResult.TailorMadeAssessmentResult = random.NextEnumValue(); + sectionResult.UseManualAssemblyCategoryGroup = random.NextBoolean(); + sectionResult.ManualAssemblyCategoryGroup = random.NextEnumValue(); + } + } + + private static void SetSectionResults(IEnumerable sectionResults) + { + var random = new Random(39); + foreach (GrassCoverSlipOffOutwardsFailureMechanismSectionResult sectionResult in sectionResults) + { + sectionResult.SimpleAssessmentResult = random.NextEnumValue(); + sectionResult.DetailedAssessmentResult = random.NextEnumValue(); + sectionResult.TailorMadeAssessmentResult = random.NextEnumValue(); + sectionResult.UseManualAssemblyCategoryGroup = random.NextBoolean(); + sectionResult.ManualAssemblyCategoryGroup = random.NextEnumValue(); + } + } + + private static void SetSectionResults(IEnumerable sectionResults) + { + var random = new Random(39); + foreach (MicrostabilityFailureMechanismSectionResult sectionResult in sectionResults) + { + sectionResult.SimpleAssessmentResult = random.NextEnumValue(); + sectionResult.DetailedAssessmentResult = random.NextEnumValue(); + sectionResult.TailorMadeAssessmentResult = random.NextEnumValue(); + sectionResult.UseManualAssemblyCategoryGroup = random.NextBoolean(); + sectionResult.ManualAssemblyCategoryGroup = random.NextEnumValue(); + } + } + + private static void SetSectionResults(IEnumerable sectionResults) + { + var random = new Random(39); + foreach (PipingStructureFailureMechanismSectionResult sectionResult in sectionResults) + { + sectionResult.SimpleAssessmentResult = random.NextEnumValue(); + sectionResult.DetailedAssessmentResult = random.NextEnumValue(); + sectionResult.TailorMadeAssessmentResult = random.NextEnumValue(); + sectionResult.UseManualAssemblyCategoryGroup = random.NextBoolean(); + sectionResult.ManualAssemblyCategoryGroup = random.NextEnumValue(); + } + } + + private static void AddSections(IFailureMechanism failureMechanism) + { + failureMechanism.AddSection(new FailureMechanismSection("section 1", new[] + { + new Point2D(0, 2), + new Point2D(2, 3) + })); + failureMechanism.AddSection(new FailureMechanismSection("section 2", new[] + { + new Point2D(2, 3), + new Point2D(4, 5) + })); + failureMechanism.AddSection(new FailureMechanismSection("section 3", new[] + { + new Point2D(4, 5), + new Point2D(2, 3) + })); + } + + private static void AddForeshoreProfiles(ForeshoreProfileCollection foreshoreProfiles) + { + var foreshoreProfile1 = new ForeshoreProfile( + new Point2D(2, 5), new[] + { + new Point2D(1, 6), + new Point2D(8, 5) + }, new BreakWater(BreakWaterType.Caisson, 2.5), + new ForeshoreProfile.ConstructionProperties + { + Id = "fpid", + Name = "FP", + Orientation = 95.5, + X0 = 22.1 + }); + var foreshoreProfile2 = new ForeshoreProfile( + new Point2D(2, 5), Enumerable.Empty(), null, + new ForeshoreProfile.ConstructionProperties + { + Id = "fpid2" + }); + + foreshoreProfiles.AddRange(new[] + { + foreshoreProfile1, + foreshoreProfile2 + }, "some/path/to/foreshoreprofile"); + } + + private static ReferenceLine GetReferenceLine() + { + IEnumerable points = new[] + { + new Point2D(2, 3), + new Point2D(5, 4), + new Point2D(5, 8), + new Point2D(-3, 2) + }; + + var referenceLine = new ReferenceLine(); + referenceLine.SetGeometry(points); + return referenceLine; + } + + private static IEnumerable GetHydraulicBoundaryLocations() + { + yield return new HydraulicBoundaryLocation(13001, "test", 152.3, 2938.5); + yield return new HydraulicBoundaryLocation(13002, "test2", 135.2, 5293.8); + } + + private static void ConfigureHydraulicBoundaryLocationCalculations(AssessmentSection assessmentSection) + { + IEnumerable hydraulicBoundaryLocations = assessmentSection.HydraulicBoundaryDatabase.Locations; + HydraulicBoundaryLocation hydraulicLocationWithoutIllustrationPoints = hydraulicBoundaryLocations.ElementAt(0); + ConfigureCalculationsWithoutIllustrationPointOutput(assessmentSection, hydraulicLocationWithoutIllustrationPoints); + + HydraulicBoundaryLocation hydraulicLocationWithIllustrationPoints = hydraulicBoundaryLocations.ElementAt(1); + ConfigureCalculationsWithIllustrationPointOutput(assessmentSection, hydraulicLocationWithIllustrationPoints); + } + + private static void ConfigureCalculationsWithoutIllustrationPointOutput(AssessmentSection assessmentSection, HydraulicBoundaryLocation hydraulicBoundaryLocation) + { + const bool hasIllustrationPoints = false; + + HydraulicBoundaryLocationCalculation designWaterLevelCalculation = assessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm + .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)); + ConfigureDesignWaterLevelCalculation(designWaterLevelCalculation, hasIllustrationPoints); + + designWaterLevelCalculation = assessmentSection.WaterLevelCalculationsForLowerLimitNorm + .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)); + ConfigureDesignWaterLevelCalculation(designWaterLevelCalculation, hasIllustrationPoints); + + HydraulicBoundaryLocationCalculation waveHeightCalculation = assessmentSection.WaveHeightCalculationsForFactorizedSignalingNorm + .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)); + ConfigureWaveHeightCalculation(waveHeightCalculation, hasIllustrationPoints); + + waveHeightCalculation = assessmentSection.WaveHeightCalculationsForLowerLimitNorm + .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)); + ConfigureWaveHeightCalculation(waveHeightCalculation, hasIllustrationPoints); + } + + private static void ConfigureCalculationsWithIllustrationPointOutput(AssessmentSection assessmentSection, HydraulicBoundaryLocation hydraulicBoundaryLocation) + { + const bool hasIllustrationPoints = true; + + HydraulicBoundaryLocationCalculation designWaterLevelCalculation = assessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm + .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)); + ConfigureDesignWaterLevelCalculation(designWaterLevelCalculation, hasIllustrationPoints); + + designWaterLevelCalculation = assessmentSection.WaterLevelCalculationsForLowerLimitNorm + .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)); + ConfigureDesignWaterLevelCalculation(designWaterLevelCalculation, hasIllustrationPoints); + + HydraulicBoundaryLocationCalculation waveHeightCalculation = assessmentSection.WaveHeightCalculationsForFactorizedSignalingNorm + .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)); + ConfigureWaveHeightCalculation(waveHeightCalculation, hasIllustrationPoints); + + waveHeightCalculation = assessmentSection.WaveHeightCalculationsForLowerLimitNorm + .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)); + ConfigureWaveHeightCalculation(waveHeightCalculation, hasIllustrationPoints); + } + + private static void ConfigureDesignWaterLevelCalculation(HydraulicBoundaryLocationCalculation designWaterLevelCalculation, + bool hasIllustrationPoints) + { + designWaterLevelCalculation.InputParameters.ShouldIllustrationPointsBeCalculated = hasIllustrationPoints; + designWaterLevelCalculation.Output = GetDesignWaterLevelOutput(hasIllustrationPoints); + } + + private static void ConfigureWaveHeightCalculation(HydraulicBoundaryLocationCalculation waveHeightCalculation, + bool hasIllustrationPoints) + { + waveHeightCalculation.InputParameters.ShouldIllustrationPointsBeCalculated = hasIllustrationPoints; + waveHeightCalculation.Output = GetWaveHeightOutput(hasIllustrationPoints); + } + + private static HydraulicBoundaryLocationCalculationOutput GetWaveHeightOutput(bool hasIllustrationPoints) + { + GeneralResult illustrationPoints = hasIllustrationPoints + ? GetConfiguredGeneralResultTopLevelSubMechanismIllustrationPoint() + : null; + + return new HydraulicBoundaryLocationCalculationOutput(2.4, 0, 0, 0, 0, CalculationConvergence.CalculatedNotConverged, illustrationPoints); + } + + private static HydraulicBoundaryLocationCalculationOutput GetDesignWaterLevelOutput(bool hasIllustrationPoints) + { + GeneralResult illustrationPoints = hasIllustrationPoints + ? GetConfiguredGeneralResultTopLevelSubMechanismIllustrationPoint() + : null; + + return new HydraulicBoundaryLocationCalculationOutput(12.4, double.NaN, + double.NaN, double.NaN, + double.NaN, CalculationConvergence.CalculatedConverged, illustrationPoints); + } + + private static GeneralResult GetConfiguredGeneralResultTopLevelSubMechanismIllustrationPoint() + { + var illustrationPointResult = new IllustrationPointResult("Description of result", 5); + var subMechanismIllustrationPointStochast = new SubMechanismIllustrationPointStochast("Name of a stochast", 10, 9, 8); + + var illustrationPoint = new SubMechanismIllustrationPoint("Name of illustrationPoint", 3, new[] + { + subMechanismIllustrationPointStochast + }, new[] + { + illustrationPointResult + }); + + var windDirection = new WindDirection("60", 60); + var topLevelIllustrationPoint = new TopLevelSubMechanismIllustrationPoint(windDirection, + "Closing situation", + illustrationPoint); + + var governingWindDirection = new WindDirection("SSE", 120); + var stochast = new Stochast("Name of a stochast", 13, 37); + return new GeneralResult(governingWindDirection, + new[] + { + stochast + }, + new[] + { + topLevelIllustrationPoint + }); + } + + private static StructuresOutput GetStructuresOutputWithIllustrationPoints() + { + var random = new Random(56); + var output = new StructuresOutput( + random.NextDouble(), + GetConfiguredGeneralResultFaultTreeIllustrationPoint()); + return output; + } + + private static GeneralResult GetConfiguredGeneralResultFaultTreeIllustrationPoint() + { + return new GeneralResult( + new WindDirection("GoverningWindDirection", 180), + new[] + { + new Stochast("Stochast", 0.1, 0.9) + }, + new[] + { + new TopLevelFaultTreeIllustrationPoint( + new WindDirection("WindDirection", 120), + "ClosingSituation", + new IllustrationPointNode( + new FaultTreeIllustrationPoint( + "FaultTreeIllustrationPoint", + 0.5, + new[] + { + new Stochast("Stochast", 0.1, 0.9) + }, CombinationType.And + )) + ) + } + ); + } + + #region MacroStabilityOutwards FailureMechanism + + private static void ConfigureMacroStabilityOutwardsFailureMechanism(MacroStabilityOutwardsFailureMechanism macroStabilityOutwardsFailureMechanism) + { + macroStabilityOutwardsFailureMechanism.MacroStabilityOutwardsProbabilityAssessmentInput.A = 0.6; + } + + #endregion + + #region PipingStructure FailureMechanism + + private static void ConfigurePipingStructureFailureMechanism(PipingStructureFailureMechanism pipingStructureFailureMechanism) + { + pipingStructureFailureMechanism.N = (RoundedDouble) 12.5; + } + + #endregion + + #region StabilityPointStructures FailureMechanism + + private static void ConfigureStabilityPointStructuresFailureMechanism(StabilityPointStructuresFailureMechanism failureMechanism, + IAssessmentSection assessmentSection) + { + failureMechanism.GeneralInput.N = (RoundedDouble) 8.0; + + StabilityPointStructure stabilityPointStructure = new TestStabilityPointStructure("id structure1"); + failureMechanism.StabilityPointStructures.AddRange(new[] + { + stabilityPointStructure, + new TestStabilityPointStructure("id structure2") + }, "path"); + + var random = new Random(56); + + ForeshoreProfile foreshoreProfile = failureMechanism.ForeshoreProfiles[0]; + HydraulicBoundaryLocation hydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations[0]; + failureMechanism.CalculationsGroup.Children.Add(new CalculationGroup + { + Name = "StabilityPoint structures A", + Children = + { + new StructuresCalculation + { + Name = "Calculation 1", + Comments = + { + Body = "Fully configured for greatness!" + }, + InputParameters = + { + BreakWater = + { + Type = BreakWaterType.Dam, + Height = random.NextRoundedDouble() + }, + DrainCoefficient = + { + Mean = random.NextRoundedDouble() + }, + FactorStormDurationOpenStructure = random.NextRoundedDouble(), + FailureProbabilityStructureWithErosion = random.NextDouble(), + ForeshoreProfile = foreshoreProfile, + HydraulicBoundaryLocation = hydraulicBoundaryLocation, + LoadSchematizationType = LoadSchematizationType.Quadratic, + ModelFactorSuperCriticalFlow = + { + Mean = random.NextRoundedDouble() + }, + VolumicWeightWater = random.NextRoundedDouble(), + UseForeshore = random.NextBoolean(), + UseBreakWater = random.NextBoolean(), + StormDuration = + { + Mean = random.NextRoundedDouble() + }, + Structure = stabilityPointStructure, + ShouldIllustrationPointsBeCalculated = false + }, + Output = new StructuresOutput(0.11, null) + }, + new StructuresCalculation + { + Name = "Calculation 2", + Comments = + { + Body = "Fully configured for with general result" + }, + InputParameters = + { + BreakWater = + { + Type = BreakWaterType.Dam, + Height = random.NextRoundedDouble() + }, + DrainCoefficient = + { + Mean = random.NextRoundedDouble() + }, + FactorStormDurationOpenStructure = random.NextRoundedDouble(), + FailureProbabilityStructureWithErosion = random.NextDouble(), + ForeshoreProfile = foreshoreProfile, + HydraulicBoundaryLocation = hydraulicBoundaryLocation, + LoadSchematizationType = LoadSchematizationType.Quadratic, + ModelFactorSuperCriticalFlow = + { + Mean = random.NextRoundedDouble() + }, + VolumicWeightWater = random.NextRoundedDouble(), + UseForeshore = random.NextBoolean(), + UseBreakWater = random.NextBoolean(), + StormDuration = + { + Mean = random.NextRoundedDouble() + }, + Structure = stabilityPointStructure, + ShouldIllustrationPointsBeCalculated = true + }, + Output = GetStructuresOutputWithIllustrationPoints() + } + } + }); + failureMechanism.CalculationsGroup.Children.Add(new CalculationGroup + { + Name = "StabilityPoint structures B" + }); + failureMechanism.CalculationsGroup.Children.Add(new StructuresCalculation()); + } + + private static void SetSectionResults(IEnumerable sectionResults, + StructuresCalculation calculation) + { + var random = new Random(21); + var firstSectionResultHasCalculation = false; + foreach (StabilityPointStructuresFailureMechanismSectionResult sectionResult in sectionResults) + { + sectionResult.SimpleAssessmentResult = random.NextEnumValue(); + sectionResult.DetailedAssessmentResult = random.NextEnumValue(); + sectionResult.TailorMadeAssessmentResult = random.NextEnumValue(); + sectionResult.TailorMadeAssessmentProbability = random.NextDouble(); + sectionResult.UseManualAssemblyProbability = random.NextBoolean(); + sectionResult.ManualAssemblyProbability = random.NextDouble(); + + if (!firstSectionResultHasCalculation) + { + sectionResult.Calculation = calculation; + firstSectionResultHasCalculation = true; + } + } + } + + #endregion + + #region ClosingStructures FailureMechanism + + private static void ConfigureClosingStructuresFailureMechanism(ClosingStructuresFailureMechanism failureMechanism, + IAssessmentSection assessmentSection) + { + failureMechanism.GeneralInput.N2A = 6; + + ClosingStructure closingStructure = new TestClosingStructure("structureA"); + failureMechanism.ClosingStructures.AddRange(new[] + { + closingStructure, + new TestClosingStructure("structureB") + }, @"C:\Folder"); + + ForeshoreProfile foreshoreProfile = failureMechanism.ForeshoreProfiles[0]; + HydraulicBoundaryLocation hydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations[0]; + failureMechanism.CalculationsGroup.Children.Add(new CalculationGroup + { + Name = "Closing structures A", + Children = + { + new StructuresCalculation + { + InputParameters = + { + BreakWater = + { + Type = BreakWaterType.Dam, + Height = (RoundedDouble) 4.4 + }, + FactorStormDurationOpenStructure = (RoundedDouble) 0.56, + FailureProbabilityStructureWithErosion = (RoundedDouble) 0.34, + ForeshoreProfile = foreshoreProfile, + DeviationWaveDirection = (RoundedDouble) 18.18, + DrainCoefficient = + { + Mean = (RoundedDouble) 19.19 + }, + HydraulicBoundaryLocation = hydraulicBoundaryLocation, + ModelFactorSuperCriticalFlow = + { + Mean = (RoundedDouble) 13.13 + }, + StormDuration = + { + Mean = (RoundedDouble) 1.1 + }, + Structure = closingStructure, + UseBreakWater = true, + UseForeshore = true, + ShouldIllustrationPointsBeCalculated = false + }, + Output = new StructuresOutput(0.11, null) + }, + new StructuresCalculation + { + InputParameters = + { + BreakWater = + { + Type = BreakWaterType.Dam, + Height = (RoundedDouble) 4.4 + }, + FactorStormDurationOpenStructure = (RoundedDouble) 0.56, + FailureProbabilityStructureWithErosion = (RoundedDouble) 0.34, + ForeshoreProfile = foreshoreProfile, + DeviationWaveDirection = (RoundedDouble) 18.18, + DrainCoefficient = + { + Mean = (RoundedDouble) 19.19 + }, + HydraulicBoundaryLocation = hydraulicBoundaryLocation, + ModelFactorSuperCriticalFlow = + { + Mean = (RoundedDouble) 13.13 + }, + StormDuration = + { + Mean = (RoundedDouble) 1.1 + }, + Structure = closingStructure, + UseBreakWater = true, + UseForeshore = true, + ShouldIllustrationPointsBeCalculated = true + }, + Output = GetStructuresOutputWithIllustrationPoints() + } + } + }); + failureMechanism.CalculationsGroup.Children.Add(new CalculationGroup + { + Name = "Closing structures B" + }); + failureMechanism.CalculationsGroup.Children.Add(new StructuresCalculation()); + } + + private static void SetSectionResults(IEnumerable sectionResults, + StructuresCalculation calculation) + { + var random = new Random(21); + var firstSectionResultHasCalculation = false; + foreach (ClosingStructuresFailureMechanismSectionResult sectionResult in sectionResults) + { + sectionResult.SimpleAssessmentResult = random.NextEnumValue(); + sectionResult.DetailedAssessmentResult = random.NextEnumValue(); + sectionResult.TailorMadeAssessmentResult = random.NextEnumValue(); + sectionResult.TailorMadeAssessmentProbability = random.NextDouble(); + sectionResult.UseManualAssemblyProbability = random.NextBoolean(); + sectionResult.ManualAssemblyProbability = random.NextDouble(); + + if (!firstSectionResultHasCalculation) + { + sectionResult.Calculation = calculation; + firstSectionResultHasCalculation = true; + } + } + } + + #endregion + + #region DuneErosion FailureMechanism + + private static void ConfigureDuneErosionFailureMechanism(DuneErosionFailureMechanism failureMechanism) + { + failureMechanism.GeneralInput.N = (RoundedDouble) 5.5; + SetDuneLocations(failureMechanism); + } + + private static void SetSectionResults(IEnumerable sectionResults) + { + var random = new Random(42); + foreach (DuneErosionFailureMechanismSectionResult sectionResult in sectionResults) + { + sectionResult.SimpleAssessmentResult = random.NextEnumValue(); + sectionResult.DetailedAssessmentResultForFactorizedSignalingNorm = random.NextEnumValue(); + sectionResult.DetailedAssessmentResultForSignalingNorm = random.NextEnumValue(); + sectionResult.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm = random.NextEnumValue(); + sectionResult.DetailedAssessmentResultForLowerLimitNorm = random.NextEnumValue(); + sectionResult.DetailedAssessmentResultForFactorizedLowerLimitNorm = random.NextEnumValue(); + sectionResult.TailorMadeAssessmentResult = random.NextEnumValue(); + sectionResult.UseManualAssemblyCategoryGroup = random.NextBoolean(); + sectionResult.ManualAssemblyCategoryGroup = random.NextEnumValue(); + } + } + + private static void SetDuneLocations(DuneErosionFailureMechanism failureMechanism) + { + var location = new DuneLocation(12, "DuneLocation", new Point2D(790, 456), + new DuneLocation.ConstructionProperties()); + + failureMechanism.SetDuneLocations(new[] + { + location + }); + ConfigureDuneLocationCalculations(failureMechanism); + } + + private static void ConfigureDuneLocationCalculations(DuneErosionFailureMechanism failureMechanism) + { + SetCalculationOutput(failureMechanism.CalculationsForMechanismSpecificSignalingNorm.Single()); + SetCalculationOutput(failureMechanism.CalculationsForLowerLimitNorm.Single()); + } + + private static void SetCalculationOutput(DuneLocationCalculation calculation) + { + calculation.Output = new DuneLocationCalculationOutput(CalculationConvergence.CalculatedConverged, + new DuneLocationCalculationOutput.ConstructionProperties + { + WaterLevel = 10, + WaveHeight = 20, + WavePeriod = 30, + TargetProbability = 0.4, + TargetReliability = 50, + CalculatedProbability = 0.6, + CalculatedReliability = 70 + }); + } + + #endregion + + #region HeightStructures FailureMechanism + + private static void ConfigureHeightStructuresFailureMechanism(HeightStructuresFailureMechanism failureMechanism, + IAssessmentSection assessmentSection) + { + failureMechanism.GeneralInput.N = (RoundedDouble) 5.0; + + List hydraulicBoundaryLocations = assessmentSection.HydraulicBoundaryDatabase.Locations; + + var heightStructure = new TestHeightStructure(); + failureMechanism.HeightStructures.AddRange(new[] + { + heightStructure, + new TestHeightStructure("IdB", "Structure B") + }, @"/temp/structures"); + + ForeshoreProfile foreshoreProfile = failureMechanism.ForeshoreProfiles[0]; + failureMechanism.CalculationsGroup.Children.Add(new CalculationGroup + { + Name = "Height structures A", + Children = + { + new StructuresCalculation + { + InputParameters = + { + ForeshoreProfile = foreshoreProfile, + HydraulicBoundaryLocation = hydraulicBoundaryLocations[0], + ModelFactorSuperCriticalFlow = + { + Mean = (RoundedDouble) 1.1 + }, + StormDuration = + { + Mean = (RoundedDouble) 1.7 + }, + Structure = heightStructure, + ShouldIllustrationPointsBeCalculated = false + }, + Output = new StructuresOutput(0.11, null) + }, + new StructuresCalculation + { + InputParameters = + { + ForeshoreProfile = foreshoreProfile, + HydraulicBoundaryLocation = hydraulicBoundaryLocations[0], + ModelFactorSuperCriticalFlow = + { + Mean = (RoundedDouble) 1.1 + }, + StormDuration = + { + Mean = (RoundedDouble) 1.7 + }, + Structure = heightStructure, + ShouldIllustrationPointsBeCalculated = true + }, + Output = GetStructuresOutputWithIllustrationPoints() + } + } + }); + failureMechanism.CalculationsGroup.Children.Add(new CalculationGroup + { + Name = "Height structures B" + }); + failureMechanism.CalculationsGroup.Children.Add(new StructuresCalculation()); + } + + private static void SetSectionResults(IEnumerable sectionResults, + StructuresCalculation calculation) + { + var random = new Random(21); + var firstSectionResultHasCalculation = false; + foreach (HeightStructuresFailureMechanismSectionResult sectionResult in sectionResults) + { + sectionResult.SimpleAssessmentResult = random.NextEnumValue(); + sectionResult.DetailedAssessmentResult = random.NextEnumValue(); + sectionResult.TailorMadeAssessmentResult = random.NextEnumValue(); + sectionResult.TailorMadeAssessmentProbability = random.NextDouble(); + sectionResult.UseManualAssemblyProbability = random.NextBoolean(); + sectionResult.ManualAssemblyProbability = random.NextDouble(); + + if (!firstSectionResultHasCalculation) + { + sectionResult.Calculation = calculation; + firstSectionResultHasCalculation = true; + } + } + } + + #endregion + + #region Piping FailureMechanism + + private static void ConfigurePipingFailureMechanism(PipingFailureMechanism pipingFailureMechanism, AssessmentSection assessmentSection) + { + pipingFailureMechanism.PipingProbabilityAssessmentInput.A = 0.9; + + Point2D[] referenceLineGeometryPoints = assessmentSection.ReferenceLine.Points.ToArray(); + + var pipingSoilProfile = new PipingSoilProfile("SoilProfile1D", 0.0, new[] + { + new PipingSoilLayer(1.0) + { + IsAquifer = true, + BelowPhreaticLevel = new LogNormalDistribution + { + Mean = (RoundedDouble) 3.2, + StandardDeviation = (RoundedDouble) 1.2, + Shift = (RoundedDouble) 2.2 + }, + DiameterD70 = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) 2.42, + CoefficientOfVariation = (RoundedDouble) 21.002 + }, + Permeability = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) 0.9982, + CoefficientOfVariation = (RoundedDouble) 0.220 + }, + Color = Color.HotPink, + MaterialName = "HotPinkLayer" + }, + new PipingSoilLayer(2.0) + { + IsAquifer = false, + Color = Color.Empty, + MaterialName = "EmptyLayer" + }, + new PipingSoilLayer(3.0) + { + IsAquifer = false, + Color = Color.FromArgb(0), + MaterialName = "ColorZeroLayer" + } + }, SoilProfileType.SoilProfile1D); + + pipingFailureMechanism.StochasticSoilModels.AddRange(new[] + { + new PipingStochasticSoilModel("modelName", new[] + { + referenceLineGeometryPoints[1], + referenceLineGeometryPoints[2], + referenceLineGeometryPoints[3] + }, new[] + { + new PipingStochasticSoilProfile(0.2, pipingSoilProfile), + new PipingStochasticSoilProfile(0.8, PipingSoilProfileTestFactory.CreatePipingSoilProfile("SoilProfile2D", + SoilProfileType.SoilProfile2D)) + }) + }, "some/path/to/stochasticSoilModelFile"); + pipingFailureMechanism.SurfaceLines.AddRange(new[] + { + GetSurfaceLine() + }, "some/path/to/surfaceLineFile"); + + CalculationGroup pipingCalculationGroup = pipingFailureMechanism.CalculationsGroup; + pipingCalculationGroup.Children.Add(new CalculationGroup + { + Name = "A", + Children = + { + new PipingCalculationScenario(pipingFailureMechanism.GeneralInput) + { + Name = "With HydraulicBoundaryLocation", + IsRelevant = true, + Contribution = (RoundedDouble) 1.0, + Comments = + { + Body = "Calculation with hydraulic boundary location and output" + }, + InputParameters = + { + SurfaceLine = pipingFailureMechanism.SurfaceLines.First(), + HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(), + StochasticSoilModel = pipingFailureMechanism.StochasticSoilModels.First(), + StochasticSoilProfile = pipingFailureMechanism.StochasticSoilModels.First() + .StochasticSoilProfiles.First(), + EntryPointL = (RoundedDouble) 1.0, + ExitPointL = (RoundedDouble) 2.0, + PhreaticLevelExit = + { + Mean = (RoundedDouble) 1.1, + StandardDeviation = (RoundedDouble) 2.2 + }, + DampingFactorExit = + { + Mean = (RoundedDouble) 3.3, + StandardDeviation = (RoundedDouble) 4.4 + } + }, + Output = PipingOutputTestFactory.Create() + }, + new PipingCalculationScenario(pipingFailureMechanism.GeneralInput) + { + Name = "Manual input", + IsRelevant = true, + Contribution = (RoundedDouble) 1.0, + Comments = + { + Body = "Calculation with manual assessment level and output" + }, + InputParameters = + { + SurfaceLine = pipingFailureMechanism.SurfaceLines.First(), + StochasticSoilModel = pipingFailureMechanism.StochasticSoilModels.First(), + StochasticSoilProfile = pipingFailureMechanism.StochasticSoilModels.First() + .StochasticSoilProfiles.First(), + EntryPointL = (RoundedDouble) 1.0, + ExitPointL = (RoundedDouble) 2.0, + PhreaticLevelExit = + { + Mean = (RoundedDouble) 1.1, + StandardDeviation = (RoundedDouble) 2.2 + }, + DampingFactorExit = + { + Mean = (RoundedDouble) 3.3, + StandardDeviation = (RoundedDouble) 4.4 + }, + UseAssessmentLevelManualInput = true, + AssessmentLevel = (RoundedDouble) 6.0 + }, + Output = PipingOutputTestFactory.Create() + } + } + }); + pipingCalculationGroup.Children.Add(new CalculationGroup + { + Name = "B" + }); + pipingCalculationGroup.Children.Add(new PipingCalculationScenario(pipingFailureMechanism.GeneralInput) + { + Name = "C", + IsRelevant = false, + Contribution = (RoundedDouble) 0.5, + Comments = + { + Body = "Another great comment" + }, + InputParameters = + { + SurfaceLine = pipingFailureMechanism.SurfaceLines.First(), + HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(), + StochasticSoilModel = pipingFailureMechanism.StochasticSoilModels.First(), + StochasticSoilProfile = pipingFailureMechanism.StochasticSoilModels.First() + .StochasticSoilProfiles.Skip(1).First(), + EntryPointL = (RoundedDouble) 0.3, + ExitPointL = (RoundedDouble) 2.3, + PhreaticLevelExit = + { + Mean = (RoundedDouble) 12.12, + StandardDeviation = (RoundedDouble) 13.13 + }, + DampingFactorExit = + { + Mean = (RoundedDouble) 14.14, + StandardDeviation = (RoundedDouble) 15.15 + } + }, + Output = null + }); + } + + private static void SetSectionResults(IEnumerable sectionResults) + { + var random = new Random(21); + foreach (PipingFailureMechanismSectionResult sectionResult in sectionResults) + { + sectionResult.SimpleAssessmentResult = random.NextEnumValue(); + sectionResult.DetailedAssessmentResult = random.NextEnumValue(); + sectionResult.TailorMadeAssessmentResult = random.NextEnumValue(); + sectionResult.TailorMadeAssessmentProbability = random.NextDouble(); + sectionResult.UseManualAssemblyProbability = random.NextBoolean(); + sectionResult.ManualAssemblyProbability = random.NextDouble(); + } + } + + private static PipingSurfaceLine GetSurfaceLine() + { + var surfaceLine = new PipingSurfaceLine("Surface line") + { + ReferenceLineIntersectionWorldPoint = new Point2D(4.0, 6.0) + }; + + var geometryPoints = new[] + { + new Point3D(6.0, 6.0, -2.3), + new Point3D(5.8, 6.0, -2.3), // Dike toe at river + new Point3D(5.6, 6.0, 3.4), + new Point3D(4.2, 6.0, 3.5), + new Point3D(4.0, 6.0, 0.5), // Dike toe at polder + new Point3D(3.8, 6.0, 0.5), // Ditch dike side + new Point3D(3.6, 6.0, 0.2), // Bottom ditch dike side + new Point3D(3.4, 6.0, 0.25), // Bottom ditch polder side + new Point3D(3.2, 6.0, 0.5), // Ditch polder side + new Point3D(3.0, 6.0, 0.5) + }; + surfaceLine.SetGeometry(geometryPoints); + + surfaceLine.SetDikeToeAtRiverAt(geometryPoints[1]); + surfaceLine.SetDikeToeAtPolderAt(geometryPoints[4]); + surfaceLine.SetDitchDikeSideAt(geometryPoints[5]); + surfaceLine.SetBottomDitchDikeSideAt(geometryPoints[6]); + surfaceLine.SetBottomDitchPolderSideAt(geometryPoints[7]); + surfaceLine.SetDitchPolderSideAt(geometryPoints[8]); + + return surfaceLine; + } + + #endregion + + #region MacroStabilityInwards FailureMechanism + + private static void ConfigureMacroStabilityInwardsFailureMechanism(MacroStabilityInwardsFailureMechanism macroStabilityInwardsFailureMechanism, + AssessmentSection assessmentSection) + { + macroStabilityInwardsFailureMechanism.MacroStabilityInwardsProbabilityAssessmentInput.A = 0.9; + Point2D[] referenceLineGeometryPoints = assessmentSection.ReferenceLine.Points.ToArray(); + + var soilLayer1D = new MacroStabilityInwardsSoilLayer1D(5) + { + Data = + { + IsAquifer = true, + MaterialName = "SeaShellLayer", + Color = Color.SeaShell, + UsePop = true, + ShearStrengthModel = MacroStabilityInwardsShearStrengthModel.CPhiOrSuCalculated, + AbovePhreaticLevel = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) 0.03, + CoefficientOfVariation = (RoundedDouble) 0.02, + Shift = (RoundedDouble) 0.01 + }, + BelowPhreaticLevel = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) 0.06, + CoefficientOfVariation = (RoundedDouble) 0.05, + Shift = (RoundedDouble) 0.04 + }, + Cohesion = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) 0.07, + CoefficientOfVariation = (RoundedDouble) 0.08 + }, + FrictionAngle = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) 0.09, + CoefficientOfVariation = (RoundedDouble) 0.1 + }, + ShearStrengthRatio = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) 0.11, + CoefficientOfVariation = (RoundedDouble) 0.12 + }, + StrengthIncreaseExponent = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) 0.13, + CoefficientOfVariation = (RoundedDouble) 0.14 + }, + Pop = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) 0.15, + CoefficientOfVariation = (RoundedDouble) 0.16 + } + } + }; + + var soilProfile1D = new MacroStabilityInwardsSoilProfile1D("MacroStabilityInwardsSoilProfile1D", + -10, + new[] + { + soilLayer1D + }); + + var soilLayer2D = new MacroStabilityInwardsSoilLayer2D( + new Ring(new[] + { + new Point2D(0, 0), + new Point2D(1, 1) + }), + new MacroStabilityInwardsSoilLayerData(), new[] + { + new MacroStabilityInwardsSoilLayer2D(new Ring(new[] + { + new Point2D(3, 3), + new Point2D(4, 4) + })) + { + Data = + { + IsAquifer = true, + MaterialName = "Zero", + Color = Color.FromArgb(0), + UsePop = true, + ShearStrengthModel = MacroStabilityInwardsShearStrengthModel.CPhi, + AbovePhreaticLevel = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) 15.901, + CoefficientOfVariation = (RoundedDouble) 5.902, + Shift = (RoundedDouble) 5.903 + }, + BelowPhreaticLevel = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) 5.906, + CoefficientOfVariation = (RoundedDouble) 5.905, + Shift = (RoundedDouble) 5.904 + }, + Cohesion = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) 5.907, + CoefficientOfVariation = (RoundedDouble) 5.908 + }, + FrictionAngle = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) 5.909, + CoefficientOfVariation = (RoundedDouble) 5.91 + }, + ShearStrengthRatio = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) 5.911, + CoefficientOfVariation = (RoundedDouble) 5.912 + }, + StrengthIncreaseExponent = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) 5.913, + CoefficientOfVariation = (RoundedDouble) 5.914 + }, + Pop = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) 5.915, + CoefficientOfVariation = (RoundedDouble) 5.916 + } + } + }, + new MacroStabilityInwardsSoilLayer2D(new Ring(new[] + { + new Point2D(-10, -100), + new Point2D(10, 100) + })) + { + Data = + { + MaterialName = "Empty", + Color = Color.Empty, + ShearStrengthModel = MacroStabilityInwardsShearStrengthModel.SuCalculated + } + } + }) + { + Data = + { + IsAquifer = false, + MaterialName = "GainsboroLayer", + Color = Color.Gainsboro, + UsePop = false, + ShearStrengthModel = MacroStabilityInwardsShearStrengthModel.SuCalculated, + AbovePhreaticLevel = new VariationCoefficientLogNormalDistribution(2) + { + Mean = (RoundedDouble) 10.901, + CoefficientOfVariation = (RoundedDouble) 0.902, + Shift = (RoundedDouble) 0.903 + }, + BelowPhreaticLevel = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) 0.906, + CoefficientOfVariation = (RoundedDouble) 0.905, + Shift = (RoundedDouble) 0.904 + }, + Cohesion = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) 0.907, + CoefficientOfVariation = (RoundedDouble) 0.908 + }, + FrictionAngle = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) 0.909, + CoefficientOfVariation = (RoundedDouble) 0.91 + }, + ShearStrengthRatio = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) 0.911, + CoefficientOfVariation = (RoundedDouble) 0.912 + }, + StrengthIncreaseExponent = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) 0.913, + CoefficientOfVariation = (RoundedDouble) 0.914 + }, + Pop = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) 0.915, + CoefficientOfVariation = (RoundedDouble) 0.916 + } + } + }; + + var soilProfile2D = new MacroStabilityInwardsSoilProfile2D("MacroStabilityInwardsSoilProfile2D", new[] + { + soilLayer2D + }, new[] + { + new MacroStabilityInwardsPreconsolidationStress(new Point2D(1, 2), new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) 3, + CoefficientOfVariation = (RoundedDouble) 4 + }) + }); + + macroStabilityInwardsFailureMechanism.StochasticSoilModels.AddRange(new[] + { + new MacroStabilityInwardsStochasticSoilModel("MacroStabilityInwards model name", new[] + { + referenceLineGeometryPoints[1], + referenceLineGeometryPoints[2], + referenceLineGeometryPoints[3] + }, new[] + { + new MacroStabilityInwardsStochasticSoilProfile(0.3, soilProfile1D), + new MacroStabilityInwardsStochasticSoilProfile(0.7, soilProfile2D) + }) + }, "some/path/to/stochasticSoilModelFile"); + macroStabilityInwardsFailureMechanism.SurfaceLines.AddRange(new[] + { + GetMacroStabilityInwardsSurfaceLine() + }, "some/path/to/surfaceLineFile"); + + CalculationGroup macroStabilityInwardsCalculationGroup = macroStabilityInwardsFailureMechanism.CalculationsGroup; + macroStabilityInwardsCalculationGroup.Children.Add(new CalculationGroup + { + Name = "Calculation group with calculation", + Children = + { + new MacroStabilityInwardsCalculationScenario + { + Name = "Calculation with hydraulic boundary location and output", + IsRelevant = true, + Contribution = (RoundedDouble) 1.0, + Comments = + { + Body = "Nice comment about this calculation!" + }, + InputParameters = + { + SurfaceLine = macroStabilityInwardsFailureMechanism.SurfaceLines.First(), + HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(), + StochasticSoilModel = macroStabilityInwardsFailureMechanism.StochasticSoilModels.First(), + StochasticSoilProfile = macroStabilityInwardsFailureMechanism.StochasticSoilModels.First() + .StochasticSoilProfiles.First(), + SlipPlaneMinimumDepth = (RoundedDouble) 0.2, + SlipPlaneMinimumLength = (RoundedDouble) 0.3, + MaximumSliceWidth = (RoundedDouble) 0.4, + MoveGrid = true, + DikeSoilScenario = MacroStabilityInwardsDikeSoilScenario.ClayDikeOnSand, + WaterLevelRiverAverage = (RoundedDouble) 0.6, + DrainageConstructionPresent = true, + XCoordinateDrainageConstruction = (RoundedDouble) 0.7, + ZCoordinateDrainageConstruction = (RoundedDouble) 0.8, + LocationInputExtreme = + { + WaterLevelPolder = (RoundedDouble) 0.9, + UseDefaultOffsets = false, + PhreaticLineOffsetBelowDikeTopAtRiver = (RoundedDouble) 1.0, + PhreaticLineOffsetBelowDikeTopAtPolder = (RoundedDouble) 1.1, + PhreaticLineOffsetBelowShoulderBaseInside = (RoundedDouble) 1.2, + PhreaticLineOffsetBelowDikeToeAtPolder = (RoundedDouble) 1.3, + PenetrationLength = (RoundedDouble) 1.4 + }, + LocationInputDaily = + { + WaterLevelPolder = (RoundedDouble) 1.5, + UseDefaultOffsets = true, + PhreaticLineOffsetBelowDikeTopAtRiver = (RoundedDouble) 1.6, + PhreaticLineOffsetBelowDikeTopAtPolder = (RoundedDouble) 1.7, + PhreaticLineOffsetBelowShoulderBaseInside = (RoundedDouble) 1.8, + PhreaticLineOffsetBelowDikeToeAtPolder = (RoundedDouble) 1.9 + }, + AdjustPhreaticLine3And4ForUplift = false, + LeakageLengthOutwardsPhreaticLine3 = (RoundedDouble) 2.0, + LeakageLengthInwardsPhreaticLine3 = (RoundedDouble) 2.1, + LeakageLengthOutwardsPhreaticLine4 = (RoundedDouble) 2.2, + LeakageLengthInwardsPhreaticLine4 = (RoundedDouble) 2.3, + PiezometricHeadPhreaticLine2Outwards = (RoundedDouble) 2.4, + PiezometricHeadPhreaticLine2Inwards = (RoundedDouble) 2.5, + GridDeterminationType = MacroStabilityInwardsGridDeterminationType.Manual, + TangentLineDeterminationType = MacroStabilityInwardsTangentLineDeterminationType.Specified, + TangentLineZTop = (RoundedDouble) 2.7, + TangentLineZBottom = (RoundedDouble) 2.6, + TangentLineNumber = 2, + LeftGrid = + { + XLeft = (RoundedDouble) 2.8, + XRight = (RoundedDouble) 2.9, + NumberOfHorizontalPoints = 3, + ZTop = (RoundedDouble) 3.1, + ZBottom = (RoundedDouble) 3.0, + NumberOfVerticalPoints = 4 + }, + RightGrid = + { + XLeft = (RoundedDouble) 3.2, + XRight = (RoundedDouble) 3.3, + NumberOfHorizontalPoints = 5, + ZTop = (RoundedDouble) 3.5, + ZBottom = (RoundedDouble) 3.4, + NumberOfVerticalPoints = 6 + }, + CreateZones = false, + ZoningBoundariesDeterminationType = MacroStabilityInwardsZoningBoundariesDeterminationType.Manual, + ZoneBoundaryLeft = (RoundedDouble) 10, + ZoneBoundaryRight = (RoundedDouble) 12 + }, + Output = MacroStabilityInwardsOutputTestFactory.CreateOutput() + }, + new MacroStabilityInwardsCalculationScenario + { + Name = "Calculation with manual assessment level and output", + IsRelevant = true, + Contribution = (RoundedDouble) 1.0, + Comments = + { + Body = "Nice comment about this calculation!" + }, + InputParameters = + { + SurfaceLine = macroStabilityInwardsFailureMechanism.SurfaceLines.First(), + StochasticSoilModel = macroStabilityInwardsFailureMechanism.StochasticSoilModels.First(), + StochasticSoilProfile = macroStabilityInwardsFailureMechanism.StochasticSoilModels.First() + .StochasticSoilProfiles.First(), + UseAssessmentLevelManualInput = true, + AssessmentLevel = (RoundedDouble) 0.1, + SlipPlaneMinimumDepth = (RoundedDouble) 0.2, + SlipPlaneMinimumLength = (RoundedDouble) 0.3, + MaximumSliceWidth = (RoundedDouble) 0.4, + MoveGrid = true, + DikeSoilScenario = MacroStabilityInwardsDikeSoilScenario.ClayDikeOnSand, + WaterLevelRiverAverage = (RoundedDouble) 0.6, + DrainageConstructionPresent = true, + XCoordinateDrainageConstruction = (RoundedDouble) 0.7, + ZCoordinateDrainageConstruction = (RoundedDouble) 0.8, + LocationInputExtreme = + { + WaterLevelPolder = (RoundedDouble) 0.9, + UseDefaultOffsets = false, + PhreaticLineOffsetBelowDikeTopAtRiver = (RoundedDouble) 1.0, + PhreaticLineOffsetBelowDikeTopAtPolder = (RoundedDouble) 1.1, + PhreaticLineOffsetBelowShoulderBaseInside = (RoundedDouble) 1.2, + PhreaticLineOffsetBelowDikeToeAtPolder = (RoundedDouble) 1.3, + PenetrationLength = (RoundedDouble) 1.4 + }, + LocationInputDaily = + { + WaterLevelPolder = (RoundedDouble) 1.5, + UseDefaultOffsets = true, + PhreaticLineOffsetBelowDikeTopAtRiver = (RoundedDouble) 1.6, + PhreaticLineOffsetBelowDikeTopAtPolder = (RoundedDouble) 1.7, + PhreaticLineOffsetBelowShoulderBaseInside = (RoundedDouble) 1.8, + PhreaticLineOffsetBelowDikeToeAtPolder = (RoundedDouble) 1.9 + }, + AdjustPhreaticLine3And4ForUplift = false, + LeakageLengthOutwardsPhreaticLine3 = (RoundedDouble) 2.0, + LeakageLengthInwardsPhreaticLine3 = (RoundedDouble) 2.1, + LeakageLengthOutwardsPhreaticLine4 = (RoundedDouble) 2.2, + LeakageLengthInwardsPhreaticLine4 = (RoundedDouble) 2.3, + PiezometricHeadPhreaticLine2Outwards = (RoundedDouble) 2.4, + PiezometricHeadPhreaticLine2Inwards = (RoundedDouble) 2.5, + GridDeterminationType = MacroStabilityInwardsGridDeterminationType.Manual, + TangentLineDeterminationType = MacroStabilityInwardsTangentLineDeterminationType.Specified, + TangentLineZTop = (RoundedDouble) 2.7, + TangentLineZBottom = (RoundedDouble) 2.6, + TangentLineNumber = 2, + LeftGrid = + { + XLeft = (RoundedDouble) 2.8, + XRight = (RoundedDouble) 2.9, + NumberOfHorizontalPoints = 3, + ZTop = (RoundedDouble) 3.1, + ZBottom = (RoundedDouble) 3.0, + NumberOfVerticalPoints = 4 + }, + RightGrid = + { + XLeft = (RoundedDouble) 3.2, + XRight = (RoundedDouble) 3.3, + NumberOfHorizontalPoints = 5, + ZTop = (RoundedDouble) 3.5, + ZBottom = (RoundedDouble) 3.4, + NumberOfVerticalPoints = 6 + }, + CreateZones = false, + ZoningBoundariesDeterminationType = MacroStabilityInwardsZoningBoundariesDeterminationType.Manual, + ZoneBoundaryLeft = (RoundedDouble) 5.4, + ZoneBoundaryRight = (RoundedDouble) 6.5 + }, + Output = MacroStabilityInwardsOutputTestFactory.CreateOutput() + } + } + }); + macroStabilityInwardsCalculationGroup.Children.Add(new CalculationGroup + { + Name = "Group without calculations" + }); + macroStabilityInwardsCalculationGroup.Children.Add(new MacroStabilityInwardsCalculationScenario + { + Name = "Scenario without output", + IsRelevant = false, + Contribution = (RoundedDouble) 0.5, + Comments = + { + Body = "Another great comment" + }, + InputParameters = + { + SurfaceLine = macroStabilityInwardsFailureMechanism.SurfaceLines.First(), + HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(), + StochasticSoilModel = macroStabilityInwardsFailureMechanism.StochasticSoilModels.First(), + StochasticSoilProfile = macroStabilityInwardsFailureMechanism.StochasticSoilModels.First() + .StochasticSoilProfiles.Skip(1).First(), + SlipPlaneMinimumDepth = (RoundedDouble) 10.2, + SlipPlaneMinimumLength = (RoundedDouble) 10.3, + MaximumSliceWidth = (RoundedDouble) 10.4, + WaterLevelRiverAverage = (RoundedDouble) 10.6, + XCoordinateDrainageConstruction = (RoundedDouble) 10.7, + ZCoordinateDrainageConstruction = (RoundedDouble) 10.8, + LocationInputExtreme = + { + WaterLevelPolder = (RoundedDouble) 10.9, + PhreaticLineOffsetBelowDikeTopAtRiver = (RoundedDouble) 20.0, + PhreaticLineOffsetBelowDikeTopAtPolder = (RoundedDouble) 20.1, + PhreaticLineOffsetBelowShoulderBaseInside = (RoundedDouble) 20.2, + PhreaticLineOffsetBelowDikeToeAtPolder = (RoundedDouble) 20.3, + PenetrationLength = (RoundedDouble) 20.4 + }, + LocationInputDaily = + { + WaterLevelPolder = (RoundedDouble) 20.5, + PhreaticLineOffsetBelowDikeTopAtRiver = (RoundedDouble) 20.6, + PhreaticLineOffsetBelowDikeTopAtPolder = (RoundedDouble) 20.7, + PhreaticLineOffsetBelowShoulderBaseInside = (RoundedDouble) 20.8, + PhreaticLineOffsetBelowDikeToeAtPolder = (RoundedDouble) 20.9 + }, + LeakageLengthOutwardsPhreaticLine3 = (RoundedDouble) 40.0, + LeakageLengthInwardsPhreaticLine3 = (RoundedDouble) 40.1, + LeakageLengthOutwardsPhreaticLine4 = (RoundedDouble) 40.2, + LeakageLengthInwardsPhreaticLine4 = (RoundedDouble) 40.3, + PiezometricHeadPhreaticLine2Outwards = (RoundedDouble) 40.4, + PiezometricHeadPhreaticLine2Inwards = (RoundedDouble) 40.5, + TangentLineZTop = (RoundedDouble) 40.7, + TangentLineZBottom = (RoundedDouble) 40.6, + TangentLineNumber = 2, + LeftGrid = + { + XLeft = (RoundedDouble) 40.8, + XRight = (RoundedDouble) 40.9, + NumberOfHorizontalPoints = 3, + ZTop = (RoundedDouble) 30.1, + ZBottom = (RoundedDouble) 30.0, + NumberOfVerticalPoints = 4 + }, + RightGrid = + { + XLeft = (RoundedDouble) 30.2, + XRight = (RoundedDouble) 30.3, + NumberOfHorizontalPoints = 5, + ZTop = (RoundedDouble) 30.5, + ZBottom = (RoundedDouble) 30.4, + NumberOfVerticalPoints = 6 + }, + ZoningBoundariesDeterminationType = MacroStabilityInwardsZoningBoundariesDeterminationType.Automatic, + ZoneBoundaryLeft = (RoundedDouble) 1, + ZoneBoundaryRight = (RoundedDouble) 2 + }, + Output = null + }); + } + + private static void SetSectionResults(IEnumerable sectionResults) + { + var random = new Random(21); + foreach (MacroStabilityInwardsFailureMechanismSectionResult sectionResult in sectionResults) + { + sectionResult.SimpleAssessmentResult = random.NextEnumValue(); + sectionResult.DetailedAssessmentResult = random.NextEnumValue(); + sectionResult.TailorMadeAssessmentResult = random.NextEnumValue(); + sectionResult.TailorMadeAssessmentProbability = random.NextDouble(); + sectionResult.UseManualAssemblyProbability = random.NextBoolean(); + sectionResult.ManualAssemblyProbability = random.NextDouble(); + } + } + + private static MacroStabilityInwardsSurfaceLine GetMacroStabilityInwardsSurfaceLine() + { + var surfaceLine = new MacroStabilityInwardsSurfaceLine("MacroStabilityInwards surface line") + { + ReferenceLineIntersectionWorldPoint = new Point2D(4.4, 6.6) + }; + + var geometryPoints = new[] + { + new Point3D(1.0, 6.0, -2.3), + new Point3D(2.8, 6.0, -2.3), + new Point3D(3.6, 6.0, 3.4), + new Point3D(4.2, 6.0, 3.5), + new Point3D(5.0, 6.0, 0.5), + new Point3D(6.8, 6.0, 0.5), + new Point3D(7.6, 6.0, 0.2), + new Point3D(8.4, 6.0, 0.25), + new Point3D(9.2, 6.0, 0.5), + new Point3D(10.0, 6.0, 0.5), + new Point3D(11.0, 6.0, -2.3), + new Point3D(12.8, 6.0, -2.3), + new Point3D(13.6, 6.0, 3.4) + }; + surfaceLine.SetGeometry(geometryPoints); + + surfaceLine.SetSurfaceLevelOutsideAt(geometryPoints[12]); + surfaceLine.SetDikeToeAtRiverAt(geometryPoints[11]); + surfaceLine.SetDikeTopAtPolderAt(geometryPoints[10]); + surfaceLine.SetDikeTopAtRiverAt(geometryPoints[9]); + surfaceLine.SetShoulderBaseInsideAt(geometryPoints[8]); + surfaceLine.SetShoulderTopInsideAt(geometryPoints[7]); + surfaceLine.SetDikeToeAtPolderAt(geometryPoints[6]); + surfaceLine.SetDitchDikeSideAt(geometryPoints[5]); + surfaceLine.SetBottomDitchDikeSideAt(geometryPoints[4]); + surfaceLine.SetBottomDitchPolderSideAt(geometryPoints[3]); + surfaceLine.SetDitchPolderSideAt(geometryPoints[2]); + surfaceLine.SetSurfaceLevelInsideAt(geometryPoints[1]); + + return surfaceLine; + } + + #endregion + + #region GrassCoverErosionInwards FailureMechanism + + private static void ConfigureGrassCoverErosionInwardsFailureMechanism(GrassCoverErosionInwardsFailureMechanism failureMechanism, + IAssessmentSection assessmentSection) + { + failureMechanism.GeneralInput.N = (RoundedDouble) 15.0; + var dikeProfile1 = new DikeProfile(new Point2D(1, 2), + new[] + { + new RoughnessPoint(new Point2D(1, 2), 1), + new RoughnessPoint(new Point2D(3, 4), 0.5) + }, + new[] + { + new Point2D(5, 6), + new Point2D(7, 8) + }, + new BreakWater(BreakWaterType.Caisson, 15), + new DikeProfile.ConstructionProperties + { + Id = "id", + DikeHeight = 1.1, + Name = "2.2", + Orientation = 3.3, + X0 = 4.4 + }); + var dikeProfile2 = new DikeProfile(new Point2D(9, 10), + new[] + { + new RoughnessPoint(new Point2D(11, 12), 1), + new RoughnessPoint(new Point2D(13, 14), 0.5) + }, + new Point2D[0], + null, + new DikeProfile.ConstructionProperties + { + Id = "id2", + DikeHeight = 5.5, + Name = "6.6", + Orientation = 7.7, + X0 = 8.8 + }); + failureMechanism.DikeProfiles.AddRange(new[] + { + dikeProfile1, + dikeProfile2 + }, "some/path/to/dikeprofiles"); + + failureMechanism.CalculationsGroup.Children.Add(new CalculationGroup + { + Name = "GEKB A", + Children = + { + new GrassCoverErosionInwardsCalculation + { + Name = "Calculation 1", + Comments = + { + Body = "Comments for Calculation 1" + }, + InputParameters = + { + DikeProfile = dikeProfile1, + HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations[0], + BreakWater = + { + Height = (RoundedDouble) (dikeProfile1.BreakWater.Height + 0.3), + Type = BreakWaterType.Wall + }, + DikeHeight = (RoundedDouble) (dikeProfile1.DikeHeight + 0.2), + Orientation = dikeProfile1.Orientation, + CriticalFlowRate = + { + Mean = (RoundedDouble) 1.1, + StandardDeviation = (RoundedDouble) 2.2 + }, + DikeHeightCalculationType = DikeHeightCalculationType.CalculateByAssessmentSectionNorm, + OvertoppingRateCalculationType = OvertoppingRateCalculationType.CalculateByProfileSpecificRequiredProbability, + UseForeshore = true, + UseBreakWater = true + }, + Output = new GrassCoverErosionInwardsOutput(new OvertoppingOutput(0.45, true, 1.1, null), + new DikeHeightOutput(0.56, 0.05, 2, 0.06, 3, CalculationConvergence.CalculatedConverged, null), + new OvertoppingRateOutput(0.57, 0.07, 4, 0.08, 5, CalculationConvergence.CalculatedConverged, null)) + }, + new GrassCoverErosionInwardsCalculation + { + Name = "Calculation 2", + Comments = + { + Body = "Comments for Calculation 2" + }, + InputParameters = + { + DikeProfile = dikeProfile1, + HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations[0], + BreakWater = + { + Height = (RoundedDouble) (dikeProfile1.BreakWater.Height + 0.3), + Type = BreakWaterType.Wall + }, + DikeHeight = (RoundedDouble) (dikeProfile1.DikeHeight + 0.2), + Orientation = dikeProfile1.Orientation, + CriticalFlowRate = + { + Mean = (RoundedDouble) 1.1, + StandardDeviation = (RoundedDouble) 2.2 + }, + DikeHeightCalculationType = DikeHeightCalculationType.CalculateByAssessmentSectionNorm, + OvertoppingRateCalculationType = OvertoppingRateCalculationType.CalculateByProfileSpecificRequiredProbability, + UseForeshore = true, + UseBreakWater = true, + ShouldOvertoppingOutputIllustrationPointsBeCalculated = true, + ShouldDikeHeightIllustrationPointsBeCalculated = true, + ShouldOvertoppingRateIllustrationPointsBeCalculated = true + }, + Output = new GrassCoverErosionInwardsOutput(new OvertoppingOutput(0.45, true, 1.1, GetConfiguredGeneralResultFaultTreeIllustrationPoint()), + new DikeHeightOutput(0.56, 0.05, 2, 0.06, 3, CalculationConvergence.CalculatedConverged, GetConfiguredGeneralResultFaultTreeIllustrationPoint()), + new OvertoppingRateOutput(0.57, 0.07, 4, 0.08, 5, CalculationConvergence.CalculatedConverged, GetConfiguredGeneralResultFaultTreeIllustrationPoint())) + } + } + }); + failureMechanism.CalculationsGroup.Children.Add(new CalculationGroup + { + Name = "GEKB B" + }); + failureMechanism.CalculationsGroup.Children.Add( + new GrassCoverErosionInwardsCalculation + { + Name = "Calculation 2", + Comments = + { + Body = "Comments about Calculation 2" + } + }); + } + + private static void SetSectionResults(IEnumerable sectionResults, + GrassCoverErosionInwardsCalculation calculation) + { + var random = new Random(21); + var firstSectionResultHasCalculation = false; + foreach (GrassCoverErosionInwardsFailureMechanismSectionResult sectionResult in sectionResults) + { + sectionResult.SimpleAssessmentResult = random.NextEnumValue(); + sectionResult.DetailedAssessmentResult = random.NextEnumValue(); + sectionResult.TailorMadeAssessmentResult = random.NextEnumValue(); + sectionResult.TailorMadeAssessmentProbability = random.NextDouble(); + sectionResult.UseManualAssemblyProbability = random.NextBoolean(); + sectionResult.ManualAssemblyProbability = random.NextDouble(); + + if (!firstSectionResultHasCalculation) + { + sectionResult.Calculation = calculation; + firstSectionResultHasCalculation = true; + } + } + } + + #endregion + + #region GrassCoverErosionOutwards FailureMechanism + + private static void ConfigureGrassCoverErosionOutwardsFailureMechanism(GrassCoverErosionOutwardsFailureMechanism failureMechanism, + IEnumerable hydraulicBoundaryLocations) + { + failureMechanism.GeneralInput.N = (RoundedDouble) 15.0; + ConfigureHydraulicBoundaryLocationCalculations(failureMechanism, hydraulicBoundaryLocations); + + ForeshoreProfile foreshoreProfile = failureMechanism.ForeshoreProfiles[0]; + failureMechanism.WaveConditionsCalculationGroup.Children.Add(new CalculationGroup + { + Name = "GCEO A", + Children = + { + new GrassCoverErosionOutwardsWaveConditionsCalculation + { + Name = "Calculation 1", + Comments = + { + Body = "Comments for Calculation 1" + }, + InputParameters = + { + ForeshoreProfile = foreshoreProfile, + HydraulicBoundaryLocation = hydraulicBoundaryLocations.ElementAt(0), + BreakWater = + { + Height = (RoundedDouble) (foreshoreProfile.BreakWater.Height + 0.3), + Type = BreakWaterType.Wall + }, + Orientation = foreshoreProfile.Orientation, + UseForeshore = true, + UseBreakWater = true, + UpperBoundaryRevetment = (RoundedDouble) 22.3, + LowerBoundaryRevetment = (RoundedDouble) (-3.2), + UpperBoundaryWaterLevels = (RoundedDouble) 15.3, + LowerBoundaryWaterLevels = (RoundedDouble) (-2.4), + StepSize = WaveConditionsInputStepSize.Two, + CategoryType = FailureMechanismCategoryType.FactorizedLowerLimitNorm + } + } + } + }); + failureMechanism.WaveConditionsCalculationGroup.Children.Add(new CalculationGroup + { + Name = "GCEO B" + }); + failureMechanism.WaveConditionsCalculationGroup.Children.Add( + new GrassCoverErosionOutwardsWaveConditionsCalculation + { + Name = "Calculation 2", + Comments = + { + Body = "Comments for Calculation 2" + }, + InputParameters = + { + ForeshoreProfile = null, + HydraulicBoundaryLocation = hydraulicBoundaryLocations.ElementAt(1), + BreakWater = + { + Height = (RoundedDouble) (foreshoreProfile.BreakWater.Height + 0.1), + Type = BreakWaterType.Dam + }, + Orientation = foreshoreProfile.Orientation, + UseForeshore = false, + UseBreakWater = false, + UpperBoundaryRevetment = (RoundedDouble) 12.3, + LowerBoundaryRevetment = (RoundedDouble) (-3.5), + UpperBoundaryWaterLevels = (RoundedDouble) 13.3, + LowerBoundaryWaterLevels = (RoundedDouble) (-1.9), + StepSize = WaveConditionsInputStepSize.One, + CategoryType = FailureMechanismCategoryType.LowerLimitNorm + }, + Output = new GrassCoverErosionOutwardsWaveConditionsOutput(new[] + { + new WaveConditionsOutput(1, 2, 3, 4, 5, 0.6, 0.7, 0.8, 0.9, CalculationConvergence.NotCalculated), + new WaveConditionsOutput(0, 1, 2, 3, 4, 0.5, 0.6, 0.7, 0.8, CalculationConvergence.NotCalculated) + }) + }); + } + + private static void ConfigureHydraulicBoundaryLocationCalculations(GrassCoverErosionOutwardsFailureMechanism failureMechanism, + IEnumerable hydraulicBoundaryLocations) + { + HydraulicBoundaryLocation hydraulicLocationWithoutIllustrationPoints = hydraulicBoundaryLocations.ElementAt(0); + ConfigureCalculationsWithoutIllustrationPointOutput(failureMechanism, hydraulicLocationWithoutIllustrationPoints); + + HydraulicBoundaryLocation hydraulicLocationWithIllustrationPoints = hydraulicBoundaryLocations.ElementAt(1); + ConfigureCalculationsWithIllustrationPointOutput(failureMechanism, hydraulicLocationWithIllustrationPoints); + } + + private static void ConfigureCalculationsWithoutIllustrationPointOutput(GrassCoverErosionOutwardsFailureMechanism failureMechanism, + HydraulicBoundaryLocation hydraulicBoundaryLocation) + { + const bool hasIllustrationPoints = false; + HydraulicBoundaryLocationCalculation designWaterLevelCalculation = failureMechanism.WaterLevelCalculationsForMechanismSpecificFactorizedSignalingNorm + .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)); + ConfigureDesignWaterLevelCalculation(designWaterLevelCalculation, hasIllustrationPoints); + + HydraulicBoundaryLocationCalculation waveHeightCalculation = failureMechanism.WaveHeightCalculationsForMechanismSpecificFactorizedSignalingNorm + .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)); + ConfigureWaveHeightCalculation(waveHeightCalculation, hasIllustrationPoints); + } + + private static void ConfigureCalculationsWithIllustrationPointOutput(GrassCoverErosionOutwardsFailureMechanism failureMechanism, + HydraulicBoundaryLocation hydraulicBoundaryLocation) + { + const bool hasIllustrationPoints = true; + + HydraulicBoundaryLocationCalculation designWaterLevelCalculation = failureMechanism.WaterLevelCalculationsForMechanismSpecificFactorizedSignalingNorm + .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)); + ConfigureDesignWaterLevelCalculation(designWaterLevelCalculation, hasIllustrationPoints); + + HydraulicBoundaryLocationCalculation waveHeightCalculation = failureMechanism.WaveHeightCalculationsForMechanismSpecificFactorizedSignalingNorm + .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)); + ConfigureWaveHeightCalculation(waveHeightCalculation, hasIllustrationPoints); + } + + private static void SetSectionResults(IEnumerable sectionResults) + { + var random = new Random(37); + foreach (GrassCoverErosionOutwardsFailureMechanismSectionResult sectionResult in sectionResults) + { + sectionResult.SimpleAssessmentResult = random.NextEnumValue(); + sectionResult.DetailedAssessmentResultForFactorizedSignalingNorm = random.NextEnumValue(); + sectionResult.DetailedAssessmentResultForSignalingNorm = random.NextEnumValue(); + sectionResult.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm = random.NextEnumValue(); + sectionResult.DetailedAssessmentResultForLowerLimitNorm = random.NextEnumValue(); + sectionResult.DetailedAssessmentResultForFactorizedLowerLimitNorm = random.NextEnumValue(); + sectionResult.TailorMadeAssessmentResult = random.NextEnumValue(); + sectionResult.UseManualAssemblyCategoryGroup = random.NextBoolean(); + sectionResult.ManualAssemblyCategoryGroup = random.NextEnumValue(); + } + } + + #endregion + + #region StabilityStoneCover FailureMechanism + + private static void ConfigureStabilityStoneCoverFailureMechanism(StabilityStoneCoverFailureMechanism failureMechanism, IAssessmentSection assessmentSection) + { + failureMechanism.GeneralInput.N = (RoundedDouble) 15.0; + + ForeshoreProfile foreshoreProfile = failureMechanism.ForeshoreProfiles[0]; + failureMechanism.WaveConditionsCalculationGroup.Children.Add(new CalculationGroup + { + Name = "SSC A", + Children = + { + new StabilityStoneCoverWaveConditionsCalculation + { + Name = "Calculation 1", + Comments = + { + Body = "Comments for Calculation 1" + }, + InputParameters = + { + ForeshoreProfile = foreshoreProfile, + HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations[0], + BreakWater = + { + Height = (RoundedDouble) (foreshoreProfile.BreakWater.Height + 0.3), + Type = BreakWaterType.Wall + }, + Orientation = foreshoreProfile.Orientation, + UseForeshore = true, + UseBreakWater = true, + UpperBoundaryRevetment = (RoundedDouble) 22.3, + LowerBoundaryRevetment = (RoundedDouble) (-3.2), + UpperBoundaryWaterLevels = (RoundedDouble) 15.3, + LowerBoundaryWaterLevels = (RoundedDouble) (-2.4), + StepSize = WaveConditionsInputStepSize.Two, + CategoryType = AssessmentSectionCategoryType.LowerLimitNorm + } + } + } + }); + failureMechanism.WaveConditionsCalculationGroup.Children.Add(new CalculationGroup + { + Name = "SSC B" + }); + failureMechanism.WaveConditionsCalculationGroup.Children.Add( + new StabilityStoneCoverWaveConditionsCalculation + { + Name = "Calculation 2", + Comments = + { + Body = "Comments for Calculation 2" + }, + InputParameters = + { + ForeshoreProfile = null, + HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations[0], + BreakWater = + { + Height = (RoundedDouble) (foreshoreProfile.BreakWater.Height + 0.1), + Type = BreakWaterType.Dam + }, + Orientation = foreshoreProfile.Orientation, + UseForeshore = false, + UseBreakWater = false, + UpperBoundaryRevetment = (RoundedDouble) 12.3, + LowerBoundaryRevetment = (RoundedDouble) (-3.5), + UpperBoundaryWaterLevels = (RoundedDouble) 13.3, + LowerBoundaryWaterLevels = (RoundedDouble) (-1.9), + StepSize = WaveConditionsInputStepSize.One, + CategoryType = AssessmentSectionCategoryType.SignalingNorm + }, + Output = new StabilityStoneCoverWaveConditionsOutput(new[] + { + new WaveConditionsOutput(1, 2, 3, 4, 5, 0.6, 0.7, 0.8, 0.9, CalculationConvergence.NotCalculated), + new WaveConditionsOutput(0, 1, 2, 3, 4, 0.5, 0.6, 0.7, 0.8, CalculationConvergence.NotCalculated) + }, new[] + { + new WaveConditionsOutput(10, 9, 8, 7, 6, 0.5, 0.4, 0.3, 0.2, CalculationConvergence.NotCalculated), + new WaveConditionsOutput(9, 8, 7, 6, 5, 0.4, 0.3, 0.2, 0.1, CalculationConvergence.NotCalculated) + }) + }); + } + + private static void SetSectionResults(IEnumerable sectionResults) + { + var random = new Random(21); + foreach (StabilityStoneCoverFailureMechanismSectionResult sectionResult in sectionResults) + { + sectionResult.SimpleAssessmentResult = random.NextEnumValue(); + sectionResult.DetailedAssessmentResultForFactorizedSignalingNorm = random.NextEnumValue(); + sectionResult.DetailedAssessmentResultForSignalingNorm = random.NextEnumValue(); + sectionResult.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm = random.NextEnumValue(); + sectionResult.DetailedAssessmentResultForLowerLimitNorm = random.NextEnumValue(); + sectionResult.DetailedAssessmentResultForFactorizedLowerLimitNorm = random.NextEnumValue(); + sectionResult.TailorMadeAssessmentResult = random.NextEnumValue(); + sectionResult.UseManualAssemblyCategoryGroup = random.NextBoolean(); + sectionResult.ManualAssemblyCategoryGroup = random.NextEnumValue(); + } + } + + #endregion + + #region WaveImpactAsphaltCover FailureMechanism + + private static void ConfigureWaveImpactAsphaltCoverFailureMechanism(WaveImpactAsphaltCoverFailureMechanism failureMechanism, IAssessmentSection assessmentSection) + { + failureMechanism.GeneralWaveImpactAsphaltCoverInput.DeltaL = (RoundedDouble) 1337.0; + + ForeshoreProfile foreshoreProfile = failureMechanism.ForeshoreProfiles[0]; + failureMechanism.WaveConditionsCalculationGroup.Children.Add(new CalculationGroup + { + Name = "WIAC A", + Children = + { + new WaveImpactAsphaltCoverWaveConditionsCalculation + { + Name = "Calculation 1", + Comments = + { + Body = "Comments for Calculation 1" + }, + InputParameters = + { + ForeshoreProfile = foreshoreProfile, + HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations[0], + BreakWater = + { + Height = (RoundedDouble) (foreshoreProfile.BreakWater.Height + 0.3), + Type = BreakWaterType.Wall + }, + Orientation = foreshoreProfile.Orientation, + UseForeshore = true, + UseBreakWater = true, + UpperBoundaryRevetment = (RoundedDouble) 22.3, + LowerBoundaryRevetment = (RoundedDouble) (-3.2), + UpperBoundaryWaterLevels = (RoundedDouble) 15.3, + LowerBoundaryWaterLevels = (RoundedDouble) (-2.4), + StepSize = WaveConditionsInputStepSize.Two, + CategoryType = AssessmentSectionCategoryType.SignalingNorm + } + } + } + }); + failureMechanism.WaveConditionsCalculationGroup.Children.Add(new CalculationGroup + { + Name = "WIAC B" + }); + failureMechanism.WaveConditionsCalculationGroup.Children.Add( + new WaveImpactAsphaltCoverWaveConditionsCalculation + { + Name = "Calculation 2", + Comments = + { + Body = "Comments for Calculation 2" + }, + InputParameters = + { + ForeshoreProfile = null, + HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations[0], + BreakWater = + { + Height = (RoundedDouble) (foreshoreProfile.BreakWater.Height + 0.1), + Type = BreakWaterType.Dam + }, + Orientation = foreshoreProfile.Orientation, + UseForeshore = false, + UseBreakWater = false, + UpperBoundaryRevetment = (RoundedDouble) 12.3, + LowerBoundaryRevetment = (RoundedDouble) (-3.5), + UpperBoundaryWaterLevels = (RoundedDouble) 13.3, + LowerBoundaryWaterLevels = (RoundedDouble) (-1.9), + StepSize = WaveConditionsInputStepSize.One, + CategoryType = AssessmentSectionCategoryType.LowerLimitNorm + }, + Output = new WaveImpactAsphaltCoverWaveConditionsOutput(new[] + { + new WaveConditionsOutput(1, 2, 3, 4, 5, 0.6, 0.7, 0.8, 0.9, CalculationConvergence.NotCalculated), + new WaveConditionsOutput(0, 1, 2, 3, 4, 0.5, 0.6, 0.7, 0.8, CalculationConvergence.NotCalculated) + }) + }); + } + + private static void SetSectionResults(IEnumerable sectionResults) + { + var random = new Random(37); + foreach (WaveImpactAsphaltCoverFailureMechanismSectionResult sectionResult in sectionResults) + { + sectionResult.SimpleAssessmentResult = random.NextEnumValue(); + sectionResult.DetailedAssessmentResultForFactorizedSignalingNorm = random.NextEnumValue(); + sectionResult.DetailedAssessmentResultForSignalingNorm = random.NextEnumValue(); + sectionResult.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm = random.NextEnumValue(); + sectionResult.DetailedAssessmentResultForLowerLimitNorm = random.NextEnumValue(); + sectionResult.DetailedAssessmentResultForFactorizedLowerLimitNorm = random.NextEnumValue(); + sectionResult.TailorMadeAssessmentResult = random.NextEnumValue(); + sectionResult.UseManualAssemblyCategoryGroup = random.NextBoolean(); + sectionResult.ManualAssemblyCategoryGroup = random.NextEnumValue(); + } + } + + #endregion + } +} \ No newline at end of file Index: Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/SqLiteDatabaseHelper.cs =================================================================== diff -u --- Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/SqLiteDatabaseHelper.cs (revision 0) +++ Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/SqLiteDatabaseHelper.cs (revision b3ce286cbc2264994426d07eaf15975b01fcf5f7) @@ -0,0 +1,179 @@ +// 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 System.Data.SQLite; +using Application.Ringtoets.Storage.Properties; +using Core.Common.IO; +using NUnit.Framework; +using Ringtoets.Common.Util; +using Ringtoets.Integration.Data; + +namespace Application.Ringtoets.Storage.TestUtil +{ + /// + /// This class is used to prepare test databases for test. + /// + public static class SqLiteDatabaseHelper + { + /// + /// Creates a corrupt database file based on . + /// + /// The database file path. + /// Thrown when + /// is null or whitespace. + public static void CreateCorruptDatabaseFile(string databaseFilePath) + { + CreateDatabaseFile(databaseFilePath, GetCorruptSchema()); + AddVersionEntity(databaseFilePath, RingtoetsVersionHelper.GetCurrentDatabaseVersion()); + } + + /// + /// Creates the complete database file with a VersionEntity row but no project data. + /// + /// The database file path. + /// Thrown when + /// is null or whitespace. + public static void CreateCompleteDatabaseFileWithoutProjectData(string databaseFilePath) + { + CreateCompleteDatabaseFileEmpty(databaseFilePath); + AddVersionEntity(databaseFilePath, RingtoetsVersionHelper.GetCurrentDatabaseVersion()); + } + + /// + /// Creates the complete database file without any rows in any table. + /// + /// The database file path. + public static void CreateCompleteDatabaseFileEmpty(string databaseFilePath) + { + CreateDatabaseFile(databaseFilePath, GetCompleteSchema()); + } + + /// + /// Adds a row to the VersionEntity table with a given database version. + /// + /// The database file path. + /// The database version. + /// Thrown when + /// is null or whitespace. + public static void AddVersionEntity(string databaseFilePath, string databaseVersion) + { + string addVersionRowCommand = GetAddVersionRowCommandText(databaseVersion); + PerformCommandOnDatabase(databaseFilePath, addVersionRowCommand); + } + + /// + /// Creates a new Sqlite database file with the structure defined in . + /// + /// Path to database file. + /// Script that contains the schema to execute on the database. + /// Thrown when executing failed. + /// Thrown when + /// or is null or whitespace. + public static void CreateDatabaseFile(string databaseFilePath, string databaseSchemaQuery) + { + if (string.IsNullOrWhiteSpace(databaseSchemaQuery)) + { + throw new ArgumentNullException(nameof(databaseSchemaQuery)); + } + if (string.IsNullOrWhiteSpace(databaseFilePath)) + { + throw new ArgumentNullException(nameof(databaseFilePath)); + } + + SQLiteConnection.CreateFile(databaseFilePath); + PerformCommandOnDatabase(databaseFilePath, databaseSchemaQuery); + } + + /// + /// Converts the into a new Ringtoets database file. + /// + /// Path to database file. + /// to save. + public static void CreateValidRingtoetsDatabase(string databaseFilePath, RingtoetsProject project) + { + try + { + var storageSqLite = new StorageSqLite(); + storageSqLite.StageProject(project); + storageSqLite.SaveProjectAs(databaseFilePath); + } + catch (Exception exception) + { + Assert.Fail("Precondition failed: creating database file failed due to {0}", exception); + } + finally + { + SQLiteConnection.ClearAllPools(); + } + } + + /// + /// Returns a corrupt database schema that will pass validation. + /// + /// The corrupt database schema that will pass validation. + public static string GetCorruptSchema() + { + return "DROP TABLE IF EXISTS 'VersionEntity'; " + + "CREATE TABLE 'VersionEntity' ('VersionId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT," + + "'Version' VARCHAR(20) NOT NULL,'Timestamp' DATETIME NOT NULL, 'FingerPrint' BLOB NOT NULL);"; + } + + private static string GetCompleteSchema() + { + return Resources.DatabaseStructure; + } + + /// + /// Performs the command on a database. + /// + /// The file path to the database. + /// The command text/query. + /// Thrown when is null or whitespace. + private static void PerformCommandOnDatabase(string databaseFilePath, string commandText) + { + string connectionString = SqLiteConnectionStringBuilder.BuildSqLiteConnectionString(databaseFilePath, false); + using (var dbContext = new SQLiteConnection(connectionString, true)) + { + dbContext.Open(); + using (SQLiteCommand command = dbContext.CreateCommand()) + { + try + { + command.CommandText = commandText; + command.ExecuteNonQuery(); + } + finally + { + SQLiteConnection.ClearAllPools(); + dbContext.Close(); + } + } + } + } + + private static string GetAddVersionRowCommandText(string databaseVersion) + { + return "INSERT INTO VersionEntity (Version, Timestamp, FingerPrint) " + + $"VALUES (\"{databaseVersion}\", '2016-08-10 10:55:48', 'QWERTY')"; + } + } +} \ No newline at end of file Index: Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/TestFailureMechanismSection.cs =================================================================== diff -u --- Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/TestFailureMechanismSection.cs (revision 0) +++ Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/TestFailureMechanismSection.cs (revision b3ce286cbc2264994426d07eaf15975b01fcf5f7) @@ -0,0 +1,34 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using Core.Common.Base.Geometry; +using Ringtoets.Common.Data.FailureMechanism; + +namespace Application.Ringtoets.Storage.TestUtil +{ + public class TestFailureMechanismSection : FailureMechanismSection + { + public TestFailureMechanismSection() : base(string.Empty, new[] + { + new Point2D(0, 0) + }) {} + } +} \ No newline at end of file Index: Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/packages.config =================================================================== diff -u --- Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/packages.config (revision 0) +++ Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil/packages.config (revision b3ce286cbc2264994426d07eaf15975b01fcf5f7) @@ -0,0 +1,27 @@ + + + + + + \ No newline at end of file