Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.IO/Configurations/ClosingStructuresCalculationConfigurationImporter.cs =================================================================== diff -u -r7179946a6b62ebb33a90167c52af7c32f1100d73 -r6b18e2c0134c97e01ba13c518fb7a8efa7f42253 --- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.IO/Configurations/ClosingStructuresCalculationConfigurationImporter.cs (.../ClosingStructuresCalculationConfigurationImporter.cs) (revision 7179946a6b62ebb33a90167c52af7c32f1100d73) +++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.IO/Configurations/ClosingStructuresCalculationConfigurationImporter.cs (.../ClosingStructuresCalculationConfigurationImporter.cs) (revision 6b18e2c0134c97e01ba13c518fb7a8efa7f42253) @@ -444,11 +444,11 @@ return false; } - private bool TrySetStructure(string structureName, StructuresCalculation calculation) + private bool TrySetStructure(string structureId, StructuresCalculation calculation) { ClosingStructure structure; - if (TryReadStructure(structureName, calculation.Name, availableStructures, out structure)) + if (TryReadStructure(structureId, calculation.Name, availableStructures, out structure)) { calculation.InputParameters.Structure = structure; return true; Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.TestUtil.Test/TestClosingStructureTest.cs =================================================================== diff -u -rf88343c0590cb04c7135ce141872940e59325927 -r6b18e2c0134c97e01ba13c518fb7a8efa7f42253 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.TestUtil.Test/TestClosingStructureTest.cs (.../TestClosingStructureTest.cs) (revision f88343c0590cb04c7135ce141872940e59325927) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.TestUtil.Test/TestClosingStructureTest.cs (.../TestClosingStructureTest.cs) (revision 6b18e2c0134c97e01ba13c518fb7a8efa7f42253) @@ -36,6 +36,7 @@ // Assert Assert.IsInstanceOf(structure); Assert.AreEqual("test", structure.Name); + Assert.AreEqual("id", structure.Id); Assert.AreEqual(new Point2D(12345.56789, 9876.54321), structure.Location); Assert.AreEqual(ClosingStructureInflowModelType.VerticalWall, structure.InflowModelType); AssertTestClosingStructureDefaults(structure); @@ -53,12 +54,32 @@ // Assert Assert.IsInstanceOf(structure); Assert.AreEqual(name, structure.Name); + Assert.AreEqual("id", structure.Id); Assert.AreEqual(new Point2D(12345.56789, 9876.54321), structure.Location); Assert.AreEqual(ClosingStructureInflowModelType.VerticalWall, structure.InflowModelType); AssertTestClosingStructureDefaults(structure); } [Test] + public void Constructor_WithStructureNameAndId_ExpectedValues() + { + // Setup + const string name = ""; + const string id = "(structure); + Assert.AreEqual(name, structure.Name); + Assert.AreEqual(id, structure.Id); + Assert.AreEqual(new Point2D(12345.56789, 9876.54321), structure.Location); + Assert.AreEqual(ClosingStructureInflowModelType.VerticalWall, structure.InflowModelType); + AssertTestClosingStructureDefaults(structure); + } + + [Test] public void Constructor_WithLocation_ExpectedValues() { // Setup @@ -70,6 +91,7 @@ // Assert Assert.IsInstanceOf(structure); Assert.AreEqual("test", structure.Name); + Assert.AreEqual("id", structure.Id); Assert.AreEqual(location, structure.Location); Assert.AreEqual(ClosingStructureInflowModelType.VerticalWall, structure.InflowModelType); AssertTestClosingStructureDefaults(structure); @@ -87,15 +109,14 @@ // Assert Assert.IsInstanceOf(structure); Assert.AreEqual("test", structure.Name); + Assert.AreEqual("id", structure.Id); Assert.AreEqual(new Point2D(12345.56789, 9876.54321), structure.Location); Assert.AreEqual(type, structure.InflowModelType); AssertTestClosingStructureDefaults(structure); } private static void AssertTestClosingStructureDefaults(ClosingStructure structure) { - Assert.AreEqual("id", structure.Id); - Assert.AreEqual(10.0, structure.StructureNormalOrientation.Value); Assert.AreEqual(20000, structure.StorageStructureArea.Mean.Value); Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.TestUtil/TestClosingStructure.cs =================================================================== diff -u -rf88343c0590cb04c7135ce141872940e59325927 -r6b18e2c0134c97e01ba13c518fb7a8efa7f42253 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.TestUtil/TestClosingStructure.cs (.../TestClosingStructure.cs) (revision f88343c0590cb04c7135ce141872940e59325927) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.TestUtil/TestClosingStructure.cs (.../TestClosingStructure.cs) (revision 6b18e2c0134c97e01ba13c518fb7a8efa7f42253) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using Core.Common.Base.Data; using Core.Common.Base.Geometry; @@ -39,33 +40,52 @@ /// Creates a new instance of . /// /// The name of the structure. + /// Thrown when + /// is null, empty or consists of only whitespaces. public TestClosingStructure(string name) - : this(name, new Point2D(12345.56789, 9876.54321), ClosingStructureInflowModelType.VerticalWall) {} + : this(name, "id", new Point2D(12345.56789, 9876.54321), ClosingStructureInflowModelType.VerticalWall) {} /// /// Creates a new instance of . /// + /// The name of the structure. + /// The id of the structure. + /// Thrown when + /// or is null, empty or consists of only whitespaces. + public TestClosingStructure(string name, string id) + : this(name, id, new Point2D(12345.56789, 9876.54321), ClosingStructureInflowModelType.VerticalWall) { } + + /// + /// Creates a new instance of . + /// /// The location of the structure. - public TestClosingStructure(Point2D location) : this("test", location, ClosingStructureInflowModelType.VerticalWall) {} + /// Thrown when + /// is null. + public TestClosingStructure(Point2D location) : this("test", "id", location, ClosingStructureInflowModelType.VerticalWall) {} /// /// Creates a new instance of . /// /// The inflow model type of the structure. public TestClosingStructure(ClosingStructureInflowModelType type) - : this("test", new Point2D(12345.56789, 9876.54321), type) {} + : this("test", "id", new Point2D(12345.56789, 9876.54321), type) {} /// /// Creates a new instance of . /// /// The name of the structure. + /// The id of the structure /// The location of the structure. /// The inflow model type of the structure. - private TestClosingStructure(string name, Point2D location, ClosingStructureInflowModelType type) + /// Thrown when + /// is null. + /// Thrown when + /// or is null, empty or consists of only whitespaces. + private TestClosingStructure(string name, string id, Point2D location, ClosingStructureInflowModelType type) : base(new ConstructionProperties { Name = name, - Id = "id", + Id = id, Location = location, StorageStructureArea = { Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.IO.Test/Configurations/ClosingStructuresCalculationConfigurationImporterTest.cs =================================================================== diff -u -rde6048a31dbe63930a6ea68b04a4f37879333106 -r6b18e2c0134c97e01ba13c518fb7a8efa7f42253 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.IO.Test/Configurations/ClosingStructuresCalculationConfigurationImporterTest.cs (.../ClosingStructuresCalculationConfigurationImporterTest.cs) (revision de6048a31dbe63930a6ea68b04a4f37879333106) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.IO.Test/Configurations/ClosingStructuresCalculationConfigurationImporterTest.cs (.../ClosingStructuresCalculationConfigurationImporterTest.cs) (revision 6b18e2c0134c97e01ba13c518fb7a8efa7f42253) @@ -219,7 +219,7 @@ Enumerable.Empty(), new ClosingStructuresFailureMechanism()); - // Assert + // AssertTC Assert.IsInstanceOf>(importer); } @@ -296,7 +296,7 @@ string filePath = Path.Combine(importerPath, file); var calculationGroup = new CalculationGroup(); - var structure = new TestClosingStructure("kunstwerk1"); + var structure = new TestClosingStructure("kunstwerk1", "kunstwerk1"); var foreshoreProfile = new TestForeshoreProfile("profiel 1"); var importer = new ClosingStructuresCalculationConfigurationImporter(filePath, @@ -366,7 +366,7 @@ { new Point2D(0, 3) }); - var structure = new TestClosingStructure("kunstwerk1"); + var structure = new TestClosingStructure("kunstwerk1", "kunstwerk1"); var importer = new ClosingStructuresCalculationConfigurationImporter( filePath, calculationGroup, @@ -483,7 +483,7 @@ string filePath = Path.Combine(importerPath, "validConfigurationStochastMeansOnly.xml"); var calculationGroup = new CalculationGroup(); - var structure = new TestClosingStructure("kunstwerk1"); + var structure = new TestClosingStructure("kunstwerk1", "kunstwerk1"); var importer = new ClosingStructuresCalculationConfigurationImporter( filePath, calculationGroup, @@ -568,7 +568,7 @@ string filePath = Path.Combine(importerPath, "validConfigurationStochastStandardDeviationVariationCoefficientOnly.xml"); var calculationGroup = new CalculationGroup(); - var structure = new TestClosingStructure("kunstwerk1"); + var structure = new TestClosingStructure("kunstwerk1", "kunstwerk1"); var importer = new ClosingStructuresCalculationConfigurationImporter( filePath, calculationGroup, @@ -645,7 +645,7 @@ string filePath = Path.Combine(importerPath, file); var calculationGroup = new CalculationGroup(); - var structure = new TestClosingStructure("kunstwerk1"); + var structure = new TestClosingStructure("kunstwerk1", "kunstwerk1"); var importer = new ClosingStructuresCalculationConfigurationImporter( filePath, calculationGroup, Index: Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/Import/CalculationConfigurationImporter.cs =================================================================== diff -u -r7179946a6b62ebb33a90167c52af7c32f1100d73 -r6b18e2c0134c97e01ba13c518fb7a8efa7f42253 --- Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/Import/CalculationConfigurationImporter.cs (.../CalculationConfigurationImporter.cs) (revision 7179946a6b62ebb33a90167c52af7c32f1100d73) +++ Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/Import/CalculationConfigurationImporter.cs (.../CalculationConfigurationImporter.cs) (revision 6b18e2c0134c97e01ba13c518fb7a8efa7f42253) @@ -170,21 +170,21 @@ } /// - /// Tries to find the structure with the given + /// Tries to find the structure with the given /// in the . /// /// The type of the to read. - /// The name of the structure to find. + /// The id of the structure to find. /// Name of the calculation to assign the structure to. /// The collection of to search in. - /// The structure with the name equal to + /// The structure with the name equal to /// if there was any. - /// true if no is given, or when a structure with - /// the name was found, false otherwise. + /// true if no is given, or when a structure with + /// the name was found, false otherwise. /// Thrown when /// or is null. protected bool TryReadStructure( - string structureName, + string structureId, string calculationName, IEnumerable structures, out T foundStructure) @@ -199,15 +199,15 @@ throw new ArgumentNullException(nameof(structures)); } foundStructure = null; - if (structureName != null) + if (structureId != null) { - T structure = structures.FirstOrDefault(l => l.Name == structureName); + T structure = structures.FirstOrDefault(l => l.Id == structureId); if (structure == null) { Log.LogCalculationConversionError(string.Format( Resources.CalculationConfigurationImporter_ReadStructure_Structure_0_does_not_exist, - structureName), + structureId), calculationName); return false; Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/Import/CalculationConfigurationImporterTest.cs =================================================================== diff -u -rb3b6c13cf736c134476b3db34281332d01ca86b1 -r6b18e2c0134c97e01ba13c518fb7a8efa7f42253 --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/Import/CalculationConfigurationImporterTest.cs (.../CalculationConfigurationImporterTest.cs) (revision b3b6c13cf736c134476b3db34281332d01ca86b1) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/Import/CalculationConfigurationImporterTest.cs (.../CalculationConfigurationImporterTest.cs) (revision 6b18e2c0134c97e01ba13c518fb7a8efa7f42253) @@ -867,10 +867,10 @@ private class TestStructure : StructureBase { - public TestStructure(string name) : base(new ConstructionProperties + public TestStructure(string Id) : base(new ConstructionProperties { - Name = name, - Id = "Id", + Name = "Name", + Id = Id, Location = new Point2D(0, 0), StructureNormalOrientation = (RoundedDouble) 2 }) {} Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.IO/Configurations/HeightStructuresCalculationConfigurationImporter.cs =================================================================== diff -u -r7179946a6b62ebb33a90167c52af7c32f1100d73 -r6b18e2c0134c97e01ba13c518fb7a8efa7f42253 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.IO/Configurations/HeightStructuresCalculationConfigurationImporter.cs (.../HeightStructuresCalculationConfigurationImporter.cs) (revision 7179946a6b62ebb33a90167c52af7c32f1100d73) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.IO/Configurations/HeightStructuresCalculationConfigurationImporter.cs (.../HeightStructuresCalculationConfigurationImporter.cs) (revision 6b18e2c0134c97e01ba13c518fb7a8efa7f42253) @@ -239,11 +239,11 @@ return false; } - private bool TrySetStructure(string structureName, StructuresCalculation calculation) + private bool TrySetStructure(string structureId, StructuresCalculation calculation) { HeightStructure structure; - if (TryReadStructure(structureName, calculation.Name, availableStructures, out structure)) + if (TryReadStructure(structureId, calculation.Name, availableStructures, out structure)) { calculation.InputParameters.Structure = structure; return true; Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil/TestHeightStructure.cs =================================================================== diff -u -rc1594afa56f02899bd122fc4fd4ccf4d76b236b7 -r6b18e2c0134c97e01ba13c518fb7a8efa7f42253 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil/TestHeightStructure.cs (.../TestHeightStructure.cs) (revision c1594afa56f02899bd122fc4fd4ccf4d76b236b7) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil/TestHeightStructure.cs (.../TestHeightStructure.cs) (revision 6b18e2c0134c97e01ba13c518fb7a8efa7f42253) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using Core.Common.Base.Data; using Core.Common.Base.Geometry; @@ -39,6 +40,8 @@ /// Creates a new instance of . /// /// The name of the structure. + /// Thrown when + /// is null, empty or consists of only whitespaces. public TestHeightStructure(string name) : this(name, "Id", new Point2D(0.0, 0.0)) {} @@ -47,13 +50,17 @@ /// /// The name of the structure. /// The id of the structure. + /// Thrown when + /// or is null, empty or consists of only whitespaces. public TestHeightStructure(string name, string id) : this(name, id, new Point2D(0.0, 0.0)) {} /// /// Creates a new instance of . /// /// The location of the structure. + /// Thrown when + /// is null. public TestHeightStructure(Point2D location) : this("Test", "Id", location) {} @@ -62,6 +69,10 @@ /// /// The location of the structure. /// The id of the structure. + /// Thrown when + /// is null. + /// Thrown when + /// is null, empty or consists of only whitespaces. public TestHeightStructure(Point2D location, string id) : this("Test", id, location) {} @@ -71,6 +82,10 @@ /// The name of the structure. /// The id of the structure. /// The location of the structure. + /// Thrown when + /// is null. + /// Thrown when + /// or is null, empty or consists of only whitespaces. public TestHeightStructure(string name, string id, Point2D location) : base(new ConstructionProperties { Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.IO.Test/Configurations/HeightStructuresCalculationConfigurationImporterTest.cs =================================================================== diff -u -rde6048a31dbe63930a6ea68b04a4f37879333106 -r6b18e2c0134c97e01ba13c518fb7a8efa7f42253 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.IO.Test/Configurations/HeightStructuresCalculationConfigurationImporterTest.cs (.../HeightStructuresCalculationConfigurationImporterTest.cs) (revision de6048a31dbe63930a6ea68b04a4f37879333106) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.IO.Test/Configurations/HeightStructuresCalculationConfigurationImporterTest.cs (.../HeightStructuresCalculationConfigurationImporterTest.cs) (revision 6b18e2c0134c97e01ba13c518fb7a8efa7f42253) @@ -240,7 +240,7 @@ string filePath = Path.Combine(importerPath, file); var calculationGroup = new CalculationGroup(); - var structure = new TestHeightStructure("kunstwerk1"); + var structure = new TestHeightStructure("kunstwerk1", "kunstwerk1"); var foreshoreProfile = new TestForeshoreProfile("profiel 1"); var importer = new HeightStructuresCalculationConfigurationImporter(filePath, @@ -310,7 +310,7 @@ { new Point2D(0, 3) }); - var structure = new TestHeightStructure("kunstwerk1"); + var structure = new TestHeightStructure("kunstwerk1", "kunstwerk1"); var importer = new HeightStructuresCalculationConfigurationImporter( filePath, calculationGroup, @@ -402,7 +402,7 @@ string filePath = Path.Combine(importerPath, "validConfigurationStochastMeansOnly.xml"); var calculationGroup = new CalculationGroup(); - var structure = new TestHeightStructure("kunstwerk1"); + var structure = new TestHeightStructure("kunstwerk1", "kunstwerk1"); var importer = new HeightStructuresCalculationConfigurationImporter( filePath, calculationGroup, @@ -471,7 +471,7 @@ string filePath = Path.Combine(importerPath, "validConfigurationStochastStandardDeviationVariationCoefficientOnly.xml"); var calculationGroup = new CalculationGroup(); - var structure = new TestHeightStructure("kunstwerk1"); + var structure = new TestHeightStructure("kunstwerk1", "kunstwerk1"); var importer = new HeightStructuresCalculationConfigurationImporter( filePath, calculationGroup, @@ -536,7 +536,7 @@ string filePath = Path.Combine(importerPath, file); var calculationGroup = new CalculationGroup(); - var structure = new TestHeightStructure("kunstwerk1"); + var structure = new TestHeightStructure("kunstwerk1", "kunstwerk1"); var importer = new HeightStructuresCalculationConfigurationImporter( filePath, calculationGroup, Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/StabilityPointStructuresCalculationConfigurationImporter.cs =================================================================== diff -u -r7179946a6b62ebb33a90167c52af7c32f1100d73 -r6b18e2c0134c97e01ba13c518fb7a8efa7f42253 --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/StabilityPointStructuresCalculationConfigurationImporter.cs (.../StabilityPointStructuresCalculationConfigurationImporter.cs) (revision 7179946a6b62ebb33a90167c52af7c32f1100d73) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/StabilityPointStructuresCalculationConfigurationImporter.cs (.../StabilityPointStructuresCalculationConfigurationImporter.cs) (revision 6b18e2c0134c97e01ba13c518fb7a8efa7f42253) @@ -495,11 +495,11 @@ return false; } - private bool TrySetStructure(string structureName, StructuresCalculation calculation) + private bool TrySetStructure(string structureId, StructuresCalculation calculation) { StabilityPointStructure structure; - if (TryReadStructure(structureName, calculation.Name, availableStructures, out structure)) + if (TryReadStructure(structureId, calculation.Name, availableStructures, out structure)) { calculation.InputParameters.Structure = structure; return true; Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.TestUtil.Test/TestStabilityPointStructureTest.cs =================================================================== diff -u -rff948d4633181ead2677ab35467a93b4118c6751 -r6b18e2c0134c97e01ba13c518fb7a8efa7f42253 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.TestUtil.Test/TestStabilityPointStructureTest.cs (.../TestStabilityPointStructureTest.cs) (revision ff948d4633181ead2677ab35467a93b4118c6751) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.TestUtil.Test/TestStabilityPointStructureTest.cs (.../TestStabilityPointStructureTest.cs) (revision 6b18e2c0134c97e01ba13c518fb7a8efa7f42253) @@ -40,74 +40,7 @@ Assert.AreEqual("aName", structure.Name); Assert.AreEqual("anId", structure.Id); Assert.AreEqual(new Point2D(1.234, 2.3456), structure.Location); - AssertAreEqual(123.456, structure.StructureNormalOrientation); - - AssertAreEqual(234.567, structure.StorageStructureArea.Mean); - AssertAreEqual(0.234, structure.StorageStructureArea.CoefficientOfVariation); - - AssertAreEqual(345.678, structure.AllowedLevelIncreaseStorage.Mean); - AssertAreEqual(0.35, structure.AllowedLevelIncreaseStorage.StandardDeviation); - - AssertAreEqual(456.789, structure.WidthFlowApertures.Mean); - AssertAreEqual(0.456, structure.WidthFlowApertures.StandardDeviation); - - AssertAreEqual(567.890, structure.InsideWaterLevel.Mean); - AssertAreEqual(0.567, structure.InsideWaterLevel.StandardDeviation); - - AssertAreEqual(678.901, structure.ThresholdHeightOpenWeir.Mean); - AssertAreEqual(0.678, structure.ThresholdHeightOpenWeir.StandardDeviation); - - AssertAreEqual(789.012, structure.CriticalOvertoppingDischarge.Mean); - AssertAreEqual(0.789, structure.CriticalOvertoppingDischarge.CoefficientOfVariation); - - AssertAreEqual(890.123, structure.FlowWidthAtBottomProtection.Mean); - AssertAreEqual(0.890, structure.FlowWidthAtBottomProtection.StandardDeviation); - - AssertAreEqual(901.234, structure.ConstructiveStrengthLinearLoadModel.Mean); - AssertAreEqual(0.901, structure.ConstructiveStrengthLinearLoadModel.CoefficientOfVariation); - - AssertAreEqual(123.456, structure.ConstructiveStrengthQuadraticLoadModel.Mean); - AssertAreEqual(0.123, structure.ConstructiveStrengthQuadraticLoadModel.CoefficientOfVariation); - - AssertAreEqual(234.567, structure.BankWidth.Mean); - AssertAreEqual(0.234, structure.BankWidth.StandardDeviation); - - AssertAreEqual(345.678, structure.InsideWaterLevelFailureConstruction.Mean); - AssertAreEqual(0.35, structure.InsideWaterLevelFailureConstruction.StandardDeviation); - - AssertAreEqual(555.555, structure.EvaluationLevel); - - AssertAreEqual(456.789, structure.LevelCrestStructure.Mean); - AssertAreEqual(0.456, structure.LevelCrestStructure.StandardDeviation); - - AssertAreEqual(555.55, structure.VerticalDistance); - Assert.AreEqual(0.55, structure.FailureProbabilityRepairClosure); - - AssertAreEqual(567.890, structure.FailureCollisionEnergy.Mean); - AssertAreEqual(0.567, structure.FailureCollisionEnergy.CoefficientOfVariation); - - AssertAreEqual(7777777.777, structure.ShipMass.Mean); - AssertAreEqual(0.777, structure.ShipMass.CoefficientOfVariation); - - AssertAreEqual(567.890, structure.ShipVelocity.Mean); - AssertAreEqual(0.567, structure.ShipVelocity.CoefficientOfVariation); - - Assert.AreEqual(42, structure.LevellingCount); - Assert.AreEqual(0.55, structure.ProbabilityCollisionSecondaryStructure); - - AssertAreEqual(678.901, structure.FlowVelocityStructureClosable.Mean); - AssertAreEqual(0.2, structure.FlowVelocityStructureClosable.CoefficientOfVariation); - - AssertAreEqual(789.012, structure.StabilityLinearLoadModel.Mean); - AssertAreEqual(0.789, structure.StabilityLinearLoadModel.CoefficientOfVariation); - - AssertAreEqual(890.123, structure.StabilityQuadraticLoadModel.Mean); - AssertAreEqual(0.890, structure.StabilityQuadraticLoadModel.CoefficientOfVariation); - - AssertAreEqual(901.234, structure.AreaFlowApertures.Mean); - AssertAreEqual(0.901, structure.AreaFlowApertures.StandardDeviation); - - Assert.AreEqual(StabilityPointStructureInflowModelType.FloodedCulvert, structure.InflowModelType); + AssertStabilityPointStructuresDefault(structure); } [Test] @@ -124,74 +57,25 @@ Assert.AreEqual(name, structure.Name); Assert.AreEqual("anId", structure.Id); Assert.AreEqual(new Point2D(1.234, 2.3456), structure.Location); - AssertAreEqual(123.456, structure.StructureNormalOrientation); + AssertStabilityPointStructuresDefault(structure); + } - AssertAreEqual(234.567, structure.StorageStructureArea.Mean); - AssertAreEqual(0.234, structure.StorageStructureArea.CoefficientOfVariation); + [Test] + public void Constructor_WithNameAndId_ExpectedValues() + { + // Setup + const string name = "cool name!"; + const string id = "and a cool Id too!"; - AssertAreEqual(345.678, structure.AllowedLevelIncreaseStorage.Mean); - AssertAreEqual(0.35, structure.AllowedLevelIncreaseStorage.StandardDeviation); + // Call + var structure = new TestStabilityPointStructure(name, id); - AssertAreEqual(456.789, structure.WidthFlowApertures.Mean); - AssertAreEqual(0.456, structure.WidthFlowApertures.StandardDeviation); - - AssertAreEqual(567.890, structure.InsideWaterLevel.Mean); - AssertAreEqual(0.567, structure.InsideWaterLevel.StandardDeviation); - - AssertAreEqual(678.901, structure.ThresholdHeightOpenWeir.Mean); - AssertAreEqual(0.678, structure.ThresholdHeightOpenWeir.StandardDeviation); - - AssertAreEqual(789.012, structure.CriticalOvertoppingDischarge.Mean); - AssertAreEqual(0.789, structure.CriticalOvertoppingDischarge.CoefficientOfVariation); - - AssertAreEqual(890.123, structure.FlowWidthAtBottomProtection.Mean); - AssertAreEqual(0.890, structure.FlowWidthAtBottomProtection.StandardDeviation); - - AssertAreEqual(901.234, structure.ConstructiveStrengthLinearLoadModel.Mean); - AssertAreEqual(0.901, structure.ConstructiveStrengthLinearLoadModel.CoefficientOfVariation); - - AssertAreEqual(123.456, structure.ConstructiveStrengthQuadraticLoadModel.Mean); - AssertAreEqual(0.123, structure.ConstructiveStrengthQuadraticLoadModel.CoefficientOfVariation); - - AssertAreEqual(234.567, structure.BankWidth.Mean); - AssertAreEqual(0.234, structure.BankWidth.StandardDeviation); - - AssertAreEqual(345.678, structure.InsideWaterLevelFailureConstruction.Mean); - AssertAreEqual(0.35, structure.InsideWaterLevelFailureConstruction.StandardDeviation); - - AssertAreEqual(555.555, structure.EvaluationLevel); - - AssertAreEqual(456.789, structure.LevelCrestStructure.Mean); - AssertAreEqual(0.456, structure.LevelCrestStructure.StandardDeviation); - - AssertAreEqual(555.55, structure.VerticalDistance); - Assert.AreEqual(0.55, structure.FailureProbabilityRepairClosure); - - AssertAreEqual(567.890, structure.FailureCollisionEnergy.Mean); - AssertAreEqual(0.567, structure.FailureCollisionEnergy.CoefficientOfVariation); - - AssertAreEqual(7777777.777, structure.ShipMass.Mean); - AssertAreEqual(0.777, structure.ShipMass.CoefficientOfVariation); - - AssertAreEqual(567.890, structure.ShipVelocity.Mean); - AssertAreEqual(0.567, structure.ShipVelocity.CoefficientOfVariation); - - Assert.AreEqual(42, structure.LevellingCount); - Assert.AreEqual(0.55, structure.ProbabilityCollisionSecondaryStructure); - - AssertAreEqual(678.901, structure.FlowVelocityStructureClosable.Mean); - AssertAreEqual(0.2, structure.FlowVelocityStructureClosable.CoefficientOfVariation); - - AssertAreEqual(789.012, structure.StabilityLinearLoadModel.Mean); - AssertAreEqual(0.789, structure.StabilityLinearLoadModel.CoefficientOfVariation); - - AssertAreEqual(890.123, structure.StabilityQuadraticLoadModel.Mean); - AssertAreEqual(0.890, structure.StabilityQuadraticLoadModel.CoefficientOfVariation); - - AssertAreEqual(901.234, structure.AreaFlowApertures.Mean); - AssertAreEqual(0.901, structure.AreaFlowApertures.StandardDeviation); - - Assert.AreEqual(StabilityPointStructureInflowModelType.FloodedCulvert, structure.InflowModelType); + // Assert + Assert.IsInstanceOf(structure); + Assert.AreEqual(name, structure.Name); + Assert.AreEqual(id, structure.Id); + Assert.AreEqual(new Point2D(1.234, 2.3456), structure.Location); + AssertStabilityPointStructuresDefault(structure); } [Test] @@ -208,6 +92,11 @@ Assert.AreEqual("aName", structure.Name); Assert.AreEqual("anId", structure.Id); Assert.AreEqual(point, structure.Location); + AssertStabilityPointStructuresDefault(structure); + } + + private static void AssertStabilityPointStructuresDefault(TestStabilityPointStructure structure) + { AssertAreEqual(123.456, structure.StructureNormalOrientation); AssertAreEqual(234.567, structure.StorageStructureArea.Mean); Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.TestUtil/TestStabilityPointStructure.cs =================================================================== diff -u -rff948d4633181ead2677ab35467a93b4118c6751 -r6b18e2c0134c97e01ba13c518fb7a8efa7f42253 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.TestUtil/TestStabilityPointStructure.cs (.../TestStabilityPointStructure.cs) (revision ff948d4633181ead2677ab35467a93b4118c6751) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.TestUtil/TestStabilityPointStructure.cs (.../TestStabilityPointStructure.cs) (revision 6b18e2c0134c97e01ba13c518fb7a8efa7f42253) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using Core.Common.Base.Data; using Core.Common.Base.Geometry; @@ -32,30 +33,48 @@ /// /// Creates a new instance of . /// - public TestStabilityPointStructure() : this("aName", new Point2D(1.234, 2.3456)) {} + public TestStabilityPointStructure() : this("aName", "anId", new Point2D(1.234, 2.3456)) {} /// /// Creates a new instance of . /// /// The name of the structure. - public TestStabilityPointStructure(string name) : this(name, new Point2D(1.234, 2.3456)) {} + /// Thrown when + /// is null, empty or consists of only whitespaces. + public TestStabilityPointStructure(string name) : this(name, "anId", new Point2D(1.234, 2.3456)) {} /// /// Creates a new instance of . /// + /// The name of the structure. + /// The id of the structure. + /// Thrown when + /// or is null, empty or consists of only whitespaces. + public TestStabilityPointStructure(string name, string id) : this(name, id, new Point2D(1.234, 2.3456)) { } + + /// + /// Creates a new instance of . + /// /// The location of the structure. - public TestStabilityPointStructure(Point2D location) : this("aName", location) {} + /// Thrown when + /// is null. + public TestStabilityPointStructure(Point2D location) : this("aName", "anId", location) {} /// /// Creates a new instance of . /// /// The name of the structure. + /// /// The location of the structure. - private TestStabilityPointStructure(string name, Point2D location) + /// Thrown when + /// is null. + /// Thrown when + /// or is null, empty or consists of only whitespaces. + private TestStabilityPointStructure(string name, string id, Point2D location) : base(new ConstructionProperties { Name = name, - Id = "anId", + Id = id, Location = location, StructureNormalOrientation = (RoundedDouble) 123.456, StorageStructureArea = Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.IO.Test/Configurations/StabilityPointStructuresCalculationConfigurationImporterTest.cs =================================================================== diff -u -rde6048a31dbe63930a6ea68b04a4f37879333106 -r6b18e2c0134c97e01ba13c518fb7a8efa7f42253 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.IO.Test/Configurations/StabilityPointStructuresCalculationConfigurationImporterTest.cs (.../StabilityPointStructuresCalculationConfigurationImporterTest.cs) (revision de6048a31dbe63930a6ea68b04a4f37879333106) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.IO.Test/Configurations/StabilityPointStructuresCalculationConfigurationImporterTest.cs (.../StabilityPointStructuresCalculationConfigurationImporterTest.cs) (revision 6b18e2c0134c97e01ba13c518fb7a8efa7f42253) @@ -560,7 +560,7 @@ string filePath = Path.Combine(importerPath, file); var calculationGroup = new CalculationGroup(); - var structure = new TestStabilityPointStructure("kunstwerk1"); + var structure = new TestStabilityPointStructure("kunstwerk1", "kunstwerk1"); var foreshoreProfile = new TestForeshoreProfile("profiel 1"); var importer = new StabilityPointStructuresCalculationConfigurationImporter( @@ -627,7 +627,7 @@ string filePath = Path.Combine(importerPath, "validConfigurationStochastMeansOnly.xml"); var calculationGroup = new CalculationGroup(); - var structure = new TestStabilityPointStructure("kunstwerk1"); + var structure = new TestStabilityPointStructure("kunstwerk1", "kunstwerk1"); var importer = new StabilityPointStructuresCalculationConfigurationImporter( filePath, calculationGroup, @@ -753,7 +753,7 @@ string filePath = Path.Combine(importerPath, "validConfigurationStochastStandardDeviationVariationCoefficientOnly.xml"); var calculationGroup = new CalculationGroup(); - var structure = new TestStabilityPointStructure("kunstwerk1"); + var structure = new TestStabilityPointStructure("kunstwerk1", "kunstwerk1"); var importer = new StabilityPointStructuresCalculationConfigurationImporter( filePath, calculationGroup, @@ -867,7 +867,7 @@ string filePath = Path.Combine(importerPath, file); var calculationGroup = new CalculationGroup(); - var structure = new TestStabilityPointStructure("kunstwerk1"); + var structure = new TestStabilityPointStructure("kunstwerk1", "kunstwerk1"); var importer = new StabilityPointStructuresCalculationConfigurationImporter( filePath, calculationGroup, @@ -905,7 +905,7 @@ { new Point2D(0, 3) }); - var structure = new TestStabilityPointStructure("kunstwerk1"); + var structure = new TestStabilityPointStructure("kunstwerk1", "kunstwerk1"); var importer = new StabilityPointStructuresCalculationConfigurationImporter( filePath, calculationGroup, @@ -1077,7 +1077,7 @@ string filePath = Path.Combine(importerPath, "validConfigurationUnrounded.xml"); var calculationGroup = new CalculationGroup(); - var structure = new TestStabilityPointStructure("kunstwerk1"); + var structure = new TestStabilityPointStructure("kunstwerk1", "kunstwerk1"); var importer = new StabilityPointStructuresCalculationConfigurationImporter( filePath, calculationGroup,