Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresInputTest.cs =================================================================== diff -u -r92372ba046f1df1593268f692339a53dc1b94e12 -r0f1cae61805cef8cf2f057cdae0324e4ce13c899 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresInputTest.cs (.../ClosingStructuresInputTest.cs) (revision 92372ba046f1df1593268f692339a53dc1b94e12) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresInputTest.cs (.../ClosingStructuresInputTest.cs) (revision 0f1cae61805cef8cf2f057cdae0324e4ce13c899) @@ -90,6 +90,8 @@ AssertEqualValue(6.0, input.StormDuration.Mean); AssertEqualValue(0.25, input.StormDuration.CoefficientOfVariation); Assert.AreEqual(1.0, input.ProbabilityOpenStructureBeforeFlooding); + + Assert.AreEqual(0, input.IdenticalApertures); } [Test] Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/StabilityPointStructuresInput.cs =================================================================== diff -u -r92372ba046f1df1593268f692339a53dc1b94e12 -r0f1cae61805cef8cf2f057cdae0324e4ce13c899 --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/StabilityPointStructuresInput.cs (.../StabilityPointStructuresInput.cs) (revision 92372ba046f1df1593268f692339a53dc1b94e12) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/StabilityPointStructuresInput.cs (.../StabilityPointStructuresInput.cs) (revision 0f1cae61805cef8cf2f057cdae0324e4ce13c899) @@ -47,10 +47,26 @@ private readonly LogNormalDistribution areaFlowApertures; private readonly VariationCoefficientLogNormalDistribution constructiveStrengthLinearModel; private readonly VariationCoefficientLogNormalDistribution constructiveStrengthQuadraticModel; + private readonly VariationCoefficientLogNormalDistribution stabilityLinearModel; + private readonly VariationCoefficientLogNormalDistribution stabilityQuadraticModel; + private readonly VariationCoefficientLogNormalDistribution failureCollisionEnergy; + private readonly VariationCoefficientNormalDistribution shipMass; + private readonly VariationCoefficientNormalDistribution shipVelocity; + private readonly LogNormalDistribution allowedLevelIncreaseStorage; + private readonly VariationCoefficientLogNormalDistribution storageStructureArea; + private readonly LogNormalDistribution flowWidthAtBottomProtection; + private readonly VariationCoefficientLogNormalDistribution criticalOvertoppingDischarge; + private readonly VariationCoefficientNormalDistribution widthFlowApertures; + private readonly NormalDistribution bermWidth; private ForeshoreProfile foreshoreProfile; private RoundedDouble structureNormalOrientation; private RoundedDouble volumicWeightWater; private RoundedDouble factorStormDurationOpenStructure; + private RoundedDouble evaluationLevel; + private RoundedDouble verticalDistance; + private double failureProbabilityRepairClosure; + private double probabilityCollisionSecondaryStructure; + private double failureProbabilityStructureWithErosion; /// /// Creates a new instance of . @@ -60,6 +76,11 @@ volumicWeightWater = new RoundedDouble(2, 9.81); structureNormalOrientation = new RoundedDouble(2); factorStormDurationOpenStructure = new RoundedDouble(2, double.NaN); + failureProbabilityRepairClosure = double.NaN; + probabilityCollisionSecondaryStructure = double.NaN; + failureProbabilityStructureWithErosion = double.NaN; + evaluationLevel = new RoundedDouble(2, 0); + verticalDistance = new RoundedDouble(2, double.NaN); insideWaterLevelFailureConstruction = new NormalDistribution(2) { @@ -121,6 +142,72 @@ CoefficientOfVariation = (RoundedDouble) 0.1 }; + stabilityLinearModel = new VariationCoefficientLogNormalDistribution(2) + { + Mean = (RoundedDouble) double.NaN, + CoefficientOfVariation = (RoundedDouble) 0.1 + }; + + stabilityQuadraticModel = new VariationCoefficientLogNormalDistribution(2) + { + Mean = (RoundedDouble) double.NaN, + CoefficientOfVariation = (RoundedDouble) 0.1 + }; + + failureCollisionEnergy = new VariationCoefficientLogNormalDistribution(2) + { + Mean = (RoundedDouble) double.NaN, + CoefficientOfVariation = (RoundedDouble) 0.3 + }; + + shipMass = new VariationCoefficientNormalDistribution(2) + { + Mean = (RoundedDouble) double.NaN, + CoefficientOfVariation = (RoundedDouble) 0.2 + }; + + shipVelocity = new VariationCoefficientNormalDistribution(2) + { + Mean = (RoundedDouble) double.NaN, + CoefficientOfVariation = (RoundedDouble) 0.2 + }; + + allowedLevelIncreaseStorage = new LogNormalDistribution(2) + { + Mean = (RoundedDouble) double.NaN, + StandardDeviation = (RoundedDouble) 0.1 + }; + + storageStructureArea = new VariationCoefficientLogNormalDistribution(2) + { + Mean = (RoundedDouble) double.NaN, + CoefficientOfVariation = (RoundedDouble) 0.1 + }; + + flowWidthAtBottomProtection = new LogNormalDistribution(2) + { + Mean = (RoundedDouble) double.NaN, + StandardDeviation = (RoundedDouble) 0.05 + }; + + criticalOvertoppingDischarge = new VariationCoefficientLogNormalDistribution(2) + { + Mean = (RoundedDouble) double.NaN, + CoefficientOfVariation = (RoundedDouble) 0.15 + }; + + widthFlowApertures = new VariationCoefficientNormalDistribution(2) + { + Mean = (RoundedDouble) double.NaN, + CoefficientOfVariation = (RoundedDouble) 0.05 + }; + + bermWidth = new NormalDistribution(2) + { + Mean = (RoundedDouble) double.NaN, + StandardDeviation = (RoundedDouble) double.NaN + }; + UpdateForeshoreProperties(); } @@ -133,6 +220,11 @@ #endregion + private bool ValidProbabilityValue(double probability) + { + return !double.IsNaN(probability) && probability >= 0 && probability <= 1; + } + #region Hydraulic data and loads /// @@ -442,6 +534,291 @@ } } + /// + /// Gets or sets the stability properties of the linear model. + /// [kN/m^2] + /// + public VariationCoefficientLogNormalDistribution StabilityLinearModel + { + get + { + return stabilityLinearModel; + } + set + { + stabilityLinearModel.Mean = value.Mean; + stabilityLinearModel.CoefficientOfVariation = value.CoefficientOfVariation; + } + } + + /// + /// Gets or sets the stability properties of the quadratic model. + /// [kN/m^2] + /// + public VariationCoefficientLogNormalDistribution StabilityQuadraticModel + { + get + { + return stabilityQuadraticModel; + } + set + { + stabilityQuadraticModel.Mean = value.Mean; + stabilityQuadraticModel.CoefficientOfVariation = value.CoefficientOfVariation; + } + } + + /// + /// Gets or sets the failure probability of repairing a closure. + /// [1/year] + /// + public double FailureProbabilityRepairClosure + { + get + { + return failureProbabilityRepairClosure; + } + set + { + if (!ValidProbabilityValue(value)) + { + throw new ArgumentOutOfRangeException("value", RingtoetsDataCommonProperties.FailureProbability_Value_needs_to_be_between_0_and_1); + } + failureProbabilityRepairClosure = value; + } + } + + /// + /// Gets or sets the failure collision energy. + /// [kNm] + /// + public VariationCoefficientLogNormalDistribution FailureCollisionEnergy + { + get + { + return failureCollisionEnergy; + } + set + { + failureCollisionEnergy.Mean = value.Mean; + failureCollisionEnergy.CoefficientOfVariation = value.CoefficientOfVariation; + } + } + + /// + /// Gets or sets the mass of the ship. + /// [tons] + /// + public VariationCoefficientNormalDistribution ShipMass + { + get + { + return shipMass; + } + set + { + shipMass.Mean = value.Mean; + shipMass.CoefficientOfVariation = value.CoefficientOfVariation; + } + } + + /// + /// Gets or sets the velocity of the ship. + /// [m/s] + /// + public VariationCoefficientNormalDistribution ShipVelocity + { + get + { + return shipVelocity; + } + set + { + shipVelocity.Mean = value.Mean; + shipVelocity.CoefficientOfVariation = value.CoefficientOfVariation; + } + } + + /// + /// Gets or sets the levelling count. + /// [1/year] + /// + public int LevellingCount { get; set; } + + /// + /// Gets or sets the probability of a secondary collision on the structure. + /// [1/levelling] + /// + public double ProbabilityCollisionSecondaryStructure + { + get + { + return probabilityCollisionSecondaryStructure; + } + set + { + if (!ValidProbabilityValue(value)) + { + throw new ArgumentOutOfRangeException("value", RingtoetsDataCommonProperties.Probability_Must_be_in_range_zero_to_one); + } + probabilityCollisionSecondaryStructure = value; + } + } + + /// + /// Gets or sets the allowed level increase of the storage volume. + /// [m] + /// + public LogNormalDistribution AllowedLevelIncreaseStorage + { + get + { + return allowedLevelIncreaseStorage; + } + set + { + allowedLevelIncreaseStorage.Mean = value.Mean; + allowedLevelIncreaseStorage.StandardDeviation = value.StandardDeviation; + } + } + + /// + /// Gets or sets the storage structure area. + /// [m^2] + /// + public VariationCoefficientLogNormalDistribution StorageStructureArea + { + get + { + return storageStructureArea; + } + set + { + storageStructureArea.Mean = value.Mean; + storageStructureArea.CoefficientOfVariation = value.CoefficientOfVariation; + } + } + + /// + /// Gets or sets the flow width at the bottom protection. + /// [m] + /// + public LogNormalDistribution FlowWidthAtBottomProtection + { + get + { + return flowWidthAtBottomProtection; + } + set + { + flowWidthAtBottomProtection.Mean = value.Mean; + flowWidthAtBottomProtection.StandardDeviation = value.StandardDeviation; + } + } + + /// + /// Gets or sets the critical overtopping discharge. + /// [m^3/s/m] + /// + public VariationCoefficientLogNormalDistribution CriticalOvertoppingDischarge + { + get + { + return criticalOvertoppingDischarge; + } + set + { + criticalOvertoppingDischarge.Mean = value.Mean; + criticalOvertoppingDischarge.CoefficientOfVariation = value.CoefficientOfVariation; + } + } + + /// + /// Gets or sets the failure probability of a structure with erosion. + /// [1/year] + /// + public double FailureProbabilityStructureWithErosion + { + get + { + return failureProbabilityStructureWithErosion; + } + set + { + if (!ValidProbabilityValue(value)) + { + throw new ArgumentOutOfRangeException("value", RingtoetsDataCommonProperties.FailureProbability_Value_needs_to_be_between_0_and_1); + } + failureProbabilityStructureWithErosion = value; + } + } + + /// + /// Gets or sets the width of the flow apertures. + /// [m] + /// + public VariationCoefficientNormalDistribution WidthFlowApertures + { + get + { + return widthFlowApertures; + } + set + { + widthFlowApertures.Mean = value.Mean; + widthFlowApertures.CoefficientOfVariation = value.CoefficientOfVariation; + } + } + + /// + /// Gets or sets the berm width. + /// [m] + /// + public NormalDistribution BermWidth + { + get + { + return bermWidth; + } + set + { + bermWidth.Mean = value.Mean; + bermWidth.StandardDeviation = value.StandardDeviation; + } + } + + /// + /// Gets or sets the evaluation level. + /// [m+NAP] + /// + public RoundedDouble EvaluationLevel + { + get + { + return evaluationLevel; + } + set + { + evaluationLevel = value.ToPrecision(evaluationLevel.NumberOfDecimalPlaces); + } + } + + /// + /// Gets or sets the vertical distance. + /// [m] + /// + public RoundedDouble VerticalDistance + { + get + { + return verticalDistance; + } + set + { + verticalDistance = value.ToPrecision(verticalDistance.NumberOfDecimalPlaces); + } + } + #endregion } } \ No newline at end of file Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructuresInputTest.cs =================================================================== diff -u -r92372ba046f1df1593268f692339a53dc1b94e12 -r0f1cae61805cef8cf2f057cdae0324e4ce13c899 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructuresInputTest.cs (.../StabilityPointStructuresInputTest.cs) (revision 92372ba046f1df1593268f692339a53dc1b94e12) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructuresInputTest.cs (.../StabilityPointStructuresInputTest.cs) (revision 0f1cae61805cef8cf2f057cdae0324e4ce13c899) @@ -87,8 +87,50 @@ AssertEqualValue(0.01, input.AreaFlowApertures.StandardDeviation); Assert.IsNaN(input.ConstructiveStrengthLinearLoadModel.Mean); + AssertEqualValue(0.1, input.ConstructiveStrengthLinearLoadModel.CoefficientOfVariation); Assert.IsNaN(input.ConstructiveStrengthQuadraticLoadModel.Mean); + AssertEqualValue(0.1, input.ConstructiveStrengthQuadraticLoadModel.CoefficientOfVariation); + + Assert.IsNaN(input.StabilityLinearModel.Mean); + AssertEqualValue(0.1, input.StabilityLinearModel.CoefficientOfVariation); + + Assert.IsNaN(input.StabilityQuadraticModel.Mean); + AssertEqualValue(0.1, input.StabilityQuadraticModel.CoefficientOfVariation); + + Assert.IsNaN(input.FailureProbabilityRepairClosure); + + Assert.IsNaN(input.FailureCollisionEnergy.Mean); + AssertEqualValue(0.3, input.FailureCollisionEnergy.CoefficientOfVariation); + + Assert.IsNaN(input.ShipMass.Mean); + AssertEqualValue(0.2, input.ShipMass.CoefficientOfVariation); + + Assert.IsNaN(input.ShipVelocity.Mean); + AssertEqualValue(0.2, input.ShipVelocity.CoefficientOfVariation); + + Assert.AreEqual(0, input.LevellingCount); + + Assert.AreEqual(double.NaN, input.ProbabilityCollisionSecondaryStructure); + + AssertEqualValue(double.NaN, input.AllowedLevelIncreaseStorage.Mean); + AssertEqualValue(0.1, input.AllowedLevelIncreaseStorage.StandardDeviation); + + Assert.IsNaN(input.StorageStructureArea.Mean); + AssertEqualValue(0.1, input.StorageStructureArea.CoefficientOfVariation); + AssertEqualValue(double.NaN, input.FlowWidthAtBottomProtection.Mean); + AssertEqualValue(0.05, input.FlowWidthAtBottomProtection.StandardDeviation); + AssertEqualValue(double.NaN, input.CriticalOvertoppingDischarge.Mean); + AssertEqualValue(0.15, input.CriticalOvertoppingDischarge.CoefficientOfVariation); + Assert.IsNaN(input.FailureProbabilityStructureWithErosion); + AssertEqualValue(double.NaN, input.WidthFlowApertures.Mean); + AssertEqualValue(0.05, input.WidthFlowApertures.CoefficientOfVariation); + Assert.IsNaN(input.BermWidth.Mean); + Assert.IsNaN(input.BermWidth.StandardDeviation); + Assert.AreEqual(2, input.EvaluationLevel.NumberOfDecimalPlaces); + AssertEqualValue(0, input.EvaluationLevel); + Assert.AreEqual(2, input.VerticalDistance.NumberOfDecimalPlaces); + AssertEqualValue(double.NaN, input.VerticalDistance); } #region Hydraulic loads and data @@ -431,7 +473,7 @@ } [Test] - public void Properties_ConstructiveStrengthQuadraticLoadModel_ExpectectedValues() + public void Properties_ConstructiveStrengthQuadraticLoadModel_ExpectedValues() { // Setup var input = new StabilityPointStructuresInput(); @@ -444,6 +486,318 @@ AssertEqualValue(constructiveStrengthQuadraticLoadModel.Mean, input.ConstructiveStrengthQuadraticLoadModel.Mean); AssertEqualValue(constructiveStrengthQuadraticLoadModel.CoefficientOfVariation, input.ConstructiveStrengthQuadraticLoadModel.CoefficientOfVariation); } + + [Test] + public void Properties_StabilityLinearModel_ExpectedValues() + { + // Setup + var input = new StabilityPointStructuresInput(); + VariationCoefficientLogNormalDistribution stabilityLinearModel = GenerateVariationCoefficientLogNormalDistribution(); + + // Call + input.StabilityLinearModel = stabilityLinearModel; + + // Assert + AssertEqualValue(stabilityLinearModel.Mean, input.StabilityLinearModel.Mean); + AssertEqualValue(stabilityLinearModel.CoefficientOfVariation, input.StabilityLinearModel.CoefficientOfVariation); + } + + [Test] + public void Properties_StabilityQuadraticModel() + { + // Setup + var input = new StabilityPointStructuresInput(); + VariationCoefficientLogNormalDistribution stabilityQuadraticModel = GenerateVariationCoefficientLogNormalDistribution(); + + // Call + input.StabilityQuadraticModel = stabilityQuadraticModel; + + // Assert + AssertEqualValue(stabilityQuadraticModel.Mean, input.StabilityQuadraticModel.Mean); + AssertEqualValue(stabilityQuadraticModel.CoefficientOfVariation, input.StabilityQuadraticModel.CoefficientOfVariation); + } + + [Test] + [TestCase(-1.1)] + [TestCase(2)] + [TestCase(double.NaN)] + public void Properties_FailureProbabilityRepairClosure_ThrowArgumentOutOfRangeException(double probability) + { + // Setup + var input = new StabilityPointStructuresInput(); + + // Call + TestDelegate call = () => input.FailureProbabilityRepairClosure = probability; + + // Assert + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, "De waarde voor de faalkans moet in het bereik tussen [0, 1] liggen."); + } + + [Test] + [TestCase(0)] + [TestCase(0.5)] + [TestCase(1.0)] + public void Properties_FailureProbabilityRepairClosure_ExpectedValues(double probability) + { + // Setup + var input = new StabilityPointStructuresInput(); + + // Call + input.FailureProbabilityRepairClosure = probability; + + // Assert + Assert.AreEqual(probability, input.FailureProbabilityRepairClosure); + } + + [Test] + public void Properties_FailureCollisionEnergy_ExpectedValues() + { + // Setup + var input = new StabilityPointStructuresInput(); + VariationCoefficientLogNormalDistribution failureCollisionEnergy = GenerateVariationCoefficientLogNormalDistribution(); + + // Call + input.FailureCollisionEnergy = failureCollisionEnergy; + + // Assert + AssertEqualValue(failureCollisionEnergy.Mean, input.FailureCollisionEnergy.Mean); + AssertEqualValue(failureCollisionEnergy.CoefficientOfVariation, input.FailureCollisionEnergy.CoefficientOfVariation); + } + + [Test] + public void Properties_ShipMass_ExpectedValues() + { + // Setup + var input = new StabilityPointStructuresInput(); + VariationCoefficientNormalDistribution shipMass = GenerateVariationNormalDistribution(); + + // Call + input.ShipMass = shipMass; + + // Assert + AssertEqualValue(shipMass.Mean, input.ShipMass.Mean); + AssertEqualValue(shipMass.CoefficientOfVariation, input.ShipMass.CoefficientOfVariation); + } + + [Test] + public void Properties_ShipVelocity_ExpectedValues() + { + // Setup + var input = new StabilityPointStructuresInput(); + VariationCoefficientNormalDistribution shipVelocity = GenerateVariationNormalDistribution(); + + // Call + input.ShipVelocity = shipVelocity; + + // Assert + AssertEqualValue(shipVelocity.Mean, input.ShipVelocity.Mean); + AssertEqualValue(shipVelocity.CoefficientOfVariation, input.ShipVelocity.CoefficientOfVariation); + } + + [Test] + public void Properties_IdenticalApertures_ExpectedValues() + { + // Setup + var input = new StabilityPointStructuresInput(); + var random = new Random(22); + + int levellingCount = random.Next(); + + // Call + input.LevellingCount = levellingCount; + + // Assert + Assert.AreEqual(levellingCount, input.LevellingCount); + } + + [Test] + [TestCase(-1.1)] + [TestCase(2)] + [TestCase(double.NaN)] + public void Properties_ProbabilityCollisionSecondaryStructure_ThrowArgumentOutOfRangeException(double probability) + { + // Setup + var input = new StabilityPointStructuresInput(); + + // Call + TestDelegate call = () => input.ProbabilityCollisionSecondaryStructure = probability; + + // Assert + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, "Kans moet in het bereik [0, 1] opgegeven worden."); + } + + [Test] + [TestCase(0)] + [TestCase(0.5)] + [TestCase(1.0)] + public void Properties_ProbabilityCollisionSecondaryStructure_ExpectedValues(double probability) + { + // Setup + var input = new StabilityPointStructuresInput(); + + // Call + input.ProbabilityCollisionSecondaryStructure = probability; + + // Assert + Assert.AreEqual(probability, input.ProbabilityCollisionSecondaryStructure); + } + + [Test] + public void Properties_AllowedLevelIncreaseStorage_ExpectedValues() + { + // Setup + var input = new StabilityPointStructuresInput(); + LogNormalDistribution allowedLevelIncreaseStorage = GenerateLogNormalDistribution(); + + // Call + input.AllowedLevelIncreaseStorage = allowedLevelIncreaseStorage; + + // Assert + AssertEqualValue(allowedLevelIncreaseStorage.Mean, input.AllowedLevelIncreaseStorage.Mean); + AssertEqualValue(allowedLevelIncreaseStorage.StandardDeviation, input.AllowedLevelIncreaseStorage.StandardDeviation); + } + + [Test] + public void Properties_StorageStructureArea_ExpectedValues() + { + // Setup + var input = new StabilityPointStructuresInput(); + VariationCoefficientLogNormalDistribution storageStructureArea = GenerateVariationCoefficientLogNormalDistribution(); + + // Call + input.StorageStructureArea = storageStructureArea; + + // Assert + AssertEqualValue(storageStructureArea.Mean, input.StorageStructureArea.Mean); + AssertEqualValue(storageStructureArea.CoefficientOfVariation, input.StorageStructureArea.CoefficientOfVariation); + } + + [Test] + public void Properties_FlowWidthAtBottomProtection_ExpectedValues() + { + // Setup + var input = new StabilityPointStructuresInput(); + LogNormalDistribution flowWidthAtBottomProtection = GenerateLogNormalDistribution(); + + // Call + input.FlowWidthAtBottomProtection = flowWidthAtBottomProtection; + + // Assert + AssertEqualValue(flowWidthAtBottomProtection.Mean, input.FlowWidthAtBottomProtection.Mean); + AssertEqualValue(flowWidthAtBottomProtection.StandardDeviation, input.FlowWidthAtBottomProtection.StandardDeviation); + } + + [Test] + public void Properties_CriticalOvertoppingDischarge_ExpectedValues() + { + // Setup + var input = new StabilityPointStructuresInput(); + VariationCoefficientLogNormalDistribution criticalOvertoppingDischarge = GenerateVariationCoefficientLogNormalDistribution(); + + // Call + input.CriticalOvertoppingDischarge = criticalOvertoppingDischarge; + + // Assert + AssertEqualValue(criticalOvertoppingDischarge.Mean, input.CriticalOvertoppingDischarge.Mean); + AssertEqualValue(criticalOvertoppingDischarge.CoefficientOfVariation, input.CriticalOvertoppingDischarge.CoefficientOfVariation); + } + + [Test] + [TestCase(-1.1)] + [TestCase(2)] + [TestCase(double.NaN)] + public void Properties_FailureProbabilityStructureWithErosion_ThrowArgumentOutOfRangeException(double probability) + { + // Setup + var input = new StabilityPointStructuresInput(); + + // Call + TestDelegate call = () => input.FailureProbabilityStructureWithErosion = probability; + + // Assert + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, "De waarde voor de faalkans moet in het bereik tussen [0, 1] liggen."); + } + + [Test] + [TestCase(0)] + [TestCase(0.5)] + [TestCase(1.0)] + public void Properties_FailureProbabilityStructureWithErosion_ExpectedValues(double probability) + { + // Setup + var input = new StabilityPointStructuresInput(); + + // Call + input.FailureProbabilityStructureWithErosion = probability; + + // Assert + Assert.AreEqual(probability, input.FailureProbabilityStructureWithErosion); + } + + [Test] + public void Properties_WidthFlowApertures_ExpectedValues() + { + //Setup + var input = new StabilityPointStructuresInput(); + VariationCoefficientNormalDistribution widthFlowApertures = GenerateVariationNormalDistribution(); + + // Call + input.WidthFlowApertures = widthFlowApertures; + + // Assert + AssertEqualValue(widthFlowApertures.Mean, input.WidthFlowApertures.Mean); + AssertEqualValue(widthFlowApertures.CoefficientOfVariation, input.WidthFlowApertures.CoefficientOfVariation); + } + + [Test] + public void Properties_BermWidth_ExpectedValues() + { + // Setup + var input = new StabilityPointStructuresInput(); + NormalDistribution bermWidth = GenerateNormalDistribution(); + + // Call + input.BermWidth = bermWidth; + + // Assert + AssertEqualValue(bermWidth.Mean, input.BermWidth.Mean); + AssertEqualValue(bermWidth.StandardDeviation, input.BermWidth.StandardDeviation); + } + + [Test] + public void Properties_EvaluationLevel_ExpectedValues() + { + // Setup + var input = new StabilityPointStructuresInput(); + + var random = new Random(22); + var evaluationLevel = new RoundedDouble(5, random.NextDouble()); + + // Call + input.EvaluationLevel = evaluationLevel; + + // Assert + Assert.AreEqual(2, input.EvaluationLevel.NumberOfDecimalPlaces); + AssertEqualValue(evaluationLevel, input.EvaluationLevel); + } + + [Test] + public void Properties_VerticalDistance_ExpectedValues() + { + // Setup + var input = new StabilityPointStructuresInput(); + + var random = new Random(22); + var verticalDistance = new RoundedDouble(5, random.NextDouble()); + + // Call + input.VerticalDistance = verticalDistance; + + // Assert + Assert.AreEqual(2, input.VerticalDistance.NumberOfDecimalPlaces); + AssertEqualValue(verticalDistance, input.VerticalDistance); + } + #endregion #region Helpers @@ -468,8 +822,8 @@ var random = new Random(22); return new VariationCoefficientLogNormalDistribution(2) { - Mean = (RoundedDouble)(0.01 + random.NextDouble()), - CoefficientOfVariation = (RoundedDouble)random.NextDouble() + Mean = (RoundedDouble) (0.01 + random.NextDouble()), + CoefficientOfVariation = (RoundedDouble) random.NextDouble() }; } @@ -483,6 +837,16 @@ }; } + private static VariationCoefficientNormalDistribution GenerateVariationNormalDistribution() + { + var random = new Random(22); + return new VariationCoefficientNormalDistribution(2) + { + Mean = (RoundedDouble) (0.01 + random.NextDouble()), + CoefficientOfVariation = (RoundedDouble) random.NextDouble() + }; + } + #endregion } } \ No newline at end of file