Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresInputTest.cs =================================================================== diff -u -ra95d1154c11d36bd230bcb7599872963f331ee15 -rbf3379d1adf449816e6fe5f941604ce2e6d0b707 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresInputTest.cs (.../ClosingStructuresInputTest.cs) (revision a95d1154c11d36bd230bcb7599872963f331ee15) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresInputTest.cs (.../ClosingStructuresInputTest.cs) (revision bf3379d1adf449816e6fe5f941604ce2e6d0b707) @@ -21,6 +21,7 @@ using System; using Core.Common.Base.Data; +using Core.Common.Base.Geometry; using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.ClosingStructures.Data.TestUtil; @@ -101,7 +102,7 @@ input.Structure = null; // Assert - AssertClosingStructure(null, input); + AssertClosingStructureInput(null, input); } [Test] @@ -120,7 +121,7 @@ double expectedFailureProbabilityStructureWithErosion = input.FailureProbabilityStructureWithErosion; // Pre-condition - AssertClosingStructure(structure, input); + AssertClosingStructureInput(structure, input); // When input.Structure = null; @@ -185,7 +186,7 @@ input.Structure = structure; // Assert - AssertClosingStructure(structure, input); + AssertClosingStructureInput(structure, input); } [Test] @@ -244,6 +245,47 @@ Assert.IsFalse(isStructureInputSynchronized); } + [Test] + public void SynchronizeStructureInput_StructureNotSet_ExpectedValues() + { + // Setup + var input = new ClosingStructuresInput(); + + // Call + input.SynchronizeStructureInput(); + + // Assert + AssertClosingStructureInput(null, input); + } + + [Test] + public void SynchronizeStructureInput_ChangedStructure_ExpectedValues() + { + // Setup + var differentStructure = new ClosingStructure(new ClosingStructure.ConstructionProperties + { + Id = "Test id", + Name = "Test name", + Location = new Point2D(-1, -1) + }); + + var input = new ClosingStructuresInput + { + Structure = new TestClosingStructure() + }; + + input.Structure.CopyProperties(differentStructure); + + // Precondition + AssertClosingStructureInput(new TestClosingStructure(), input); + + // Call + input.SynchronizeStructureInput(); + + // Assert + AssertClosingStructureInput(differentStructure, input); + } + #region Hydraulic data [Test] @@ -544,7 +586,7 @@ #region Helpers - private static void AssertClosingStructure(ClosingStructure expectedClosingStructure, ClosingStructuresInput input) + private static void AssertClosingStructureInput(ClosingStructure expectedClosingStructure, ClosingStructuresInput input) { if (expectedClosingStructure == null) { Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresInputTest.cs =================================================================== diff -u -ra95d1154c11d36bd230bcb7599872963f331ee15 -rbf3379d1adf449816e6fe5f941604ce2e6d0b707 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresInputTest.cs (.../HeightStructuresInputTest.cs) (revision a95d1154c11d36bd230bcb7599872963f331ee15) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresInputTest.cs (.../HeightStructuresInputTest.cs) (revision bf3379d1adf449816e6fe5f941604ce2e6d0b707) @@ -21,6 +21,7 @@ using System; using Core.Common.Base.Data; +using Core.Common.Base.Geometry; using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.Probabilistics; @@ -63,7 +64,7 @@ input.Structure = null; // Assert - AssertHeightStructure(null, input); + AssertHeightStructureInput(null, input); } [Test] @@ -79,7 +80,7 @@ RoundedDouble expectedDeviationWaveDirection = input.DeviationWaveDirection; // Pre-condition - AssertHeightStructure(structure, input); + AssertHeightStructureInput(structure, input); // When input.Structure = null; @@ -108,7 +109,7 @@ input.Structure = structure; // Assert - AssertHeightStructure(structure, input); + AssertHeightStructureInput(structure, input); } [Test] @@ -167,6 +168,47 @@ Assert.IsFalse(isStructureInputSynchronized); } + [Test] + public void SynchronizeStructureInput_StructureNotSet_ExpectedValues() + { + // Setup + var input = new HeightStructuresInput(); + + // Call + input.SynchronizeStructureInput(); + + // Assert + AssertHeightStructureInput(null, input); + } + + [Test] + public void SynchronizeStructureInput_ChangedStructure_ExpectedValues() + { + // Setup + var differentStructure = new HeightStructure(new HeightStructure.ConstructionProperties + { + Id = "Test id", + Name = "Test name", + Location = new Point2D(-1, -1) + }); + + var input = new HeightStructuresInput + { + Structure = new TestHeightStructure() + }; + + input.Structure.CopyProperties(differentStructure); + + // Precondition + AssertHeightStructureInput(new TestHeightStructure(), input); + + // Call + input.SynchronizeStructureInput(); + + // Assert + AssertHeightStructureInput(differentStructure, input); + } + #region Schematization [Test] @@ -244,7 +286,7 @@ #region Helpers - private static void AssertHeightStructure(HeightStructure expectedHeightStructure, HeightStructuresInput input) + private static void AssertHeightStructureInput(HeightStructure expectedHeightStructure, HeightStructuresInput input) { if (expectedHeightStructure == null) { Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructuresInputTest.cs =================================================================== diff -u -ra95d1154c11d36bd230bcb7599872963f331ee15 -rbf3379d1adf449816e6fe5f941604ce2e6d0b707 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructuresInputTest.cs (.../StabilityPointStructuresInputTest.cs) (revision a95d1154c11d36bd230bcb7599872963f331ee15) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructuresInputTest.cs (.../StabilityPointStructuresInputTest.cs) (revision bf3379d1adf449816e6fe5f941604ce2e6d0b707) @@ -21,6 +21,7 @@ using System; using Core.Common.Base.Data; +using Core.Common.Base.Geometry; using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.Probabilistics; @@ -176,7 +177,7 @@ input.Structure = null; // Assert - AssertStabilityPointStructure(null, input); + AssertStabilityPointStructureInput(null, input); } [Test] @@ -195,7 +196,7 @@ double expectedFailureProbabilityStructureWithErosion = input.FailureProbabilityStructureWithErosion; // Pre-condition - AssertStabilityPointStructure(structure, input); + AssertStabilityPointStructureInput(structure, input); // When input.Structure = null; @@ -329,7 +330,7 @@ input.Structure = structure; // Assert - AssertStabilityPointStructure(structure, input); + AssertStabilityPointStructureInput(structure, input); } [Test] @@ -388,6 +389,47 @@ Assert.IsFalse(isStructureInputSynchronized); } + [Test] + public void SynchronizeStructureInput_StructureNotSet_ExpectedValues() + { + // Setup + var input = new StabilityPointStructuresInput(); + + // Call + input.SynchronizeStructureInput(); + + // Assert + AssertStabilityPointStructureInput(null, input); + } + + [Test] + public void SynchronizeStructureInput_ChangedStructure_ExpectedValues() + { + // Setup + var differentStructure = new StabilityPointStructure(new StabilityPointStructure.ConstructionProperties + { + Id = "Test id", + Name = "Test name", + Location = new Point2D(-1, -1) + }); + + var input = new StabilityPointStructuresInput + { + Structure = new TestStabilityPointStructure() + }; + + input.Structure.CopyProperties(differentStructure); + + // Precondition + AssertStabilityPointStructureInput(new TestStabilityPointStructure(), input); + + // Call + input.SynchronizeStructureInput(); + + // Assert + AssertStabilityPointStructureInput(differentStructure, input); + } + #region Hydraulic data [Test] @@ -922,7 +964,7 @@ #region Helpers - private static void AssertStabilityPointStructure(StabilityPointStructure expectedStructure, StabilityPointStructuresInput input) + private static void AssertStabilityPointStructureInput(StabilityPointStructure expectedStructure, StabilityPointStructuresInput input) { if (expectedStructure == null) {