Fisheye: Tag a7f0b003155f5f24190b2671ac4d4d840c3b3c0d refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/App.config'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a7f0b003155f5f24190b2671ac4d4d840c3b3c0d refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/Application.Ringtoets.Storage.TestUtil.Test.csproj'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a7f0b003155f5f24190b2671ac4d4d840c3b3c0d refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/Hydraulics/HydraulicLocationEntityTestFactoryTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a7f0b003155f5f24190b2671ac4d4d840c3b3c0d refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/IllustrationPoints/GeneralResultEntityTestHelperTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a7f0b003155f5f24190b2671ac4d4d840c3b3c0d refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/MacroStabilityInwards/MacroStabilityInwardsSoilLayerTwoDEntityTestFactoryTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a7f0b003155f5f24190b2671ac4d4d840c3b3c0d refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilProfileEntityTestFactoryTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a7f0b003155f5f24190b2671ac4d4d840c3b3c0d refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/MigratedDatabaseReaderTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a7f0b003155f5f24190b2671ac4d4d840c3b3c0d refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/PipingStochasticSoilProfileEntityTestFactoryTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a7f0b003155f5f24190b2671ac4d4d840c3b3c0d refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/Properties/AssemblyInfo.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a7f0b003155f5f24190b2671ac4d4d840c3b3c0d refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/RingtoetsProjectMigrationTestHelperTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a7f0b003155f5f24190b2671ac4d4d840c3b3c0d refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/RingtoetsProjectTestHelperTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a7f0b003155f5f24190b2671ac4d4d840c3b3c0d refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/SqLiteDatabaseHelperTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a7f0b003155f5f24190b2671ac4d4d840c3b3c0d refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/TestFailureMechanismSectionTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag a7f0b003155f5f24190b2671ac4d4d840c3b3c0d refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/packages.config'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/App.config
===================================================================
diff -u
--- Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/App.config (revision 0)
+++ Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/App.config (revision a7f0b003155f5f24190b2671ac4d4d840c3b3c0d)
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/Application.Ringtoets.Storage.TestUtil.Test.csproj
===================================================================
diff -u
--- Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/Application.Ringtoets.Storage.TestUtil.Test.csproj (revision 0)
+++ Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/Application.Ringtoets.Storage.TestUtil.Test.csproj (revision a7f0b003155f5f24190b2671ac4d4d840c3b3c0d)
@@ -0,0 +1,153 @@
+
+
+
+ {3EDE00E5-C462-43EF-B8BC-E65D14D7FCF2}
+ Application.Ringtoets.Storage.TestUtil.Test
+ Application.Ringtoets.Storage.TestUtil.Test
+
+
+
+
+ ..\..\..\..\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
+
+
+ ..\..\..\..\packages\System.Data.SQLite.EF6.1.0.106.0\lib\net40\System.Data.SQLite.EF6.dll
+ True
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Copying.licenseheader
+
+
+ Designer
+
+
+
+
+
+ {3BBFD65B-B277-4E50-AE6D-BD24C3434609}
+ Core.Common.Base
+
+
+ {E344867E-9AC9-44C8-88A5-8185681679A9}
+ Core.Common.IO
+
+
+ {F49BD8B2-332A-4C91-A196-8CCE0A2C7D98}
+ Core.Common.Util
+
+
+ {D749EE4C-CE50-4C17-BF01-9A953028C126}
+ Core.Common.TestUtil
+
+
+ {efd7e662-5b69-4b71-a448-565b64e9c033}
+ Migration.Core.Storage
+
+
+ {d08db9e2-6861-44c8-a725-71a70274cc77}
+ Migration.Scripts.Data
+
+
+ {c6309704-d67b-434c-bc98-9f8910bc1d10}
+ Ringtoets.ClosingStructures.Data
+
+
+ {d4200f43-3f72-4f42-af0a-8ced416a38ec}
+ Ringtoets.Common.Data
+
+
+ {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
+
+
+ {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
+
+
+ {83D6B73E-91D5-46B0-9218-955DA1F75F7C}
+ Ringtoets.MacroStabilityInwards.Data
+
+
+ {e9b39743-2dc9-4922-9e0f-6ba3e0e54189}
+ Ringtoets.MacroStabilityInwards.Primitives
+
+
+ {ce994cc9-6f6a-48ac-b4be-02c30a21f4db}
+ Ringtoets.Piping.Data
+
+
+ {14c6f716-64e2-4bc4-a1ef-05865fcefa4c}
+ Ringtoets.Piping.Primitives
+
+
+ {87c2c553-c0bc-40bf-b1ea-b83bff357f27}
+ Ringtoets.Revetment.Data
+
+
+ {3d4b9740-8348-4434-8d77-b611fc6ee57f}
+ Ringtoets.StabilityPointStructures.Data
+
+
+ {b479e3af-7c34-488c-bb73-d324100d36c9}
+ Ringtoets.StabilityStoneCover.Data
+
+
+ {567e0b69-5280-41ce-add6-443725a61c86}
+ Ringtoets.WaveImpactAsphaltCover.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.Test/Hydraulics/HydraulicLocationEntityTestFactoryTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/Hydraulics/HydraulicLocationEntityTestFactoryTest.cs (revision 0)
+++ Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/Hydraulics/HydraulicLocationEntityTestFactoryTest.cs (revision a7f0b003155f5f24190b2671ac4d4d840c3b3c0d)
@@ -0,0 +1,42 @@
+// 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;
+using Application.Ringtoets.Storage.TestUtil.Hydraulics;
+using NUnit.Framework;
+
+namespace Application.Ringtoets.Storage.TestUtil.Test.Hydraulics
+{
+ [TestFixture]
+ public class HydraulicLocationEntityTestFactoryTest
+ {
+ [Test]
+ public void CreateHydraulicLocationEntity_Always_ReturnsExpectedValues()
+ {
+ // Call
+ HydraulicLocationEntity entity = HydraulicLocationEntityTestFactory.CreateHydraulicLocationEntity();
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.IsNotEmpty(entity.Name);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/IllustrationPoints/GeneralResultEntityTestHelperTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/IllustrationPoints/GeneralResultEntityTestHelperTest.cs (revision 0)
+++ Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/IllustrationPoints/GeneralResultEntityTestHelperTest.cs (revision a7f0b003155f5f24190b2671ac4d4d840c3b3c0d)
@@ -0,0 +1,154 @@
+// 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.Linq;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.TestUtil.IllustrationPoints;
+using NUnit.Framework;
+using Ringtoets.Common.Data.IllustrationPoints;
+using Ringtoets.Common.Data.TestUtil.IllustrationPoints;
+
+namespace Application.Ringtoets.Storage.TestUtil.Test.IllustrationPoints
+{
+ [TestFixture]
+ public class GeneralResultEntityTestHelperTest
+ {
+ [Test]
+ public void AssertGeneralResultPropertyValues_WithGeneralResultNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => GeneralResultEntityTestHelper.AssertGeneralResultPropertyValues(null,
+ new GeneralResultFaultTreeIllustrationPointEntity());
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("generalResult", exception.ParamName);
+ }
+
+ [Test]
+ public void AssertGeneralResultPropertyValues_GeneralResultFaultTreeIllustrationPointEntityNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => GeneralResultEntityTestHelper.AssertGeneralResultPropertyValues(new TestGeneralResultFaultTreeIllustrationPoint(),
+ null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("generalResultEntity", exception.ParamName);
+ }
+
+ [Test]
+ public void AssertGeneralResultPropertyValues_GeneralResultAndEntityHaveMatchingPropertyValues_DoesNotThrowException()
+ {
+ // Setup
+ var random = new Random(21);
+
+ var governingWindDirection = new WindDirection("SSE", random.NextDouble());
+ var stochast = new Stochast("Stochast", random.NextDouble(), random.NextDouble());
+ var topLevelFaultTreeIllustrationPoint = new TopLevelFaultTreeIllustrationPoint(WindDirectionTestFactory.CreateTestWindDirection(),
+ string.Empty,
+ new IllustrationPointNode(new TestFaultTreeIllustrationPoint()));
+
+ var generalResult = new GeneralResult(
+ governingWindDirection, new[]
+ {
+ stochast
+ }, new[]
+ {
+ topLevelFaultTreeIllustrationPoint
+ });
+
+ var generalResultEntity = new GeneralResultFaultTreeIllustrationPointEntity
+ {
+ GoverningWindDirectionName = governingWindDirection.Name,
+ GoverningWindDirectionAngle = governingWindDirection.Angle
+ };
+ generalResultEntity.StochastEntities.Add(new StochastEntity());
+ generalResultEntity.TopLevelFaultTreeIllustrationPointEntities.Add(new TopLevelFaultTreeIllustrationPointEntity());
+
+ // Call
+ TestDelegate call = () => GeneralResultEntityTestHelper.AssertGeneralResultPropertyValues(generalResult, generalResultEntity);
+
+ // Assert
+ Assert.DoesNotThrow(call);
+ }
+
+ [Test]
+ [TestCaseSource(nameof(GetDifferentGeneralResultProperties))]
+ public void AssertGeneralResultPropertyValues_DifferentPropertyValues_ThrowsAssertionException(GeneralResult generalResult,
+ GeneralResultFaultTreeIllustrationPointEntity generalResultEntity)
+ {
+ // Call
+ TestDelegate call = () => GeneralResultEntityTestHelper.AssertGeneralResultPropertyValues(generalResult, generalResultEntity);
+
+ // Assert
+ Assert.Throws(call);
+ }
+
+ private static IEnumerable GetDifferentGeneralResultProperties()
+ {
+ var governingWindDirection = new WindDirection("SSE", 50);
+ var generalResult = new GeneralResult(governingWindDirection,
+ Enumerable.Empty(),
+ Enumerable.Empty());
+
+ GeneralResultFaultTreeIllustrationPointEntity generalResultEntityWrongStochastCount =
+ GetBaseLineGeneralResultEntity(governingWindDirection);
+ generalResultEntityWrongStochastCount.StochastEntities.Add(new StochastEntity());
+ yield return new TestCaseData(generalResult, generalResultEntityWrongStochastCount)
+ .SetName("DoesNotMatchStochastCount");
+
+ GeneralResultFaultTreeIllustrationPointEntity generalResultEntityWrongTopLevelCount =
+ GetBaseLineGeneralResultEntity(governingWindDirection);
+ generalResultEntityWrongTopLevelCount.TopLevelFaultTreeIllustrationPointEntities.Add(new TopLevelFaultTreeIllustrationPointEntity());
+ yield return new TestCaseData(generalResult, generalResultEntityWrongTopLevelCount)
+ .SetName("DoesNotMatchTopLevelIllustrationPointCount");
+
+ GeneralResultFaultTreeIllustrationPointEntity generalResultEntityWrongName = GetBaseLineGeneralResultEntity(governingWindDirection);
+ generalResultEntityWrongName.GoverningWindDirectionName = "totally different";
+ yield return new TestCaseData(generalResult, generalResultEntityWrongName)
+ .SetName("DoesNotMatchGoverningWindDirectionName");
+
+ GeneralResultFaultTreeIllustrationPointEntity generalResultEntityWrongAngle = GetBaseLineGeneralResultEntity(governingWindDirection);
+ generalResultEntityWrongAngle.GoverningWindDirectionAngle = 60;
+ yield return new TestCaseData(generalResult, generalResultEntityWrongAngle)
+ .SetName("DoesNotMatchGoverningWindDirectionAngle");
+ }
+
+ ///
+ /// Creates a
+ /// based on the .
+ ///
+ /// The wind direction to base the
+ /// on.
+ /// A .
+ private static GeneralResultFaultTreeIllustrationPointEntity GetBaseLineGeneralResultEntity(WindDirection windDirection)
+ {
+ return new GeneralResultFaultTreeIllustrationPointEntity
+ {
+ GoverningWindDirectionName = windDirection.Name,
+ GoverningWindDirectionAngle = windDirection.Angle
+ };
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/MacroStabilityInwards/MacroStabilityInwardsSoilLayerTwoDEntityTestFactoryTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/MacroStabilityInwards/MacroStabilityInwardsSoilLayerTwoDEntityTestFactoryTest.cs (revision 0)
+++ Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/MacroStabilityInwards/MacroStabilityInwardsSoilLayerTwoDEntityTestFactoryTest.cs (revision a7f0b003155f5f24190b2671ac4d4d840c3b3c0d)
@@ -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;
+using Application.Ringtoets.Storage.Serializers;
+using Application.Ringtoets.Storage.TestUtil.MacroStabilityInwards;
+using Core.Common.Base.Geometry;
+using NUnit.Framework;
+
+namespace Application.Ringtoets.Storage.TestUtil.Test.MacroStabilityInwards
+{
+ [TestFixture]
+ public class MacroStabilityInwardsSoilLayerTwoDEntityTestFactoryTest
+ {
+ [Test]
+ public void CreateMacroStabilityInwardsSoilLayerTwoDEntity_ReturnsMacroStabilityInwardsSoilLayerTwoDEntity()
+ {
+ // Call
+ MacroStabilityInwardsSoilLayerTwoDEntity entity = MacroStabilityInwardsSoilLayerTwoDEntityTestFactory.CreateMacroStabilityInwardsSoilLayerTwoDEntity();
+
+ // Assert
+ Point2D[] outerRing = new Point2DXmlSerializer().FromXml(entity.OuterRingXml);
+ Assert.AreEqual(2, outerRing.Length);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilProfileEntityTestFactoryTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilProfileEntityTestFactoryTest.cs (revision 0)
+++ Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilProfileEntityTestFactoryTest.cs (revision a7f0b003155f5f24190b2671ac4d4d840c3b3c0d)
@@ -0,0 +1,47 @@
+// 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;
+using Application.Ringtoets.Storage.TestUtil.MacroStabilityInwards;
+using NUnit.Framework;
+
+namespace Application.Ringtoets.Storage.TestUtil.Test.MacroStabilityInwards
+{
+ [TestFixture]
+ public class MacroStabilityInwardsStochasticSoilProfileEntityTestFactoryTest
+ {
+ [Test]
+ public void CreateStochasticSoilProfileEntity_Always_SetsExpectedParameters()
+ {
+ // Call
+ MacroStabilityInwardsStochasticSoilProfileEntity entity = MacroStabilityInwardsStochasticSoilProfileEntityTestFactory.CreateStochasticSoilProfileEntity();
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(0.34, entity.Probability);
+
+ MacroStabilityInwardsSoilProfileOneDEntity soilProfileEntity = entity.MacroStabilityInwardsSoilProfileOneDEntity;
+ Assert.IsNotNull(soilProfileEntity);
+ Assert.AreEqual("Profile Name", soilProfileEntity.Name);
+ CollectionAssert.IsNotEmpty(soilProfileEntity.MacroStabilityInwardsSoilLayerOneDEntities);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/MigratedDatabaseReaderTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/MigratedDatabaseReaderTest.cs (revision 0)
+++ Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/MigratedDatabaseReaderTest.cs (revision a7f0b003155f5f24190b2671ac4d4d840c3b3c0d)
@@ -0,0 +1,47 @@
+// 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.IO;
+using Core.Common.IO.Readers;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+
+namespace Application.Ringtoets.Storage.TestUtil.Test
+{
+ [TestFixture]
+ public class MigratedDatabaseReaderTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Setup
+ string path = Path.Combine(TestHelper.GetTestDataPath(TestDataPath.Core.Common.IO, "SqLiteDatabaseReaderBase"),
+ "empty.sqlite");
+
+ // Call
+ using (var reader = new MigratedDatabaseReader(path))
+ {
+ // Assert
+ Assert.IsInstanceOf(reader);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/PipingStochasticSoilProfileEntityTestFactoryTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/PipingStochasticSoilProfileEntityTestFactoryTest.cs (revision 0)
+++ Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/PipingStochasticSoilProfileEntityTestFactoryTest.cs (revision a7f0b003155f5f24190b2671ac4d4d840c3b3c0d)
@@ -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.Storage.DbContext;
+using NUnit.Framework;
+
+namespace Application.Ringtoets.Storage.TestUtil.Test
+{
+ [TestFixture]
+ public class PipingStochasticSoilProfileEntityTestFactoryTest
+ {
+ [Test]
+ public void CreateStochasticSoilProfileEntity_Always_ReturnsEntityWithExpectedProperties()
+ {
+ // Call
+ PipingStochasticSoilProfileEntity entity = PipingStochasticSoilProfileEntityTestFactory.CreateStochasticSoilProfileEntity();
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(0.34, entity.Probability);
+
+ PipingSoilProfileEntity soilProfileEntity = entity.PipingSoilProfileEntity;
+ Assert.IsNotNull(soilProfileEntity);
+ Assert.AreEqual("Profile Name", soilProfileEntity.Name);
+ CollectionAssert.IsNotEmpty(soilProfileEntity.PipingSoilLayerEntities);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/Properties/AssemblyInfo.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/Properties/AssemblyInfo.cs (revision 0)
+++ Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/Properties/AssemblyInfo.cs (revision a7f0b003155f5f24190b2671ac4d4d840c3b3c0d)
@@ -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.Test")]
+[assembly: AssemblyProduct("Application.Ringtoets.Storage.TestUtil.Test")]
\ No newline at end of file
Index: Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/RingtoetsProjectMigrationTestHelperTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/RingtoetsProjectMigrationTestHelperTest.cs (revision 0)
+++ Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/RingtoetsProjectMigrationTestHelperTest.cs (revision a7f0b003155f5f24190b2671ac4d4d840c3b3c0d)
@@ -0,0 +1,156 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using Application.Ringtoets.Migration.Core;
+using Core.Common.Base.Data;
+using Core.Common.TestUtil;
+using Core.Common.Util;
+using NUnit.Framework;
+using Ringtoets.Common.Util;
+
+namespace Application.Ringtoets.Storage.TestUtil.Test
+{
+ [TestFixture]
+ public class RingtoetsProjectMigrationTestHelperTest
+ {
+ private readonly string currentDatabaseVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion();
+
+ [Test]
+ public void GetLatestProjectFilePath_Always_ReturnsProjectFilePathToLatestProjectVersion()
+ {
+ // Call
+ string latestProjectfilePath = RingtoetsProjectMigrationTestHelper.GetLatestProjectFilePath();
+
+ // Assert
+ AssertFilePath(latestProjectfilePath);
+
+ var versionedFile = new RingtoetsVersionedFile(latestProjectfilePath);
+ string actualTestProjectVersion = versionedFile.GetVersion();
+ string assertionMessage = $"Database version {actualTestProjectVersion} of the testproject must match with the current database version {currentDatabaseVersion}.";
+ Assert.AreEqual(currentDatabaseVersion, actualTestProjectVersion, assertionMessage);
+ }
+
+ [Test]
+ public void GetLatestProjectFilePath_Always_ReturnsProjectThatCanBeLoaded()
+ {
+ // Setup
+ string latestProjectfilePath = RingtoetsProjectMigrationTestHelper.GetLatestProjectFilePath();
+
+ // Call
+ IProject project = new StorageSqLite().LoadProject(latestProjectfilePath);
+
+ // Assert
+ Assert.IsNotNull(project);
+ }
+
+ [Test]
+ public void GetOutdatedSupportedProjectFilePath_Always_ReturnsProjectFilePathToSupportedProjectVersion()
+ {
+ // Call
+ string projectFilePath = RingtoetsProjectMigrationTestHelper.GetOutdatedSupportedProjectFilePath();
+
+ // Assert
+ AssertFilePath(projectFilePath);
+
+ var versionedFile = new RingtoetsVersionedFile(projectFilePath);
+ string actualTestProjectVersion = versionedFile.GetVersion();
+ var migrator = new RingtoetsSqLiteDatabaseFileMigrator();
+ Assert.IsTrue(migrator.IsVersionSupported(actualTestProjectVersion));
+ }
+
+ [Test]
+ public void GetAllOutdatedSupportedProjectFileVersions_Always_ReturnsAllProjectFilePathsToSupportedProjectVersions()
+ {
+ // Setup
+ string[] versions = RingtoetsProjectMigrationTestHelper.GetAllOutdatedSupportedProjectFileVersions().ToArray();
+
+ // Call
+ List returnedProjectVersions = versions.Select(v => new RingtoetsVersionedFile(TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration.Core,
+ $"MigrationTestProject{v}.rtd")).GetVersion()).ToList();
+
+ // Assert
+ IEnumerable expectedProjectVersions = new[]
+ {
+ "5",
+ "17.1",
+ "17.2",
+ "17.3"
+ };
+ CollectionAssert.AreEqual(expectedProjectVersions, returnedProjectVersions);
+ }
+
+ [Test]
+ public void GetOutdatedUnsupportedProjectFilePath_Always_ReturnsProjectFilePathToUnsupportedProjectVersion()
+ {
+ // Call
+ string projectFilePath = RingtoetsProjectMigrationTestHelper.GetOutdatedUnSupportedProjectFilePath();
+
+ // Assert
+ AssertFilePath(projectFilePath);
+
+ var versionedFile = new RingtoetsVersionedFile(projectFilePath);
+ string actualTestProjectVersion = versionedFile.GetVersion();
+ var migrator = new RingtoetsSqLiteDatabaseFileMigrator();
+ Assert.IsFalse(migrator.IsVersionSupported(actualTestProjectVersion));
+ }
+
+ [Test]
+ public void AssertMigrationScript_IsEqualToStorageScript()
+ {
+ // Setup
+ string solutionRoot = TestHelper.SolutionRoot;
+ const string baseFileName = "DatabaseStructure";
+ string migrationFileName = $"{baseFileName}{currentDatabaseVersion}";
+
+ string applicationScriptFilePath = Path.Combine(solutionRoot, "build", $"{baseFileName}.sql");
+ string migrationScriptFilePath = Path.Combine(solutionRoot, "Application", "Ringtoets", "src", "Application.Ringtoets.Migration.Core", "EmbeddedResources", $"{migrationFileName}.sql");
+
+ // Precondition
+ AssertFilePath(applicationScriptFilePath);
+ AssertFilePath(migrationScriptFilePath);
+
+ // Call
+ string[] applicationScriptContents = File.ReadAllLines(applicationScriptFilePath);
+ string[] migrationScriptContents = File.ReadAllLines(migrationScriptFilePath);
+
+ // Assert
+ int expectedAmountOfLines = applicationScriptContents.Length;
+ const string assertionMessage = "Application and migration SQL scripts do not have the same length.";
+ Assert.AreEqual(expectedAmountOfLines, migrationScriptContents.Length, assertionMessage);
+
+ for (var i = 0; i < expectedAmountOfLines; i++)
+ {
+ Assert.AreEqual(applicationScriptContents[i],
+ migrationScriptContents[i],
+ $"Mismatch between application and migration SQL scripts detected at line: {i + 1}.");
+ }
+ }
+
+ private static void AssertFilePath(string filePath)
+ {
+ Assert.IsTrue(IOUtils.IsValidFilePath(filePath));
+ Assert.IsTrue(File.Exists(filePath));
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/RingtoetsProjectTestHelperTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/RingtoetsProjectTestHelperTest.cs (revision 0)
+++ Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/RingtoetsProjectTestHelperTest.cs (revision a7f0b003155f5f24190b2671ac4d4d840c3b3c0d)
@@ -0,0 +1,747 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System.Collections.Generic;
+using System.Linq;
+using Core.Common.Base.Geometry;
+using NUnit.Framework;
+using Ringtoets.ClosingStructures.Data;
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.Data.Contribution;
+using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Data.IllustrationPoints;
+using Ringtoets.Common.Data.Structures;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.DuneErosion.Data;
+using Ringtoets.GrassCoverErosionInwards.Data;
+using Ringtoets.GrassCoverErosionOutwards.Data;
+using Ringtoets.HeightStructures.Data;
+using Ringtoets.Integration.Data;
+using Ringtoets.Integration.Data.StandAlone;
+using Ringtoets.MacroStabilityInwards.Data;
+using Ringtoets.MacroStabilityInwards.Data.SoilProfile;
+using Ringtoets.MacroStabilityInwards.Primitives;
+using Ringtoets.Piping.Data;
+using Ringtoets.Piping.Data.SoilProfile;
+using Ringtoets.Piping.Primitives;
+using Ringtoets.StabilityPointStructures.Data;
+using Ringtoets.StabilityStoneCover.Data;
+using Ringtoets.WaveImpactAsphaltCover.Data;
+
+namespace Application.Ringtoets.Storage.TestUtil.Test
+{
+ [TestFixture]
+ public class RingtoetsProjectTestHelperTest
+ {
+ [Test]
+ public void GetFullTestProject_Always_ReturnsFullProject()
+ {
+ // Setup
+ const string expectedProjectName = "tempProjectFile";
+ const string expectedDescription = "description";
+ const string expectedAssessmentSectionName = "assessmentSection";
+
+ // Call
+ RingtoetsProject project = RingtoetsProjectTestHelper.GetFullTestProject();
+
+ // Assert
+ Assert.AreEqual(expectedProjectName, project.Name);
+ Assert.AreEqual(expectedDescription, project.Description);
+
+ AssessmentSection assessmentSection = project.AssessmentSections.FirstOrDefault();
+ Assert.NotNull(assessmentSection);
+ Assert.AreEqual(expectedAssessmentSectionName, assessmentSection.Name);
+ Assert.AreEqual("12-2", assessmentSection.Id);
+
+ FailureMechanismContribution contribution = assessmentSection.FailureMechanismContribution;
+ Assert.AreEqual(1.0 / 10, contribution.LowerLimitNorm);
+ Assert.AreEqual(1.0 / 1000000, contribution.SignalingNorm);
+ Assert.AreEqual(NormType.Signaling, contribution.NormativeNorm);
+
+ AssertHydraulicBoundaryDatabase(assessmentSection.HydraulicBoundaryDatabase);
+ AssertHydraulicBoundaryLocationCalculations(assessmentSection);
+
+ AssertPipingFailureMechanism(assessmentSection);
+
+ AssertMacroStabilityInwardsFailureMechanism(assessmentSection);
+
+ AssertMacroStabilityOutwardsFailureMechanism(assessmentSection);
+
+ AssertGrassCoverErosionInwardsFailureMechanism(assessmentSection);
+
+ AssertGrassCoverErosionOutwardsFailureMechanism(assessmentSection);
+
+ AssertStabilityStoneCoverFailureMechanism(assessmentSection);
+
+ AssertWaveImpactAsphaltCoverFailureMechanism(assessmentSection);
+
+ AssertHeightStructuresFailureMechanism(assessmentSection);
+
+ AssertClosingStructuresFailureMechanism(assessmentSection);
+
+ AssertStabilityPointStructuresFailureMechanism(assessmentSection);
+
+ AssertPipingStructureFailureMechanism(assessmentSection);
+
+ AssertDuneErosionFailureMechanism(assessmentSection);
+ }
+
+ private static void AssertPipingFailureMechanism(AssessmentSection assessmentSection)
+ {
+ PipingFailureMechanism failureMechanism = assessmentSection.Piping;
+ Assert.AreEqual(0.9, failureMechanism.PipingProbabilityAssessmentInput.A);
+ Assert.AreEqual("some/path/to/stochasticSoilModelFile", failureMechanism.StochasticSoilModels.SourcePath);
+ Assert.AreEqual(1, failureMechanism.StochasticSoilModels.Count);
+ PipingStochasticSoilModel soilModel = failureMechanism.StochasticSoilModels[0];
+ Assert.AreEqual("modelName", soilModel.Name);
+
+ PipingStochasticSoilProfile[] stochasticSoilProfiles = soilModel.StochasticSoilProfiles.ToArray();
+ Assert.AreEqual(2, stochasticSoilProfiles.Length);
+ PipingStochasticSoilProfile stochasticSoilProfile1 = stochasticSoilProfiles[0];
+ Assert.AreEqual(0.2, stochasticSoilProfile1.Probability);
+ Assert.AreEqual(SoilProfileType.SoilProfile1D, stochasticSoilProfile1.SoilProfile.SoilProfileSourceType);
+ PipingStochasticSoilProfile stochasticSoilProfile2 = stochasticSoilProfiles[1];
+ Assert.AreEqual(0.8, stochasticSoilProfile2.Probability);
+ Assert.AreEqual(SoilProfileType.SoilProfile2D, stochasticSoilProfile2.SoilProfile.SoilProfileSourceType);
+
+ Assert.AreEqual("some/path/to/surfaceLineFile", failureMechanism.SurfaceLines.SourcePath);
+ Assert.AreEqual(1, failureMechanism.SurfaceLines.Count);
+ PipingSurfaceLine surfaceLine = failureMechanism.SurfaceLines.First();
+ Assert.AreEqual("Surface line", surfaceLine.Name);
+ Assert.AreEqual(new Point2D(4.0, 6.0), surfaceLine.ReferenceLineIntersectionWorldPoint);
+ var geometryPoints = new[]
+ {
+ new Point3D(6.0, 6.0, -2.3),
+ new Point3D(5.8, 6.0, -2.3),
+ new Point3D(5.6, 6.0, 3.4),
+ new Point3D(4.2, 6.0, 3.5),
+ new Point3D(4.0, 6.0, 0.5),
+ new Point3D(3.8, 6.0, 0.5),
+ new Point3D(3.6, 6.0, 0.2),
+ new Point3D(3.4, 6.0, 0.25),
+ new Point3D(3.2, 6.0, 0.5),
+ new Point3D(3.0, 6.0, 0.5)
+ };
+ CollectionAssert.AreEqual(geometryPoints, surfaceLine.Points);
+ Assert.AreSame(surfaceLine.Points.ElementAt(1), surfaceLine.DikeToeAtRiver);
+ Assert.AreSame(surfaceLine.Points.ElementAt(4), surfaceLine.DikeToeAtPolder);
+ Assert.AreSame(surfaceLine.Points.ElementAt(5), surfaceLine.DitchDikeSide);
+ Assert.AreSame(surfaceLine.Points.ElementAt(6), surfaceLine.BottomDitchDikeSide);
+ Assert.AreSame(surfaceLine.Points.ElementAt(7), surfaceLine.BottomDitchPolderSide);
+ Assert.AreSame(surfaceLine.Points.ElementAt(8), surfaceLine.DitchPolderSide);
+
+ Assert.NotNull(failureMechanism.CalculationsGroup);
+ Assert.AreEqual(3, failureMechanism.CalculationsGroup.Children.Count);
+
+ var firstCalculationGroup = (CalculationGroup) failureMechanism.CalculationsGroup.Children[0];
+ Assert.AreEqual(2, firstCalculationGroup.Children.Count);
+
+ var calculationWithOutput = (PipingCalculationScenario) firstCalculationGroup.Children[0];
+ Assert.IsTrue(calculationWithOutput.HasOutput);
+ Assert.IsFalse(calculationWithOutput.InputParameters.UseAssessmentLevelManualInput);
+
+ var calculationWithAssessmentLevelAndOutput = (PipingCalculationScenario) firstCalculationGroup.Children[1];
+ Assert.IsTrue(calculationWithAssessmentLevelAndOutput.HasOutput);
+ Assert.IsTrue(calculationWithAssessmentLevelAndOutput.InputParameters.UseAssessmentLevelManualInput);
+
+ var emptyCalculationGroup = (CalculationGroup) failureMechanism.CalculationsGroup.Children[1];
+ Assert.AreEqual(0, emptyCalculationGroup.Children.Count);
+
+ var calculationWithoutOutput = (PipingCalculationScenario) failureMechanism.CalculationsGroup.Children[2];
+ Assert.IsFalse(calculationWithoutOutput.HasOutput);
+ }
+
+ private static void AssertMacroStabilityInwardsFailureMechanism(AssessmentSection assessmentSection)
+ {
+ MacroStabilityInwardsFailureMechanism failureMechanism = assessmentSection.MacroStabilityInwards;
+ Assert.AreEqual(0.9, failureMechanism.MacroStabilityInwardsProbabilityAssessmentInput.A);
+ Assert.AreEqual("some/path/to/stochasticSoilModelFile", failureMechanism.StochasticSoilModels.SourcePath);
+ Assert.AreEqual(1, failureMechanism.StochasticSoilModels.Count);
+ MacroStabilityInwardsStochasticSoilModel soilModel = failureMechanism.StochasticSoilModels[0];
+ Assert.AreEqual("MacroStabilityInwards model name", soilModel.Name);
+
+ MacroStabilityInwardsStochasticSoilProfile[] stochasticSoilProfiles = soilModel.StochasticSoilProfiles.ToArray();
+ Assert.AreEqual(2, stochasticSoilProfiles.Length);
+ MacroStabilityInwardsStochasticSoilProfile stochasticSoilProfile1 = stochasticSoilProfiles[0];
+ Assert.AreEqual(0.3, stochasticSoilProfile1.Probability);
+ Assert.IsInstanceOf(stochasticSoilProfile1.SoilProfile);
+ MacroStabilityInwardsStochasticSoilProfile stochasticSoilProfile2 = stochasticSoilProfiles[1];
+ Assert.AreEqual(0.7, stochasticSoilProfile2.Probability);
+ Assert.IsInstanceOf(stochasticSoilProfile2.SoilProfile);
+ CollectionAssert.IsNotEmpty(((MacroStabilityInwardsSoilProfile2D) stochasticSoilProfile2.SoilProfile).PreconsolidationStresses);
+
+ Assert.AreEqual("some/path/to/surfaceLineFile", failureMechanism.SurfaceLines.SourcePath);
+ Assert.AreEqual(1, failureMechanism.SurfaceLines.Count);
+ MacroStabilityInwardsSurfaceLine surfaceLine = failureMechanism.SurfaceLines.First();
+ Assert.AreEqual("MacroStabilityInwards surface line", surfaceLine.Name);
+ Assert.AreEqual(new Point2D(4.4, 6.6), surfaceLine.ReferenceLineIntersectionWorldPoint);
+ 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)
+ };
+ CollectionAssert.AreEqual(geometryPoints, surfaceLine.Points);
+
+ Assert.AreEqual(surfaceLine.Points.ElementAt(12), surfaceLine.SurfaceLevelOutside);
+ Assert.AreEqual(surfaceLine.Points.ElementAt(11), surfaceLine.DikeToeAtRiver);
+ Assert.AreEqual(surfaceLine.Points.ElementAt(10), surfaceLine.DikeTopAtPolder);
+ Assert.AreEqual(surfaceLine.Points.ElementAt(9), surfaceLine.DikeTopAtRiver);
+ Assert.AreEqual(surfaceLine.Points.ElementAt(8), surfaceLine.ShoulderBaseInside);
+ Assert.AreEqual(surfaceLine.Points.ElementAt(7), surfaceLine.ShoulderTopInside);
+ Assert.AreEqual(surfaceLine.Points.ElementAt(6), surfaceLine.DikeToeAtPolder);
+ Assert.AreEqual(surfaceLine.Points.ElementAt(5), surfaceLine.DitchDikeSide);
+ Assert.AreEqual(surfaceLine.Points.ElementAt(4), surfaceLine.BottomDitchDikeSide);
+ Assert.AreEqual(surfaceLine.Points.ElementAt(3), surfaceLine.BottomDitchPolderSide);
+ Assert.AreEqual(surfaceLine.Points.ElementAt(2), surfaceLine.DitchPolderSide);
+ Assert.AreEqual(surfaceLine.Points.ElementAt(1), surfaceLine.SurfaceLevelInside);
+
+ Assert.NotNull(failureMechanism.CalculationsGroup);
+ Assert.AreEqual(3, failureMechanism.CalculationsGroup.Children.Count);
+
+ var firstCalculationGroup = (CalculationGroup) failureMechanism.CalculationsGroup.Children[0];
+ Assert.AreEqual(2, firstCalculationGroup.Children.Count);
+
+ var calculationWithOutput = (MacroStabilityInwardsCalculationScenario) firstCalculationGroup.Children[0];
+ Assert.IsTrue(calculationWithOutput.HasOutput);
+ Assert.IsFalse(calculationWithOutput.InputParameters.UseAssessmentLevelManualInput);
+
+ var calculationWithAssessmentLevelAndOutput = (MacroStabilityInwardsCalculationScenario) firstCalculationGroup.Children[1];
+ Assert.IsTrue(calculationWithAssessmentLevelAndOutput.HasOutput);
+ Assert.IsTrue(calculationWithAssessmentLevelAndOutput.InputParameters.UseAssessmentLevelManualInput);
+
+ var emptyCalculationGroup = (CalculationGroup) failureMechanism.CalculationsGroup.Children[1];
+ Assert.AreEqual(0, emptyCalculationGroup.Children.Count);
+
+ var calculationWithoutOutput = (MacroStabilityInwardsCalculationScenario) failureMechanism.CalculationsGroup.Children[2];
+ Assert.IsFalse(calculationWithoutOutput.HasOutput);
+ }
+
+ private static void AssertMacroStabilityOutwardsFailureMechanism(AssessmentSection assessmentSection)
+ {
+ MacroStabilityOutwardsFailureMechanism failureMechanism = assessmentSection.MacroStabilityOutwards;
+ Assert.AreEqual(0.6, failureMechanism.MacroStabilityOutwardsProbabilityAssessmentInput.A);
+ }
+
+ private static void AssertGrassCoverErosionInwardsFailureMechanism(AssessmentSection assessmentSection)
+ {
+ GrassCoverErosionInwardsFailureMechanism failureMechanism = assessmentSection.GrassCoverErosionInwards;
+ Assert.AreEqual(15.0, failureMechanism.GeneralInput.N, failureMechanism.GeneralInput.N.GetAccuracy());
+
+ Assert.NotNull(failureMechanism.CalculationsGroup);
+ Assert.AreEqual(3, failureMechanism.CalculationsGroup.Children.Count);
+
+ var firstCalculationGroup = (CalculationGroup) failureMechanism.CalculationsGroup.Children[0];
+ Assert.AreEqual(2, firstCalculationGroup.Children.Count);
+
+ var calculationWithOutput = (GrassCoverErosionInwardsCalculation) firstCalculationGroup.Children[0];
+ Assert.IsTrue(calculationWithOutput.HasOutput);
+ GrassCoverErosionInwardsOutput calculationOutput = calculationWithOutput.Output;
+ Assert.IsFalse(calculationOutput.OvertoppingOutput.HasGeneralResult);
+ Assert.IsFalse(calculationOutput.DikeHeightOutput.HasGeneralResult);
+ Assert.IsFalse(calculationOutput.OvertoppingRateOutput.HasGeneralResult);
+
+ var calculationWithOutputAndGeneralResult = (GrassCoverErosionInwardsCalculation) firstCalculationGroup.Children[1];
+ Assert.IsTrue(calculationWithOutputAndGeneralResult.HasOutput);
+ GrassCoverErosionInwardsOutput outputCalculationWithGeneralResult = calculationWithOutputAndGeneralResult.Output;
+ AssertGeneralResultTopLevelFaultTreeIllustrationPoint(outputCalculationWithGeneralResult.OvertoppingOutput.GeneralResult);
+ AssertGeneralResultTopLevelFaultTreeIllustrationPoint(outputCalculationWithGeneralResult.DikeHeightOutput.GeneralResult);
+ AssertGeneralResultTopLevelFaultTreeIllustrationPoint(outputCalculationWithGeneralResult.OvertoppingRateOutput.GeneralResult);
+
+ var emptyCalculationGroup = (CalculationGroup) failureMechanism.CalculationsGroup.Children[1];
+ Assert.AreEqual(0, emptyCalculationGroup.Children.Count);
+
+ var calculationWithoutOutput = (GrassCoverErosionInwardsCalculation) failureMechanism.CalculationsGroup.Children[2];
+ Assert.IsFalse(calculationWithoutOutput.HasOutput);
+
+ GrassCoverErosionInwardsFailureMechanismSectionResult firstSectionResult = failureMechanism.SectionResults.First();
+ Assert.AreSame(calculationWithOutput, firstSectionResult.Calculation);
+ }
+
+ private static void AssertGrassCoverErosionOutwardsFailureMechanism(AssessmentSection assessmentSection)
+ {
+ GrassCoverErosionOutwardsFailureMechanism failureMechanism = assessmentSection.GrassCoverErosionOutwards;
+ Assert.AreEqual(15.0, failureMechanism.GeneralInput.N, failureMechanism.GeneralInput.N.GetAccuracy());
+
+ HydraulicBoundaryDatabase hydraulicBoundaryDatabase = assessmentSection.HydraulicBoundaryDatabase;
+ HydraulicBoundaryLocation hydraulicBoundaryLocation = hydraulicBoundaryDatabase.Locations[0];
+ AssertHydraulicBoundaryLocationCalculationsWithoutIllustrationPoints(failureMechanism, hydraulicBoundaryLocation);
+
+ HydraulicBoundaryLocation hydraulicBoundaryLocationWithIllustrationPoints = hydraulicBoundaryDatabase.Locations[1];
+ AssertHydraulicBoundaryLocationCalculationWithIllustrationPoints(failureMechanism, hydraulicBoundaryLocationWithIllustrationPoints);
+
+ Assert.AreEqual(2, failureMechanism.ForeshoreProfiles.Count);
+
+ var firstCalculationGroup = (CalculationGroup) failureMechanism.WaveConditionsCalculationGroup.Children[0];
+ Assert.AreEqual(1, firstCalculationGroup.Children.Count);
+
+ var calculationWithoutOutput = (GrassCoverErosionOutwardsWaveConditionsCalculation) firstCalculationGroup.Children[0];
+ Assert.IsFalse(calculationWithoutOutput.HasOutput);
+
+ var emptyCalculationGroup = (CalculationGroup) failureMechanism.WaveConditionsCalculationGroup.Children[1];
+ Assert.AreEqual(0, emptyCalculationGroup.Children.Count);
+
+ var calculationWithOutput = (GrassCoverErosionOutwardsWaveConditionsCalculation) failureMechanism.WaveConditionsCalculationGroup.Children[2];
+ Assert.IsTrue(calculationWithOutput.HasOutput);
+ }
+
+ private static void AssertStabilityStoneCoverFailureMechanism(AssessmentSection assessmentSection)
+ {
+ StabilityStoneCoverFailureMechanism failureMechanism = assessmentSection.StabilityStoneCover;
+ Assert.AreEqual(15.0, failureMechanism.GeneralInput.N, failureMechanism.GeneralInput.N.GetAccuracy());
+
+ Assert.AreEqual(2, failureMechanism.ForeshoreProfiles.Count);
+ Assert.NotNull(failureMechanism.WaveConditionsCalculationGroup);
+ Assert.AreEqual(3, failureMechanism.WaveConditionsCalculationGroup.Children.Count);
+
+ var calculationGroup = (CalculationGroup) failureMechanism.WaveConditionsCalculationGroup.Children[0];
+ Assert.AreEqual(1, calculationGroup.Children.Count);
+
+ var stabilityStoneCoverCalculationWithoutOutput = (StabilityStoneCoverWaveConditionsCalculation) calculationGroup.Children[0];
+ Assert.IsFalse(stabilityStoneCoverCalculationWithoutOutput.HasOutput);
+
+ Assert.AreEqual(0, ((CalculationGroup) failureMechanism.WaveConditionsCalculationGroup.Children[1]).Children.Count);
+
+ var stabilityStoneCoverCalculationWithOutput = (StabilityStoneCoverWaveConditionsCalculation) failureMechanism.WaveConditionsCalculationGroup.Children[2];
+ Assert.IsTrue(stabilityStoneCoverCalculationWithOutput.HasOutput);
+ Assert.AreEqual(2, stabilityStoneCoverCalculationWithOutput.Output.BlocksOutput.Count());
+ Assert.AreEqual(2, stabilityStoneCoverCalculationWithOutput.Output.ColumnsOutput.Count());
+ }
+
+ private static void AssertWaveImpactAsphaltCoverFailureMechanism(AssessmentSection assessmentSection)
+ {
+ WaveImpactAsphaltCoverFailureMechanism failureMechanism = assessmentSection.WaveImpactAsphaltCover;
+ Assert.AreEqual(1337.0,
+ failureMechanism.GeneralWaveImpactAsphaltCoverInput.DeltaL,
+ failureMechanism.GeneralWaveImpactAsphaltCoverInput.DeltaL.GetAccuracy());
+ Assert.AreEqual(2, failureMechanism.ForeshoreProfiles.Count);
+ Assert.NotNull(failureMechanism.WaveConditionsCalculationGroup);
+ Assert.AreEqual(3, failureMechanism.WaveConditionsCalculationGroup.Children.Count);
+
+ var calculationGroup = (CalculationGroup) failureMechanism.WaveConditionsCalculationGroup.Children[0];
+ Assert.AreEqual(1, calculationGroup.Children.Count);
+
+ var waveImpactAsphaltCoverCalculationWithoutOutput = (WaveImpactAsphaltCoverWaveConditionsCalculation) calculationGroup.Children[0];
+ Assert.IsFalse(waveImpactAsphaltCoverCalculationWithoutOutput.HasOutput);
+
+ Assert.AreEqual(0, ((CalculationGroup) failureMechanism.WaveConditionsCalculationGroup.Children[1]).Children.Count);
+
+ var waveImpactAsphaltCoverCalculationWithOutput = (WaveImpactAsphaltCoverWaveConditionsCalculation) failureMechanism.WaveConditionsCalculationGroup.Children[2];
+ Assert.IsTrue(waveImpactAsphaltCoverCalculationWithOutput.HasOutput);
+ Assert.AreEqual(2, waveImpactAsphaltCoverCalculationWithOutput.Output.Items.Count());
+ }
+
+ private static void AssertHeightStructuresFailureMechanism(AssessmentSection assessmentSection)
+ {
+ HeightStructuresFailureMechanism failureMechanism = assessmentSection.HeightStructures;
+ Assert.AreEqual(5.0, failureMechanism.GeneralInput.N, failureMechanism.GeneralInput.N.GetAccuracy());
+
+ Assert.AreEqual(2, failureMechanism.ForeshoreProfiles.Count);
+ Assert.AreEqual(2, failureMechanism.HeightStructures.Count);
+
+ Assert.NotNull(failureMechanism.CalculationsGroup);
+ Assert.AreEqual(3, failureMechanism.CalculationsGroup.Children.Count);
+
+ var firstCalculationGroup = (CalculationGroup) failureMechanism.CalculationsGroup.Children[0];
+ Assert.AreEqual(2, firstCalculationGroup.Children.Count);
+
+ var calculationWithOutput = (StructuresCalculation) firstCalculationGroup.Children[0];
+ Assert.IsTrue(calculationWithOutput.HasOutput);
+ Assert.IsFalse(calculationWithOutput.Output.HasGeneralResult);
+
+ var calculationWithOutputAndGeneralResult = (StructuresCalculation) firstCalculationGroup.Children[1];
+ Assert.IsTrue(calculationWithOutputAndGeneralResult.HasOutput);
+ Assert.IsTrue(calculationWithOutputAndGeneralResult.Output.HasGeneralResult);
+ AssertGeneralResultTopLevelFaultTreeIllustrationPoint(calculationWithOutputAndGeneralResult.Output.GeneralResult);
+
+ var secondCalculationGroup = (CalculationGroup) failureMechanism.CalculationsGroup.Children[1];
+ Assert.AreEqual(0, secondCalculationGroup.Children.Count);
+ var calculationWithoutOutput = (StructuresCalculation) failureMechanism.CalculationsGroup.Children[2];
+ Assert.IsFalse(calculationWithoutOutput.HasOutput);
+
+ HeightStructuresFailureMechanismSectionResult firstSectionResult = failureMechanism.SectionResults.First();
+ Assert.AreSame(calculationWithOutput, firstSectionResult.Calculation);
+ }
+
+ private static void AssertClosingStructuresFailureMechanism(AssessmentSection assessmentSection)
+ {
+ ClosingStructuresFailureMechanism failureMechanism = assessmentSection.ClosingStructures;
+ Assert.AreEqual(6, failureMechanism.GeneralInput.N2A);
+
+ Assert.AreEqual(2, failureMechanism.ForeshoreProfiles.Count);
+ Assert.AreEqual(2, failureMechanism.ClosingStructures.Count);
+
+ Assert.NotNull(failureMechanism.CalculationsGroup);
+ Assert.AreEqual(3, failureMechanism.CalculationsGroup.Children.Count);
+
+ var firstCalculationGroup = (CalculationGroup) failureMechanism.CalculationsGroup.Children[0];
+ Assert.AreEqual(2, firstCalculationGroup.Children.Count);
+
+ var calculationWithOutput = (StructuresCalculation) firstCalculationGroup.Children[0];
+ Assert.IsTrue(calculationWithOutput.HasOutput);
+ Assert.IsFalse(calculationWithOutput.Output.HasGeneralResult);
+
+ var calculationWithOutputAndGeneralResult = (StructuresCalculation) firstCalculationGroup.Children[1];
+ Assert.IsTrue(calculationWithOutputAndGeneralResult.HasOutput);
+ Assert.IsTrue(calculationWithOutputAndGeneralResult.Output.HasGeneralResult);
+ AssertGeneralResultTopLevelFaultTreeIllustrationPoint(calculationWithOutputAndGeneralResult.Output.GeneralResult);
+
+ ClosingStructuresFailureMechanismSectionResult firstSectionResult = failureMechanism.SectionResults.First();
+ Assert.AreSame(calculationWithOutput, firstSectionResult.Calculation);
+
+ var secondCalculationGroup = (CalculationGroup) failureMechanism.CalculationsGroup.Children[1];
+ Assert.AreEqual(0, secondCalculationGroup.Children.Count);
+ var calculationWithoutOutput = (StructuresCalculation) failureMechanism.CalculationsGroup.Children[2];
+ Assert.IsFalse(calculationWithoutOutput.HasOutput);
+ }
+
+ private static void AssertStabilityPointStructuresFailureMechanism(AssessmentSection assessmentSection)
+ {
+ StabilityPointStructuresFailureMechanism failureMechanism = assessmentSection.StabilityPointStructures;
+ Assert.AreEqual(8.0, failureMechanism.GeneralInput.N, failureMechanism.GeneralInput.N.GetAccuracy());
+
+ Assert.AreEqual(2, failureMechanism.ForeshoreProfiles.Count);
+ Assert.AreEqual(2, failureMechanism.StabilityPointStructures.Count);
+
+ Assert.NotNull(failureMechanism.CalculationsGroup);
+ Assert.AreEqual(3, failureMechanism.CalculationsGroup.Children.Count);
+
+ var firstCalculationGroup = (CalculationGroup) failureMechanism.CalculationsGroup.Children[0];
+ Assert.AreEqual(2, firstCalculationGroup.Children.Count);
+
+ var calculationWithOutput = (StructuresCalculation) firstCalculationGroup.Children[0];
+ Assert.IsTrue(calculationWithOutput.HasOutput);
+ Assert.IsFalse(calculationWithOutput.Output.HasGeneralResult);
+
+ var calculationWithOutputAndGeneralResult = (StructuresCalculation) firstCalculationGroup.Children[1];
+ Assert.IsTrue(calculationWithOutputAndGeneralResult.HasOutput);
+ Assert.IsTrue(calculationWithOutputAndGeneralResult.Output.HasGeneralResult);
+ AssertGeneralResultTopLevelFaultTreeIllustrationPoint(calculationWithOutputAndGeneralResult.Output.GeneralResult);
+
+ var secondCalculationGroup = (CalculationGroup) failureMechanism.CalculationsGroup.Children[1];
+ Assert.AreEqual(0, secondCalculationGroup.Children.Count);
+ var calculationWithoutOutput = (StructuresCalculation) failureMechanism.CalculationsGroup.Children[2];
+ Assert.IsFalse(calculationWithoutOutput.HasOutput);
+
+ StabilityPointStructuresFailureMechanismSectionResult sectionResult = failureMechanism.SectionResults.First();
+ Assert.AreSame(calculationWithOutput, sectionResult.Calculation);
+ }
+
+ private static void AssertPipingStructureFailureMechanism(AssessmentSection assessmentSection)
+ {
+ PipingStructureFailureMechanism failureMechanism = assessmentSection.PipingStructure;
+ Assert.AreEqual(12.5, failureMechanism.N, failureMechanism.N.GetAccuracy());
+ }
+
+ private static void AssertGeneralResultTopLevelFaultTreeIllustrationPoint(GeneralResult generalResult)
+ {
+ WindDirection actualGoverningWindDirection = generalResult.GoverningWindDirection;
+ Assert.AreEqual("GoverningWindDirection", actualGoverningWindDirection.Name);
+ Assert.AreEqual(180, actualGoverningWindDirection.Angle, actualGoverningWindDirection.Angle.GetAccuracy());
+
+ Stochast stochast = generalResult.Stochasts.Single();
+ Assert.AreEqual("Stochast", stochast.Name);
+ Assert.AreEqual(0.9, stochast.Alpha, stochast.Alpha.GetAccuracy());
+ Assert.AreEqual(0.1, stochast.Duration, stochast.Duration.GetAccuracy());
+
+ TopLevelFaultTreeIllustrationPoint topLevelFaultTreeIllustrationPoint =
+ generalResult.TopLevelIllustrationPoints.Single();
+ Assert.AreEqual("ClosingSituation", topLevelFaultTreeIllustrationPoint.ClosingSituation);
+ Assert.AreEqual("WindDirection", topLevelFaultTreeIllustrationPoint.WindDirection.Name);
+ Assert.AreEqual(120, topLevelFaultTreeIllustrationPoint.WindDirection.Angle,
+ topLevelFaultTreeIllustrationPoint.WindDirection.Angle.GetAccuracy());
+
+ IllustrationPointNode node = topLevelFaultTreeIllustrationPoint.FaultTreeNodeRoot;
+ Assert.AreEqual(0, node.Children.Count());
+
+ var faultTreeIllustrationPoint = node.Data as FaultTreeIllustrationPoint;
+ Assert.IsNotNull(faultTreeIllustrationPoint);
+ Assert.AreEqual("FaultTreeIllustrationPoint", faultTreeIllustrationPoint.Name);
+ Assert.AreEqual(0.5, faultTreeIllustrationPoint.Beta, faultTreeIllustrationPoint.Beta.GetAccuracy());
+
+ Stochast innerStochast = faultTreeIllustrationPoint.Stochasts.Single();
+ Assert.AreEqual("Stochast", innerStochast.Name);
+ Assert.AreEqual(0.9, innerStochast.Alpha, innerStochast.Alpha.GetAccuracy());
+ Assert.AreEqual(0.1, innerStochast.Duration, innerStochast.Duration.GetAccuracy());
+ }
+
+ private static void AssertHydraulicBoundaryDatabase(HydraulicBoundaryDatabase hydraulicBoundaryDatabase)
+ {
+ Assert.AreEqual("1.0", hydraulicBoundaryDatabase.Version);
+ Assert.AreEqual("/temp/test", hydraulicBoundaryDatabase.FilePath);
+ Assert.IsTrue(hydraulicBoundaryDatabase.CanUsePreprocessor);
+ Assert.IsTrue(hydraulicBoundaryDatabase.UsePreprocessor);
+ Assert.AreEqual("/temp/preprocessor", hydraulicBoundaryDatabase.PreprocessorDirectory);
+ Assert.AreEqual(2, hydraulicBoundaryDatabase.Locations.Count);
+
+ HydraulicBoundaryLocation hydraulicBoundaryLocation = hydraulicBoundaryDatabase.Locations[0];
+ Assert.AreEqual(13001, hydraulicBoundaryLocation.Id);
+ Assert.AreEqual("test", hydraulicBoundaryLocation.Name);
+ Assert.AreEqual(152.3, hydraulicBoundaryLocation.Location.X);
+ Assert.AreEqual(2938.5, hydraulicBoundaryLocation.Location.Y);
+
+ HydraulicBoundaryLocation hydraulicBoundaryLocationWithIllustrationPoints = hydraulicBoundaryDatabase.Locations[1];
+ Assert.AreEqual(13002, hydraulicBoundaryLocationWithIllustrationPoints.Id);
+ Assert.AreEqual("test2", hydraulicBoundaryLocationWithIllustrationPoints.Name);
+ Assert.AreEqual(135.2, hydraulicBoundaryLocationWithIllustrationPoints.Location.X);
+ Assert.AreEqual(5293.8, hydraulicBoundaryLocationWithIllustrationPoints.Location.Y);
+ }
+
+ #region Dune Erosion Failure Mechanism
+
+ private static void AssertDuneErosionFailureMechanism(AssessmentSection assessmentSection)
+ {
+ DuneErosionFailureMechanism failureMechanism = assessmentSection.DuneErosion;
+ Assert.AreEqual(5.5, failureMechanism.GeneralInput.N, failureMechanism.GeneralInput.N.GetAccuracy());
+
+ IEnumerable duneLocations = failureMechanism.DuneLocations;
+
+ Assert.AreEqual(1, duneLocations.Count());
+ AssertDuneLocationCalculationWithoutOutput(failureMechanism.CalculationsForMechanismSpecificFactorizedSignalingNorm.Single());
+ AssertDuneLocationCalculationWithOutput(failureMechanism.CalculationsForMechanismSpecificSignalingNorm.Single());
+ AssertDuneLocationCalculationWithoutOutput(failureMechanism.CalculationsForMechanismSpecificLowerLimitNorm.Single());
+ AssertDuneLocationCalculationWithOutput(failureMechanism.CalculationsForLowerLimitNorm.Single());
+ AssertDuneLocationCalculationWithoutOutput(failureMechanism.CalculationsForFactorizedLowerLimitNorm.Single());
+
+ Assert.AreEqual(3, failureMechanism.SectionResults.Count());
+ }
+
+ private static void AssertDuneLocationCalculationWithoutOutput(DuneLocationCalculation calculation)
+ {
+ Assert.IsNull(calculation.Output);
+ }
+
+ private static void AssertDuneLocationCalculationWithOutput(DuneLocationCalculation calculation)
+ {
+ DuneLocationCalculationOutput calculationOutput = calculation.Output;
+ Assert.IsNotNull(calculationOutput);
+ Assert.AreEqual(CalculationConvergence.CalculatedConverged, calculationOutput.CalculationConvergence);
+ }
+
+ #endregion
+
+ #region Hydraulic Boundary Location Calculations
+
+ private static void AssertHydraulicBoundaryLocationCalculations(AssessmentSection assessmentSection)
+ {
+ HydraulicBoundaryDatabase hydraulicBoundaryDatabase = assessmentSection.HydraulicBoundaryDatabase;
+
+ HydraulicBoundaryLocation hydraulicBoundaryLocation = hydraulicBoundaryDatabase.Locations[0];
+ AssertHydraulicBoundaryLocationCalculationsWithoutIllustrationPoints(assessmentSection, hydraulicBoundaryLocation);
+
+ HydraulicBoundaryLocation hydraulicBoundaryLocationWithIllustrationPoints = hydraulicBoundaryDatabase.Locations[1];
+ AssertHydraulicBoundaryLocationCalculationWithIllustrationPoints(assessmentSection, hydraulicBoundaryLocationWithIllustrationPoints);
+ }
+
+ private static void AssertHydraulicBoundaryLocationCalculationsWithoutIllustrationPoints(AssessmentSection assessmentSection, HydraulicBoundaryLocation hydraulicBoundaryLocation)
+ {
+ HydraulicBoundaryLocationCalculation designWaterLevelCalculation = assessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm
+ .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation));
+ Assert.IsFalse(designWaterLevelCalculation.InputParameters.ShouldIllustrationPointsBeCalculated);
+ AssertHydraulicBoundaryLocationDesignWaterLevelCalculation(designWaterLevelCalculation);
+
+ designWaterLevelCalculation = assessmentSection.WaterLevelCalculationsForLowerLimitNorm
+ .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation));
+ Assert.IsFalse(designWaterLevelCalculation.InputParameters.ShouldIllustrationPointsBeCalculated);
+ AssertHydraulicBoundaryLocationDesignWaterLevelCalculation(designWaterLevelCalculation);
+
+ AssertSimpleHydraulicBoundaryLocationCalculation(assessmentSection.WaterLevelCalculationsForSignalingNorm
+ .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)));
+ AssertSimpleHydraulicBoundaryLocationCalculation(assessmentSection.WaterLevelCalculationsForFactorizedLowerLimitNorm
+ .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)));
+
+ HydraulicBoundaryLocationCalculation waveHeightCalculation = assessmentSection.WaveHeightCalculationsForFactorizedSignalingNorm
+ .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation));
+ Assert.IsFalse(designWaterLevelCalculation.InputParameters.ShouldIllustrationPointsBeCalculated);
+ AssertHydraulicBoundaryLocationWaveHeightCalculation(waveHeightCalculation);
+
+ waveHeightCalculation = assessmentSection.WaveHeightCalculationsForLowerLimitNorm
+ .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation));
+ Assert.IsFalse(designWaterLevelCalculation.InputParameters.ShouldIllustrationPointsBeCalculated);
+ AssertHydraulicBoundaryLocationWaveHeightCalculation(waveHeightCalculation);
+
+ AssertSimpleHydraulicBoundaryLocationCalculation(assessmentSection.WaveHeightCalculationsForSignalingNorm
+ .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)));
+ AssertSimpleHydraulicBoundaryLocationCalculation(assessmentSection.WaveHeightCalculationsForFactorizedLowerLimitNorm
+ .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)));
+ }
+
+ private static void AssertHydraulicBoundaryLocationCalculationsWithoutIllustrationPoints(GrassCoverErosionOutwardsFailureMechanism failureMechanism,
+ HydraulicBoundaryLocation hydraulicBoundaryLocation)
+ {
+ HydraulicBoundaryLocationCalculation designWaterLevelCalculation = failureMechanism.WaterLevelCalculationsForMechanismSpecificFactorizedSignalingNorm
+ .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation));
+ Assert.IsFalse(designWaterLevelCalculation.InputParameters.ShouldIllustrationPointsBeCalculated);
+ AssertHydraulicBoundaryLocationDesignWaterLevelCalculation(designWaterLevelCalculation);
+
+ AssertSimpleHydraulicBoundaryLocationCalculation(failureMechanism.WaterLevelCalculationsForMechanismSpecificSignalingNorm
+ .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)));
+ AssertSimpleHydraulicBoundaryLocationCalculation(failureMechanism.WaterLevelCalculationsForMechanismSpecificLowerLimitNorm
+ .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)));
+
+ HydraulicBoundaryLocationCalculation waveHeightCalculation = failureMechanism.WaveHeightCalculationsForMechanismSpecificFactorizedSignalingNorm
+ .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation));
+ Assert.IsFalse(designWaterLevelCalculation.InputParameters.ShouldIllustrationPointsBeCalculated);
+ AssertHydraulicBoundaryLocationWaveHeightCalculation(waveHeightCalculation);
+
+ AssertSimpleHydraulicBoundaryLocationCalculation(failureMechanism.WaveHeightCalculationsForMechanismSpecificSignalingNorm
+ .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)));
+ AssertSimpleHydraulicBoundaryLocationCalculation(failureMechanism.WaveHeightCalculationsForMechanismSpecificLowerLimitNorm
+ .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)));
+ }
+
+ private static void AssertHydraulicBoundaryLocationCalculationWithIllustrationPoints(GrassCoverErosionOutwardsFailureMechanism failureMechanism,
+ HydraulicBoundaryLocation hydraulicBoundaryLocation)
+ {
+ HydraulicBoundaryLocationCalculation designWaterLevelCalculationWithIllustrationPoints = failureMechanism.WaterLevelCalculationsForMechanismSpecificFactorizedSignalingNorm
+ .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation));
+ Assert.IsTrue(designWaterLevelCalculationWithIllustrationPoints.InputParameters.ShouldIllustrationPointsBeCalculated);
+ AssertHydraulicBoundaryLocationDesignWaterLevelCalculation(designWaterLevelCalculationWithIllustrationPoints);
+ AssertGeneralResultTopLevelSubMechanismIllustrationPoint(designWaterLevelCalculationWithIllustrationPoints.Output.GeneralResult);
+
+ AssertSimpleHydraulicBoundaryLocationCalculation(failureMechanism.WaterLevelCalculationsForMechanismSpecificSignalingNorm
+ .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)));
+ AssertSimpleHydraulicBoundaryLocationCalculation(failureMechanism.WaterLevelCalculationsForMechanismSpecificLowerLimitNorm
+ .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)));
+
+ HydraulicBoundaryLocationCalculation waveHeightCalculationWithIllustrationPoints = failureMechanism.WaveHeightCalculationsForMechanismSpecificFactorizedSignalingNorm
+ .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation));
+ Assert.IsTrue(waveHeightCalculationWithIllustrationPoints.InputParameters.ShouldIllustrationPointsBeCalculated);
+ AssertHydraulicBoundaryLocationWaveHeightCalculation(waveHeightCalculationWithIllustrationPoints);
+ AssertGeneralResultTopLevelSubMechanismIllustrationPoint(waveHeightCalculationWithIllustrationPoints.Output.GeneralResult);
+
+ AssertSimpleHydraulicBoundaryLocationCalculation(failureMechanism.WaveHeightCalculationsForMechanismSpecificSignalingNorm
+ .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)));
+ AssertSimpleHydraulicBoundaryLocationCalculation(failureMechanism.WaveHeightCalculationsForMechanismSpecificLowerLimitNorm
+ .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)));
+ }
+
+ private static void AssertHydraulicBoundaryLocationCalculationWithIllustrationPoints(AssessmentSection assessmentSection, HydraulicBoundaryLocation hydraulicBoundaryLocation)
+ {
+ HydraulicBoundaryLocationCalculation designWaterLevelCalculationWithIllustrationPoints = assessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm
+ .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation));
+ Assert.IsTrue(designWaterLevelCalculationWithIllustrationPoints.InputParameters.ShouldIllustrationPointsBeCalculated);
+ AssertHydraulicBoundaryLocationDesignWaterLevelCalculation(designWaterLevelCalculationWithIllustrationPoints);
+ AssertGeneralResultTopLevelSubMechanismIllustrationPoint(designWaterLevelCalculationWithIllustrationPoints.Output.GeneralResult);
+
+ designWaterLevelCalculationWithIllustrationPoints = assessmentSection.WaterLevelCalculationsForLowerLimitNorm
+ .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation));
+ Assert.IsTrue(designWaterLevelCalculationWithIllustrationPoints.InputParameters.ShouldIllustrationPointsBeCalculated);
+ AssertHydraulicBoundaryLocationDesignWaterLevelCalculation(designWaterLevelCalculationWithIllustrationPoints);
+ AssertGeneralResultTopLevelSubMechanismIllustrationPoint(designWaterLevelCalculationWithIllustrationPoints.Output.GeneralResult);
+
+ AssertSimpleHydraulicBoundaryLocationCalculation(assessmentSection.WaterLevelCalculationsForSignalingNorm
+ .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)));
+ AssertSimpleHydraulicBoundaryLocationCalculation(assessmentSection.WaterLevelCalculationsForFactorizedLowerLimitNorm
+ .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)));
+
+ HydraulicBoundaryLocationCalculation waveHeightCalculationWithIllustrationPoints = assessmentSection.WaveHeightCalculationsForFactorizedSignalingNorm
+ .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation));
+ Assert.IsTrue(waveHeightCalculationWithIllustrationPoints.InputParameters.ShouldIllustrationPointsBeCalculated);
+ AssertHydraulicBoundaryLocationWaveHeightCalculation(waveHeightCalculationWithIllustrationPoints);
+ AssertGeneralResultTopLevelSubMechanismIllustrationPoint(waveHeightCalculationWithIllustrationPoints.Output.GeneralResult);
+
+ waveHeightCalculationWithIllustrationPoints = assessmentSection.WaveHeightCalculationsForLowerLimitNorm
+ .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation));
+ Assert.IsTrue(waveHeightCalculationWithIllustrationPoints.InputParameters.ShouldIllustrationPointsBeCalculated);
+ AssertHydraulicBoundaryLocationWaveHeightCalculation(waveHeightCalculationWithIllustrationPoints);
+ AssertGeneralResultTopLevelSubMechanismIllustrationPoint(waveHeightCalculationWithIllustrationPoints.Output.GeneralResult);
+
+ AssertSimpleHydraulicBoundaryLocationCalculation(assessmentSection.WaveHeightCalculationsForSignalingNorm
+ .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)));
+ AssertSimpleHydraulicBoundaryLocationCalculation(assessmentSection.WaveHeightCalculationsForFactorizedLowerLimitNorm
+ .Single(calc => ReferenceEquals(calc.HydraulicBoundaryLocation, hydraulicBoundaryLocation)));
+ }
+
+ private static void AssertSimpleHydraulicBoundaryLocationCalculation(HydraulicBoundaryLocationCalculation calculation)
+ {
+ Assert.IsFalse(calculation.InputParameters.ShouldIllustrationPointsBeCalculated);
+ Assert.IsFalse(calculation.HasOutput);
+ }
+
+ private static void AssertHydraulicBoundaryLocationDesignWaterLevelCalculation(HydraulicBoundaryLocationCalculation calculation)
+ {
+ HydraulicBoundaryLocationCalculationOutput output = calculation.Output;
+ Assert.AreEqual(12.4, output.Result, output.Result.GetAccuracy());
+ Assert.IsNaN(output.TargetProbability);
+ Assert.IsNaN(output.TargetReliability);
+ Assert.IsNaN(output.CalculatedProbability);
+ Assert.IsNaN(output.CalculatedReliability);
+ Assert.AreEqual(CalculationConvergence.CalculatedConverged, output.CalculationConvergence);
+ }
+
+ private static void AssertHydraulicBoundaryLocationWaveHeightCalculation(HydraulicBoundaryLocationCalculation calculation)
+ {
+ HydraulicBoundaryLocationCalculationOutput output = calculation.Output;
+ Assert.AreEqual(2.4, output.Result, output.Result.GetAccuracy());
+ Assert.AreEqual(0, output.TargetProbability);
+ Assert.AreEqual(0, output.TargetReliability, output.TargetReliability.GetAccuracy());
+ Assert.AreEqual(0, output.CalculatedProbability);
+ Assert.AreEqual(0, output.CalculatedReliability, output.CalculatedReliability.GetAccuracy());
+ Assert.AreEqual(CalculationConvergence.CalculatedNotConverged, output.CalculationConvergence);
+ }
+
+ private static void AssertGeneralResultTopLevelSubMechanismIllustrationPoint(GeneralResult generalResult)
+ {
+ WindDirection actualGoverningWindDirection = generalResult.GoverningWindDirection;
+ Assert.AreEqual("SSE", actualGoverningWindDirection.Name);
+ Assert.AreEqual(120, actualGoverningWindDirection.Angle, actualGoverningWindDirection.Angle.GetAccuracy());
+
+ Stochast stochast = generalResult.Stochasts.Single();
+ Assert.AreEqual("Name of a stochast", stochast.Name);
+ Assert.AreEqual(37, stochast.Alpha, stochast.Alpha.GetAccuracy());
+ Assert.AreEqual(13, stochast.Duration, stochast.Duration.GetAccuracy());
+
+ TopLevelSubMechanismIllustrationPoint actualTopLevelSubMechanismIllustrationPoint =
+ generalResult.TopLevelIllustrationPoints.Single();
+ Assert.AreEqual("Closing situation", actualTopLevelSubMechanismIllustrationPoint.ClosingSituation);
+ Assert.AreEqual("60", actualTopLevelSubMechanismIllustrationPoint.WindDirection.Name);
+ Assert.AreEqual(60, actualTopLevelSubMechanismIllustrationPoint.WindDirection.Angle,
+ actualTopLevelSubMechanismIllustrationPoint.WindDirection.Angle.GetAccuracy());
+
+ SubMechanismIllustrationPoint illustrationPoint = actualTopLevelSubMechanismIllustrationPoint.SubMechanismIllustrationPoint;
+ Assert.AreEqual("Name of illustrationPoint", illustrationPoint.Name);
+ Assert.AreEqual(3, illustrationPoint.Beta, illustrationPoint.Beta.GetAccuracy());
+
+ SubMechanismIllustrationPointStochast illustrationPointStochast = illustrationPoint.Stochasts.Single();
+ Assert.AreEqual("Name of a stochast", illustrationPointStochast.Name);
+ Assert.AreEqual(10, illustrationPointStochast.Duration, illustrationPointStochast.Duration.GetAccuracy());
+ Assert.AreEqual(9, illustrationPointStochast.Alpha, illustrationPointStochast.Alpha.GetAccuracy());
+ Assert.AreEqual(8, illustrationPointStochast.Realization, illustrationPointStochast.Realization.GetAccuracy());
+
+ IllustrationPointResult illustrationPointResult = illustrationPoint.IllustrationPointResults.Single();
+ Assert.AreEqual("Description of result", illustrationPointResult.Description);
+ Assert.AreEqual(5, illustrationPointResult.Value, illustrationPointResult.Value.GetAccuracy());
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/SqLiteDatabaseHelperTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/SqLiteDatabaseHelperTest.cs (revision 0)
+++ Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/SqLiteDatabaseHelperTest.cs (revision a7f0b003155f5f24190b2671ac4d4d840c3b3c0d)
@@ -0,0 +1,305 @@
+// 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 System.IO;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Integration.Data;
+
+namespace Application.Ringtoets.Storage.TestUtil.Test
+{
+ [TestFixture]
+ public class SqLiteDatabaseHelperTest
+ {
+ [Test]
+ [TestCase("")]
+ [TestCase(" ")]
+ [TestCase(null)]
+ public void CreateCorruptDatabaseFile_InvalidPath_ThrowArgumentNullException(string invalidFilePath)
+ {
+ // Call
+ TestDelegate call = () => SqLiteDatabaseHelper.CreateCorruptDatabaseFile(invalidFilePath);
+
+ // Assert
+ Assert.Throws(call);
+ }
+
+ [Test]
+ public void CreateCorruptDatabaseFile_ValidArguments_CreatedDatabaseFile()
+ {
+ // Setup
+ string validPath = TestHelper.GetScratchPadPath(nameof(CreateCorruptDatabaseFile_ValidArguments_CreatedDatabaseFile));
+
+ using (new FileDisposeHelper(validPath))
+ {
+ try
+ {
+ // Call
+ TestDelegate test = () => SqLiteDatabaseHelper.CreateCorruptDatabaseFile(validPath);
+
+ // Assert
+ Assert.DoesNotThrow(test);
+ Assert.IsTrue(File.Exists(validPath));
+ }
+ finally
+ {
+ CallGarbageCollector();
+ }
+ }
+ }
+
+ [Test]
+ [TestCase("")]
+ [TestCase(" ")]
+ [TestCase(null)]
+ public void CreateCompleteDatabaseFileWithoutProjectData_InvalidPath_ThrowsArgumentNullException(string invalidFilePath)
+ {
+ // Call
+ TestDelegate call = () => SqLiteDatabaseHelper.CreateCompleteDatabaseFileWithoutProjectData(invalidFilePath);
+
+ // Assert
+ Assert.Throws(call);
+ }
+
+ [Test]
+ public void CreateCompleteDatabaseFileWithoutProjectData_ValidArguments_CreatedDatabaseFile()
+ {
+ // Setup
+ string validPath = TestHelper.GetScratchPadPath("tempFile.rtd");
+
+ using (new FileDisposeHelper(validPath))
+ {
+ try
+ {
+ // Call
+ TestDelegate test = () => SqLiteDatabaseHelper.CreateCompleteDatabaseFileWithoutProjectData(validPath);
+
+ // Assert
+ Assert.DoesNotThrow(test);
+ Assert.IsTrue(File.Exists(validPath));
+ }
+ finally
+ {
+ CallGarbageCollector();
+ }
+ }
+ }
+
+ [Test]
+ [TestCase("")]
+ [TestCase(" ")]
+ [TestCase(null)]
+ public void CreateCompleteDatabaseFileEmpty_InvalidPath_ThrowsArgumentNullException(string invalidFilePath)
+ {
+ // Call
+ TestDelegate call = () => SqLiteDatabaseHelper.CreateCompleteDatabaseFileEmpty(invalidFilePath);
+
+ // Assert
+ Assert.Throws(call);
+ }
+
+ [Test]
+ public void CreateCompleteDatabaseFileEmpty_ValidArguments_CreatedDatabaseFile()
+ {
+ // Setup
+ string validPath = TestHelper.GetScratchPadPath(nameof(CreateCompleteDatabaseFileEmpty_ValidArguments_CreatedDatabaseFile));
+
+ using (new FileDisposeHelper(validPath))
+ {
+ try
+ {
+ // Call
+ TestDelegate test = () => SqLiteDatabaseHelper.CreateCompleteDatabaseFileEmpty(validPath);
+
+ // Assert
+ Assert.DoesNotThrow(test);
+ Assert.IsTrue(File.Exists(validPath));
+ }
+ finally
+ {
+ CallGarbageCollector();
+ }
+ }
+ }
+
+ [Test]
+ public void CreateDatabaseFile_NullPath_ThrowsArgumentNullException()
+ {
+ // Setup
+ const string validScript = ";";
+
+ // Call
+ TestDelegate test = () => SqLiteDatabaseHelper.CreateDatabaseFile(null, validScript);
+
+ // Assert
+ Assert.Throws(test);
+ }
+
+ [Test]
+ public void CreateDatabaseFile_ValidPathNullScript_ThrowsArgumentNullException()
+ {
+ // Setup
+ const string validPath = "tempFile";
+
+ // Call
+ TestDelegate test = () => SqLiteDatabaseHelper.CreateDatabaseFile(validPath, null);
+
+ // Assert
+ Assert.Throws(test);
+ }
+
+ [Test]
+ public void CreateDatabaseFile_ValidPathInvalidScript_ThrowsSQLiteException()
+ {
+ // Setup
+ string validPath = TestHelper.GetScratchPadPath(nameof(CreateDatabaseFile_ValidPathInvalidScript_ThrowsSQLiteException));
+ const string invalidScript = "SELECT '' FROM *;";
+
+ using (new FileDisposeHelper(validPath))
+ {
+ // Call
+ TestDelegate test = () => SqLiteDatabaseHelper.CreateDatabaseFile(validPath, invalidScript);
+
+ // Assert
+ Assert.Throws(test);
+ }
+ }
+
+ [Test]
+ public void CreateDatabaseFile_ValidPathValidScript_CreatesValidFile()
+ {
+ // Setup
+ string validPath = TestHelper.GetScratchPadPath(nameof(CreateDatabaseFile_ValidPathValidScript_CreatesValidFile));
+ const string validScript = "select * from sqlite_master;";
+
+ using (new FileDisposeHelper(validPath))
+ {
+ // Call
+ TestDelegate test = () => SqLiteDatabaseHelper.CreateDatabaseFile(validPath, validScript);
+
+ // Assert
+ Assert.DoesNotThrow(test);
+ Assert.IsTrue(File.Exists(validPath));
+ }
+ }
+
+ [Test]
+ public void CreateDatabaseFile_FileAlreadyExists_OverwriteFile()
+ {
+ // Setup
+ string validPath = TestHelper.GetScratchPadPath(nameof(CreateDatabaseFile_FileAlreadyExists_OverwriteFile));
+ const string validScript = "select * from sqlite_master;";
+
+ using (new FileDisposeHelper(validPath))
+ {
+ // Call
+ TestDelegate test = () => SqLiteDatabaseHelper.CreateDatabaseFile(validPath, validScript);
+
+ // Assert
+ Assert.DoesNotThrow(test);
+ Assert.IsTrue(File.Exists(validPath));
+
+ // Assert
+ File.Exists(validPath);
+ }
+ }
+
+ [Test]
+ public void CreateDatabaseFile_FileAlreadyExistsAndLocked_Fail()
+ {
+ // Setup
+ string validPath = TestHelper.GetScratchPadPath(nameof(CreateDatabaseFile_FileAlreadyExistsAndLocked_Fail));
+ const string validScript = ";";
+
+ using (var fileDisposeHelper = new FileDisposeHelper(validPath))
+ {
+ fileDisposeHelper.LockFiles();
+
+ // Call
+ TestDelegate test = () => SqLiteDatabaseHelper.CreateDatabaseFile(validPath, validScript);
+
+ // Assert
+ Assert.Throws(test);
+ }
+ }
+
+ [Test]
+ public void CreateValidRingtoetsDatabase_ValidArguments_SavesProjectToFile()
+ {
+ // Setup
+ string validPath = TestHelper.GetScratchPadPath(nameof(CreateValidRingtoetsDatabase_ValidArguments_SavesProjectToFile));
+ var project = new RingtoetsProject();
+
+ var fileDisposeHelper = new FileDisposeHelper(validPath);
+ try
+ {
+ // Call
+ TestDelegate test = () => SqLiteDatabaseHelper.CreateValidRingtoetsDatabase(validPath, project);
+
+ // Assert
+ Assert.DoesNotThrow(test);
+ Assert.IsTrue(File.Exists(validPath));
+ }
+ finally
+ {
+ CallGarbageCollector();
+ fileDisposeHelper.Dispose();
+ }
+ }
+
+ [Test]
+ public void GetCorruptSchema_Always_ScriptThatOnlyGeneratesEnoughToPassValidation()
+ {
+ // Setup
+ const string expectedCreateVersionTable = "CREATE TABLE 'VersionEntity' ";
+ const string notExpectedCreateProjectEntityTable = "CREATE TABLE 'ProjectEntity' ";
+
+ // Call
+ string query = SqLiteDatabaseHelper.GetCorruptSchema();
+
+ // Assert
+ Assert.That(!string.IsNullOrEmpty(query));
+ Assert.IsTrue(query.Contains(expectedCreateVersionTable));
+ Assert.IsFalse(query.Contains(notExpectedCreateProjectEntityTable));
+ }
+
+ [Test]
+ [TestCase("")]
+ [TestCase(" ")]
+ [TestCase(null)]
+ public void AddVersionEntity_InvalidPath_ThrowsArgumentNullException(string invalidFilePath)
+ {
+ // Call
+ TestDelegate call = () => SqLiteDatabaseHelper.AddVersionEntity(invalidFilePath, "4");
+
+ // Assert
+ Assert.Throws(call);
+ }
+
+ private static void CallGarbageCollector()
+ {
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/TestFailureMechanismSectionTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/TestFailureMechanismSectionTest.cs (revision 0)
+++ Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/TestFailureMechanismSectionTest.cs (revision a7f0b003155f5f24190b2671ac4d4d840c3b3c0d)
@@ -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 Core.Common.Base.Geometry;
+using NUnit.Framework;
+
+namespace Application.Ringtoets.Storage.TestUtil.Test
+{
+ [TestFixture]
+ public class TestFailureMechanismSectionTest
+ {
+ [Test]
+ public void Constructor_Always_ReturnsSectionWithEmptyNameAndOnePointAtOrigin()
+ {
+ // Call
+ var section = new TestFailureMechanismSection();
+
+ // Assert
+ CollectionAssert.AreEqual(new[]
+ {
+ new Point2D(0, 0)
+ }, section.Points);
+ Assert.IsEmpty(section.Name);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/packages.config
===================================================================
diff -u
--- Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/packages.config (revision 0)
+++ Ringtoets/Storage/test/Ringtoets.Storage.Core.TestUtil.Test/packages.config (revision a7f0b003155f5f24190b2671ac4d4d840c3b3c0d)
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
\ No newline at end of file