Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresInputTest.cs =================================================================== diff -u -rba2eefab3569d05ed59629b5d02dc8420bc1163a -rfabcc9cb4752cec071fb7290280043982974dffd --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresInputTest.cs (.../ClosingStructuresInputTest.cs) (revision ba2eefab3569d05ed59629b5d02dc8420bc1163a) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresInputTest.cs (.../ClosingStructuresInputTest.cs) (revision fabcc9cb4752cec071fb7290280043982974dffd) @@ -90,39 +90,55 @@ } [Test] - [TestCase(ClosingStructureInflowModelType.VerticalWall)] - [TestCase(ClosingStructureInflowModelType.LowSill)] - [TestCase(ClosingStructureInflowModelType.FloodedCulvert)] - public void InflowModelType_SetValue_ReturnSetValue(ClosingStructureInflowModelType inflowModelType) + public void Properties_StructureNull_DoesNotChangeValues() { + var input = new ClosingStructuresInput(); + + // Call + input.Structure = null; + + // Assert + AssertClosingStructure(null, input); + } + + [Test] + public void Properties_Structure_UpdateValuesAccordingly() + { // Setup var input = new ClosingStructuresInput(); + TestClosingStructure structure = new TestClosingStructure(); // Call - input.InflowModelType = inflowModelType; + input.Structure = structure; // Assert - Assert.AreEqual(inflowModelType, input.InflowModelType); + AssertClosingStructure(structure, input); } + #region Structure + [Test] - public void Properties_FactorStormDurationOpenStructure_ExpectedValues() + [TestCase(ClosingStructureInflowModelType.VerticalWall)] + [TestCase(ClosingStructureInflowModelType.LowSill)] + [TestCase(ClosingStructureInflowModelType.FloodedCulvert)] + public void InflowModelType_SetValue_ReturnSetValue(ClosingStructureInflowModelType inflowModelType) { // Setup - var random = new Random(22); var input = new ClosingStructuresInput(); - var factorStormDuration = new RoundedDouble(5, random.NextDouble()); // Call - input.FactorStormDurationOpenStructure = factorStormDuration; + input.InflowModelType = inflowModelType; // Assert - Assert.AreEqual(2, input.FactorStormDurationOpenStructure.NumberOfDecimalPlaces); - AssertAreEqual(factorStormDuration, input.FactorStormDurationOpenStructure); + Assert.AreEqual(inflowModelType, input.InflowModelType); } + #endregion + + #region Hydraulic data + [Test] - public void Properties_ThresholdHeightOpenWeir_ExpectedValues() + public void Properties_InsideWaterLevel_ExpectedValues() { // Setup var random = new Random(22); @@ -141,13 +157,33 @@ }; // Call - input.ThresholdHeightOpenWeir = distributionToSet; + input.InsideWaterLevel = distributionToSet; // Assert - AssertDistributionCorrectlySet(input.ThresholdHeightOpenWeir, distributionToSet, expectedDistribution); + AssertDistributionCorrectlySet(input.InsideWaterLevel, distributionToSet, expectedDistribution); } [Test] + public void Properties_DeviationWaveDirection_ExpectedValues() + { + // Setup + var random = new Random(22); + var input = new ClosingStructuresInput(); + var deviationWaveDirection = new RoundedDouble(5, random.NextDouble()); + + // Call + input.DeviationWaveDirection = deviationWaveDirection; + + // Assert + Assert.AreEqual(2, input.DeviationWaveDirection.NumberOfDecimalPlaces); + AssertAreEqual(deviationWaveDirection, input.DeviationWaveDirection); + } + + #endregion + + #region Model factors + + [Test] public void Properties_DrainCoefficient_ExpectedValues() { // Setup @@ -173,6 +209,52 @@ } [Test] + public void Properties_FactorStormDurationOpenStructure_ExpectedValues() + { + // Setup + var random = new Random(22); + var input = new ClosingStructuresInput(); + var factorStormDurationOpenStructure = new RoundedDouble(5, random.NextDouble()); + + // Call + input.FactorStormDurationOpenStructure = factorStormDurationOpenStructure; + + // Assert + Assert.AreEqual(2, input.FactorStormDurationOpenStructure.NumberOfDecimalPlaces); + AssertAreEqual(factorStormDurationOpenStructure, input.FactorStormDurationOpenStructure); + } + + #endregion + + #region Schematization + + [Test] + public void Properties_ThresholdHeightOpenWeir_ExpectedValues() + { + // Setup + var random = new Random(22); + var input = new ClosingStructuresInput(); + var mean = (RoundedDouble) (0.01 + random.NextDouble()); + var standardDeviation = (RoundedDouble) (0.01 + random.NextDouble()); + var expectedDistribution = new NormalDistribution(2) + { + Mean = mean, + StandardDeviation = standardDeviation + }; + var distributionToSet = new NormalDistribution(5) + { + Mean = mean, + StandardDeviation = standardDeviation + }; + + // Call + input.ThresholdHeightOpenWeir = distributionToSet; + + // Assert + AssertDistributionCorrectlySet(input.ThresholdHeightOpenWeir, distributionToSet, expectedDistribution); + } + + [Test] public void Properties_AreaFlowApertures_ExpectedValues() { // Setup @@ -268,13 +350,13 @@ // Setup var random = new Random(22); var input = new ClosingStructuresInput(); - int identicalAperture = random.Next(); + int identicalApertures = random.Next(); // Call - input.IdenticalApertures = identicalAperture; + input.IdenticalApertures = identicalApertures; // Assert - Assert.AreEqual(identicalAperture, input.IdenticalApertures); + Assert.AreEqual(identicalApertures, input.IdenticalApertures); } [Test] @@ -304,48 +386,6 @@ } [Test] - public void Properties_InsideWaterLevel_ExpectedValues() - { - // Setup - var random = new Random(22); - var input = new ClosingStructuresInput(); - var mean = (RoundedDouble) (0.01 + random.NextDouble()); - var standardDeviation = (RoundedDouble) (0.01 + random.NextDouble()); - var expectedDistribution = new NormalDistribution(2) - { - Mean = mean, - StandardDeviation = standardDeviation - }; - var distributionToSet = new NormalDistribution(5) - { - Mean = mean, - StandardDeviation = standardDeviation - }; - - // Call - input.InsideWaterLevel = distributionToSet; - - // Assert - AssertDistributionCorrectlySet(input.InsideWaterLevel, distributionToSet, expectedDistribution); - } - - [Test] - public void Properties_DeviationWaveDirection_ExpectedValues() - { - // Setup - var random = new Random(22); - var input = new ClosingStructuresInput(); - var deviationWaveDirection = new RoundedDouble(5, random.NextDouble()); - - // Call - input.DeviationWaveDirection = deviationWaveDirection; - - // Assert - Assert.AreEqual(2, input.DeviationWaveDirection.NumberOfDecimalPlaces); - AssertAreEqual(deviationWaveDirection, input.DeviationWaveDirection); - } - - [Test] [TestCase(-1.1)] [TestCase(2)] [TestCase(double.NaN)] @@ -377,32 +417,10 @@ Assert.AreEqual(probability, input.ProbabilityOpenStructureBeforeFlooding); } - [Test] - public void Properties_StructureNull_DoesNotChangeValues() - { - var input = new ClosingStructuresInput(); + #endregion - // Call - input.Structure = null; + #region Helpers - // Assert - AssertClosingStructure(null, input); - } - - [Test] - public void Properties_Structure_UpdateValuesAccordingly() - { - // Setup - var input = new ClosingStructuresInput(); - TestClosingStructure structure = new TestClosingStructure(); - - // Call - input.Structure = structure; - - // Assert - AssertClosingStructure(structure, input); - } - private static void AssertClosingStructure(ClosingStructure expectedClosingStructure, ClosingStructuresInput input) { if (expectedClosingStructure == null) @@ -457,5 +475,7 @@ Assert.AreNotSame(setDistribution, distributionToAssert); DistributionAssert.AreEqual(expectedDistribution, distributionToAssert); } + + #endregion } } \ No newline at end of file