Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil.Test/TestHeightStructureTest.cs =================================================================== diff -u -rf9e4f420b403e6417f5dc2ba6d7beab9424baf89 -r53785e0fd2752f08a43b649e0c4cd56955ec374d --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil.Test/TestHeightStructureTest.cs (.../TestHeightStructureTest.cs) (revision f9e4f420b403e6417f5dc2ba6d7beab9424baf89) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil.Test/TestHeightStructureTest.cs (.../TestHeightStructureTest.cs) (revision 53785e0fd2752f08a43b649e0c4cd56955ec374d) @@ -32,74 +32,65 @@ [Test] public void Constructor_ExpectedValues() { + // Setup + const string expectedName = "Test"; + var expectedLocation = new Point2D(0, 0); + // Call var heightStructure = new TestHeightStructure(); // Assert - Assert.AreEqual("Test", heightStructure.Name); - Assert.AreEqual("Id", heightStructure.Id); - var location = new Point2D(0, 0); - Assert.AreEqual(location.X, heightStructure.Location.X); - Assert.AreEqual(location.Y, heightStructure.Location.Y); + AssertTestHeightStructure(heightStructure, expectedName, expectedLocation); + } - Assert.IsInstanceOf(heightStructure.StructureNormalOrientation); - Assert.AreEqual(2, heightStructure.StructureNormalOrientation.NumberOfDecimalPlaces); - Assert.AreEqual(0.12, heightStructure.StructureNormalOrientation.Value); + [Test] + public void Constructor_CustomLocation_ExpectedValues() + { + // Setup + const string expectedName = "Test"; + var customLocation = new Point2D(10, 20); - NormalDistribution levelCrestStructure = heightStructure.LevelCrestStructure; - Assert.AreEqual(2, levelCrestStructure.Mean.NumberOfDecimalPlaces); - Assert.AreEqual(234.57, levelCrestStructure.Mean.Value); - Assert.AreEqual(2, levelCrestStructure.StandardDeviation.NumberOfDecimalPlaces); - Assert.AreEqual(0.23, levelCrestStructure.StandardDeviation.Value); + // Call + var heightStructure = new TestHeightStructure(customLocation); - LogNormalDistribution flowWidthAtBottomProtection = heightStructure.FlowWidthAtBottomProtection; - Assert.AreEqual(2, flowWidthAtBottomProtection.Mean.NumberOfDecimalPlaces); - Assert.AreEqual(345.68, flowWidthAtBottomProtection.Mean.Value); - Assert.AreEqual(2, flowWidthAtBottomProtection.StandardDeviation.NumberOfDecimalPlaces); - Assert.AreEqual(0.35, flowWidthAtBottomProtection.StandardDeviation.Value); + // Assert + AssertTestHeightStructure(heightStructure, expectedName, customLocation); + } - VariationCoefficientLogNormalDistribution criticalOvertoppingDischarge = heightStructure.CriticalOvertoppingDischarge; - Assert.AreEqual(2, criticalOvertoppingDischarge.Mean.NumberOfDecimalPlaces); - Assert.AreEqual(456.79, criticalOvertoppingDischarge.Mean.Value); - Assert.AreEqual(2, criticalOvertoppingDischarge.CoefficientOfVariation.NumberOfDecimalPlaces); - Assert.AreEqual(0.46, criticalOvertoppingDischarge.CoefficientOfVariation.Value); + [Test] + public void Constructor_CustomName_ExpectedValues() + { + // Setup + const string customName = "A different name for structure"; + var expectedLocation = new Point2D(0, 0); - VariationCoefficientNormalDistribution widthFlowApertures = heightStructure.WidthFlowApertures; - Assert.AreEqual(2, widthFlowApertures.Mean.NumberOfDecimalPlaces); - Assert.AreEqual(567.89, widthFlowApertures.Mean.Value); - Assert.AreEqual(2, widthFlowApertures.CoefficientOfVariation.NumberOfDecimalPlaces); - Assert.AreEqual(0.57, widthFlowApertures.CoefficientOfVariation.Value); + // Call + var heightStructure = new TestHeightStructure(customName); - Assert.AreEqual(0.67890, heightStructure.FailureProbabilityStructureWithErosion); - - VariationCoefficientLogNormalDistribution storageStructureArea = heightStructure.StorageStructureArea; - Assert.AreEqual(2, storageStructureArea.Mean.NumberOfDecimalPlaces); - Assert.AreEqual(112.22, storageStructureArea.Mean.Value); - Assert.AreEqual(2, storageStructureArea.CoefficientOfVariation.NumberOfDecimalPlaces); - Assert.AreEqual(0.11, storageStructureArea.CoefficientOfVariation.Value); - - LogNormalDistribution allowedLevelIncreaseStorage = heightStructure.AllowedLevelIncreaseStorage; - Assert.AreEqual(2, allowedLevelIncreaseStorage.Mean.NumberOfDecimalPlaces); - Assert.AreEqual(225.34, allowedLevelIncreaseStorage.Mean.Value); - Assert.AreEqual(2, allowedLevelIncreaseStorage.StandardDeviation.NumberOfDecimalPlaces); - Assert.AreEqual(0.23, allowedLevelIncreaseStorage.StandardDeviation.Value); + // Assert + AssertTestHeightStructure(heightStructure, customName, expectedLocation); } [Test] - public void Constructor_CustomName_ExpectedValues() + public void Constructor_CustomNameAndLocation_ExpectedValues() { // Setup - var customName = "A different name for structure"; + const string customName = "A different name for structure"; + var customLocation = new Point2D(10, 20); // Call - var heightStructure = new TestHeightStructure(customName); + var heightStructure = new TestHeightStructure(customName, customLocation); // Assert - Assert.AreEqual(customName, heightStructure.Name); + AssertTestHeightStructure(heightStructure, customName, customLocation); + } + + private static void AssertTestHeightStructure(HeightStructure heightStructure, string expectedName, Point2D expectedLocation) + { + Assert.AreEqual(expectedName, heightStructure.Name); Assert.AreEqual("Id", heightStructure.Id); - var location = new Point2D(0, 0); - Assert.AreEqual(location.X, heightStructure.Location.X); - Assert.AreEqual(location.Y, heightStructure.Location.Y); + Assert.AreEqual(expectedLocation.X, heightStructure.Location.X); + Assert.AreEqual(expectedLocation.Y, heightStructure.Location.Y); Assert.IsInstanceOf(heightStructure.StructureNormalOrientation); Assert.AreEqual(2, heightStructure.StructureNormalOrientation.NumberOfDecimalPlaces);