Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresInputTest.cs
===================================================================
diff -u -r4bf59bb3506b840b284efe0c0f4431b7876e0e5b -r2e722835ebb7a4bc7a7bbcc07b6cfa9f5776e3d9
--- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresInputTest.cs (.../HeightStructuresInputTest.cs) (revision 4bf59bb3506b840b284efe0c0f4431b7876e0e5b)
+++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresInputTest.cs (.../HeightStructuresInputTest.cs) (revision 2e722835ebb7a4bc7a7bbcc07b6cfa9f5776e3d9)
@@ -111,6 +111,56 @@
AssertHeightStructure(structure, input);
}
+ [Test]
+ public void StructureParametersSynchronized_StructureNotSet_ReturnFalse()
+ {
+ // Setup
+ var input = new HeightStructuresInput();
+
+ // Call
+ bool structureParametersSynchronized = input.StructureParametersSynchronized;
+
+ // Assert
+ Assert.IsFalse(structureParametersSynchronized);
+ }
+
+ [Test]
+ public void StructureParametersSynchronized_StructureAndInputInSync_ReturnTrue()
+ {
+ // Setup
+ var structure = new TestHeightStructure();
+ var input = new HeightStructuresInput
+ {
+ Structure = structure
+ };
+
+ // Call
+ bool structureParametersSynchronized = input.StructureParametersSynchronized;
+
+ // Assert
+ Assert.IsTrue(structureParametersSynchronized);
+ }
+
+ [Test]
+ [TestCaseSource(typeof(HeightStructurePermutationHelper), nameof(HeightStructurePermutationHelper.DifferentHeightStructureWithSameIdLocationAndName))]
+ public void StructureParametersSynchronized_StructureAndInputNotInSync_ReturnFalse(HeightStructure modifiedStructure)
+ {
+ // Setup
+ var structure = new TestHeightStructure();
+ var input = new HeightStructuresInput
+ {
+ Structure = structure
+ };
+
+ structure.CopyProperties(modifiedStructure);
+
+ // Call
+ bool structureParametersSynchronized = input.StructureParametersSynchronized;
+
+ // Assert
+ Assert.IsFalse(structureParametersSynchronized);
+ }
+
#region Schematization
[Test]
Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil/HeightStructurePermutationHelper.cs
===================================================================
diff -u
--- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil/HeightStructurePermutationHelper.cs (revision 0)
+++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil/HeightStructurePermutationHelper.cs (revision 2e722835ebb7a4bc7a7bbcc07b6cfa9f5776e3d9)
@@ -0,0 +1,130 @@
+// 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 Core.Common.Base.Data;
+using Core.Common.Base.Geometry;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+
+namespace Ringtoets.HeightStructures.Data.TestUtil
+{
+ public static class HeightStructurePermutationHelper
+ {
+ public static IEnumerable DifferentHeightStructureWithSameId
+ {
+ get
+ {
+ const string defaultId = "id";
+
+ var testCaseData = new List
+ {
+ new TestCaseData(new TestHeightStructure(defaultId, "Different Name"))
+ .SetName("Different Name"),
+ new TestCaseData(new TestHeightStructure(new Point2D(1, 1), defaultId))
+ .SetName("Different Location")
+ };
+
+ testCaseData.AddRange(DifferentHeightStructureWithSameIdLocationAndName);
+
+ return testCaseData;
+ }
+ }
+
+ public static IEnumerable DifferentHeightStructureWithSameIdLocationAndName
+ {
+ get
+ {
+ var random = new Random(532);
+ const string defaultId = "id";
+ const string defaultName = "name";
+ var defaultLocation = new Point2D(0, 0);
+
+ yield return new TestCaseData(new TestHeightStructure
+ {
+ AllowedLevelIncreaseStorage =
+ {
+ Mean = (RoundedDouble) random.Next(),
+ Shift = random.NextRoundedDouble(),
+ StandardDeviation = random.NextRoundedDouble()
+ }
+ }).SetName("Different AllowedLevelIncreaseStorage");
+ yield return new TestCaseData(new TestHeightStructure
+ {
+ CriticalOvertoppingDischarge =
+ {
+ Mean = (RoundedDouble) random.Next(),
+ CoefficientOfVariation = random.NextRoundedDouble()
+ }
+ }).SetName("Different CriticalOvertoppingDischarge");
+ yield return new TestCaseData(new TestHeightStructure
+ {
+ FlowWidthAtBottomProtection =
+ {
+ Mean = (RoundedDouble) random.Next(),
+ Shift = random.NextRoundedDouble(),
+ StandardDeviation = random.NextRoundedDouble()
+ }
+ }).SetName("Different FlowWidthAtBottomProtection");
+ yield return new TestCaseData(new TestHeightStructure
+ {
+ LevelCrestStructure =
+ {
+ Mean = (RoundedDouble) random.Next(),
+ StandardDeviation = random.NextRoundedDouble()
+ }
+ }).SetName("Different LevelCrestStructure");
+ yield return new TestCaseData(new TestHeightStructure
+ {
+ StorageStructureArea =
+ {
+ Mean = (RoundedDouble) random.Next(),
+ CoefficientOfVariation = random.NextRoundedDouble()
+ }
+ }).SetName("Different StorageStructureArea");
+ yield return new TestCaseData(new TestHeightStructure
+ {
+ WidthFlowApertures =
+ {
+ Mean = (RoundedDouble) random.Next(),
+ StandardDeviation = random.NextRoundedDouble()
+ }
+ }).SetName("Different WidthFlowApertures");
+ yield return new TestCaseData(new HeightStructure(new HeightStructure.ConstructionProperties
+ {
+ Name = defaultName,
+ Id = defaultId,
+ Location = defaultLocation,
+ FailureProbabilityStructureWithErosion = random.NextDouble()
+ })).SetName("Different FailureProbabilityStructureWithErosion");
+ yield return new TestCaseData(new HeightStructure(new HeightStructure.ConstructionProperties
+ {
+ Name = defaultName,
+ Id = defaultId,
+ Location = defaultLocation,
+ StructureNormalOrientation = random.NextRoundedDouble()
+ })).SetName("Different StructureNormalOrientation");
+ }
+ }
+
+ }
+}
\ No newline at end of file
Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil/Ringtoets.HeightStructures.Data.TestUtil.csproj
===================================================================
diff -u -r1aa72eb5c37e0d4f92b247f0189b8e9435f6677b -r2e722835ebb7a4bc7a7bbcc07b6cfa9f5776e3d9
--- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil/Ringtoets.HeightStructures.Data.TestUtil.csproj (.../Ringtoets.HeightStructures.Data.TestUtil.csproj) (revision 1aa72eb5c37e0d4f92b247f0189b8e9435f6677b)
+++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil/Ringtoets.HeightStructures.Data.TestUtil.csproj (.../Ringtoets.HeightStructures.Data.TestUtil.csproj) (revision 2e722835ebb7a4bc7a7bbcc07b6cfa9f5776e3d9)
@@ -38,13 +38,18 @@
pdbonly
+
+ False
+ ..\..\..\..\packages\NUnit.3.6.0\lib\net40\nunit.framework.dll
+
Properties\GlobalAssembly.cs
+
@@ -55,6 +60,10 @@
{3BBFD65B-B277-4E50-AE6D-BD24C3434609}
Core.Common.Base
+
+ {D749EE4C-CE50-4C17-BF01-9A953028C126}
+ Core.Common.TestUtil
+
{d4200f43-3f72-4f42-af0a-8ced416a38ec}
Ringtoets.Common.Data
Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil/packages.config
===================================================================
diff -u
--- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil/packages.config (revision 0)
+++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil/packages.config (revision 2e722835ebb7a4bc7a7bbcc07b6cfa9f5776e3d9)
@@ -0,0 +1,26 @@
+
+
+
+
+
\ No newline at end of file
Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/FileImporters/HeightStructureUpdateDataStrategyTest.cs
===================================================================
diff -u -r121f0e24e6f6550f84a564228865287a87ad9e87 -r2e722835ebb7a4bc7a7bbcc07b6cfa9f5776e3d9
--- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/FileImporters/HeightStructureUpdateDataStrategyTest.cs (.../HeightStructureUpdateDataStrategyTest.cs) (revision 121f0e24e6f6550f84a564228865287a87ad9e87)
+++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/FileImporters/HeightStructureUpdateDataStrategyTest.cs (.../HeightStructureUpdateDataStrategyTest.cs) (revision 2e722835ebb7a4bc7a7bbcc07b6cfa9f5776e3d9)
@@ -23,9 +23,7 @@
using System.Collections.Generic;
using System.Linq;
using Core.Common.Base;
-using Core.Common.Base.Data;
using Core.Common.Base.Geometry;
-using Core.Common.TestUtil;
using NUnit.Framework;
using Ringtoets.Common.Data;
using Ringtoets.Common.Data.Exceptions;
@@ -46,86 +44,6 @@
{
private const string sourceFilePath = "some/path";
- private static IEnumerable DifferentHeightStructureWithSameId
- {
- get
- {
- var random = new Random(532);
- const string defaultId = "id";
- const string defaultName = "name";
- var defaultLocation = new Point2D(0, 0);
-
- yield return new TestCaseData(new TestHeightStructure(defaultId, "Different name"))
- .SetName("Different name");
- yield return new TestCaseData(new TestHeightStructure(new Point2D(1, 1), defaultId))
- .SetName("Different Location");
- yield return new TestCaseData(new TestHeightStructure
- {
- AllowedLevelIncreaseStorage =
- {
- Mean = (RoundedDouble) random.Next(),
- Shift = random.NextRoundedDouble(),
- StandardDeviation = random.NextRoundedDouble()
- }
- }).SetName("Different AllowedLevelIncreaseStorage");
- yield return new TestCaseData(new TestHeightStructure
- {
- CriticalOvertoppingDischarge =
- {
- Mean = (RoundedDouble) random.Next(),
- CoefficientOfVariation = random.NextRoundedDouble()
- }
- }).SetName("Different CriticalOvertoppingDischarge");
- yield return new TestCaseData(new TestHeightStructure
- {
- FlowWidthAtBottomProtection =
- {
- Mean = (RoundedDouble) random.Next(),
- Shift = random.NextRoundedDouble(),
- StandardDeviation = random.NextRoundedDouble()
- }
- }).SetName("Different FlowWidthAtBottomProtection");
- yield return new TestCaseData(new TestHeightStructure
- {
- LevelCrestStructure =
- {
- Mean = (RoundedDouble) random.Next(),
- StandardDeviation = random.NextRoundedDouble()
- }
- }).SetName("Different LevelCrestStructure");
- yield return new TestCaseData(new TestHeightStructure
- {
- StorageStructureArea =
- {
- Mean = (RoundedDouble) random.Next(),
- CoefficientOfVariation = random.NextRoundedDouble()
- }
- }).SetName("Different StorageStructureArea");
- yield return new TestCaseData(new TestHeightStructure
- {
- WidthFlowApertures =
- {
- Mean = (RoundedDouble) random.Next(),
- StandardDeviation = random.NextRoundedDouble()
- }
- }).SetName("Different WidthFlowApertures");
- yield return new TestCaseData(new HeightStructure(new HeightStructure.ConstructionProperties
- {
- Name = defaultName,
- Id = defaultId,
- Location = defaultLocation,
- FailureProbabilityStructureWithErosion = random.NextDouble()
- })).SetName("Different FailureProbabilityStructureWithErosion");
- yield return new TestCaseData(new HeightStructure(new HeightStructure.ConstructionProperties
- {
- Name = defaultName,
- Id = defaultId,
- Location = defaultLocation,
- StructureNormalOrientation = random.NextRoundedDouble()
- })).SetName("Different StructureNormalOrientation");
- }
- }
-
[Test]
public void Constructor_FailureMechanismNull_ThrowsArgumentNullException()
{
@@ -306,7 +224,7 @@
}
[Test]
- [TestCaseSource(nameof(DifferentHeightStructureWithSameId))]
+ [TestCaseSource(typeof(HeightStructurePermutationHelper), nameof(HeightStructurePermutationHelper.DifferentHeightStructureWithSameId))]
public void UpdateStructuresWithImportedData_SingleChange_UpdatesOnlySingleChange(HeightStructure readStructure)
{
// Setup