Index: Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsCalculationScenarioExtensionsTest.cs =================================================================== diff -u -r9a1be3bcbb49a77ba41fdf7681e0d3472ef5921b -r1fe918dcdfcdd85b43edda919f033b594f5b4ce9 --- Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsCalculationScenarioExtensionsTest.cs (.../GrassCoverErosionInwardsCalculationScenarioExtensionsTest.cs) (revision 9a1be3bcbb49a77ba41fdf7681e0d3472ef5921b) +++ Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsCalculationScenarioExtensionsTest.cs (.../GrassCoverErosionInwardsCalculationScenarioExtensionsTest.cs) (revision 1fe918dcdfcdd85b43edda919f033b594f5b4ce9) @@ -83,7 +83,7 @@ new Point2D(10.0, 0.0) }); - var calculation = new GrassCoverErosionInwardsCalculationScenario() + var calculation = new GrassCoverErosionInwardsCalculationScenario { InputParameters = { @@ -110,7 +110,7 @@ new Point2D(10.0, 0.0) }); - var calculation = new GrassCoverErosionInwardsCalculationScenario() + var calculation = new GrassCoverErosionInwardsCalculationScenario { InputParameters = { @@ -139,7 +139,7 @@ new Point2D(20.0, 0.0) }); - var calculation = new GrassCoverErosionInwardsCalculationScenario() + var calculation = new GrassCoverErosionInwardsCalculationScenario { InputParameters = { Index: Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsCalculationScenarioTest.cs =================================================================== diff -u -r5c393bc8750c1cea8cc6e28e024f331aeea2ae52 -r1fe918dcdfcdd85b43edda919f033b594f5b4ce9 --- Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsCalculationScenarioTest.cs (.../GrassCoverErosionInwardsCalculationScenarioTest.cs) (revision 5c393bc8750c1cea8cc6e28e024f331aeea2ae52) +++ Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsCalculationScenarioTest.cs (.../GrassCoverErosionInwardsCalculationScenarioTest.cs) (revision 1fe918dcdfcdd85b43edda919f033b594f5b4ce9) @@ -37,7 +37,7 @@ public void Constructor_ExpectedValues() { // Call - var scenario = new GrassCoverErosionInwardsCalculationScenario(0.1); + var scenario = new GrassCoverErosionInwardsCalculationScenario(); // Assert Assert.IsInstanceOf(scenario); @@ -53,7 +53,7 @@ public void Contribution_SetInvalidValue_ThrowArgumentException(double newValue) { // Setup - var calculationScenario = new GrassCoverErosionInwardsCalculationScenario(0.1); + var calculationScenario = new GrassCoverErosionInwardsCalculationScenario(); // Call void Call() => calculationScenario.Contribution = (RoundedDouble) newValue; @@ -68,7 +68,7 @@ public void Contribution_SetValidValue_ValueSet(double newValue) { // Setup - var calculationScenario = new GrassCoverErosionInwardsCalculationScenario(0.1); + var calculationScenario = new GrassCoverErosionInwardsCalculationScenario(); // Call calculationScenario.Contribution = (RoundedDouble) newValue; @@ -109,7 +109,7 @@ { var random = new Random(21); - var calculation = new GrassCoverErosionInwardsCalculationScenario(0.1) + var calculation = new GrassCoverErosionInwardsCalculationScenario { Name = "A Name", Comments = Index: Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsCalculationTest.cs =================================================================== diff -u -rebfd500b10e6634a584b5dd904d445078769ae90 -r1fe918dcdfcdd85b43edda919f033b594f5b4ce9 --- Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsCalculationTest.cs (.../GrassCoverErosionInwardsCalculationTest.cs) (revision ebfd500b10e6634a584b5dd904d445078769ae90) +++ Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsCalculationTest.cs (.../GrassCoverErosionInwardsCalculationTest.cs) (revision 1fe918dcdfcdd85b43edda919f033b594f5b4ce9) @@ -19,11 +19,9 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using System; using System.Collections.Generic; using Core.Common.Base; using Core.Common.Data.TestUtil; -using Core.Common.TestUtil; using NUnit.Framework; using Riskeer.Common.Data.Calculation; using Riskeer.Common.Data.TestUtil.IllustrationPoints; @@ -37,11 +35,8 @@ [Test] public void Constructor_ExpectedValues() { - // Setup - double norm = new Random(21).NextDouble(1e-15, 0.1); - // Call - var calculation = new GrassCoverErosionInwardsCalculation(norm); + var calculation = new GrassCoverErosionInwardsCalculation(); // Assert Assert.IsInstanceOf>(calculation); @@ -52,8 +47,6 @@ Assert.IsNull(calculation.Comments.Body); Assert.IsNull(calculation.Output); Assert.IsNull(calculation.InputParameters.DikeProfile); - Assert.AreEqual(norm, calculation.InputParameters.DikeHeightTargetProbability); - Assert.AreEqual(norm, calculation.InputParameters.OvertoppingRateTargetProbability); } [Test] @@ -63,7 +56,7 @@ public void Properties_Name_ReturnsExpectedValues(string name) { // Setup - var calculation = new GrassCoverErosionInwardsCalculation(0.1); + var calculation = new GrassCoverErosionInwardsCalculation(); // Call calculation.Name = name; @@ -79,7 +72,7 @@ public void Property_Comments_ReturnsExpectedValues(string comments) { // Setup - var calculation = new GrassCoverErosionInwardsCalculation(0.1); + var calculation = new GrassCoverErosionInwardsCalculation(); // Call calculation.Comments.Body = comments; @@ -92,7 +85,7 @@ public void ClearOutput_Always_SetsOutputToNull() { // Setup - var calculation = new GrassCoverErosionInwardsCalculation(0.1) + var calculation = new GrassCoverErosionInwardsCalculation { Output = new TestGrassCoverErosionInwardsOutput() }; @@ -108,7 +101,7 @@ public void HasOutput_OutputNull_ReturnsFalse() { // Setup - var calculation = new GrassCoverErosionInwardsCalculation(0.1) + var calculation = new GrassCoverErosionInwardsCalculation { Output = null }; @@ -124,7 +117,7 @@ public void HasOutput_OutputSet_ReturnsTrue() { // Setup - var calculation = new GrassCoverErosionInwardsCalculation(0.1) + var calculation = new GrassCoverErosionInwardsCalculation { Output = new TestGrassCoverErosionInwardsOutput() }; @@ -184,7 +177,7 @@ new TestDikeHeightOutput(new TestGeneralResultFaultTreeIllustrationPoint()), new TestOvertoppingRateOutput(new TestGeneralResultFaultTreeIllustrationPoint())); - var calculation = new GrassCoverErosionInwardsCalculation(0.1) + var calculation = new GrassCoverErosionInwardsCalculation { Output = originalOutput }; @@ -203,7 +196,7 @@ public void ClearIllustrationPoints_CalculationWithoutOutput_DoesNotThrow() { // Setup - var calculation = new GrassCoverErosionInwardsCalculation(0.1); + var calculation = new GrassCoverErosionInwardsCalculation(); // Call void Call() => calculation.ClearIllustrationPoints(); @@ -214,7 +207,7 @@ private static GrassCoverErosionInwardsCalculation CreateRandomCalculationWithoutOutput() { - var calculation = new GrassCoverErosionInwardsCalculation(0.1) + var calculation = new GrassCoverErosionInwardsCalculation { Comments = { @@ -242,7 +235,7 @@ var overtoppingRateOutputWithoutGeneralResult = new TestOvertoppingRateOutput(1.0); var overtoppingRateOutputWithGeneralResult = new TestOvertoppingRateOutput(new TestGeneralResultFaultTreeIllustrationPoint()); - yield return new TestCaseData(new GrassCoverErosionInwardsCalculation(0.1) + yield return new TestCaseData(new GrassCoverErosionInwardsCalculation { InputParameters = { @@ -258,7 +251,7 @@ }, false) .SetName("OutputSufficientScenario1"); - yield return new TestCaseData(new GrassCoverErosionInwardsCalculation(0.1) + yield return new TestCaseData(new GrassCoverErosionInwardsCalculation { InputParameters = { @@ -271,18 +264,18 @@ }, false) .SetName("OutputSufficientScenario2"); - yield return new TestCaseData(new GrassCoverErosionInwardsCalculation(0.1) + yield return new TestCaseData(new GrassCoverErosionInwardsCalculation { Output = new GrassCoverErosionInwardsOutput(overtoppingOutputWithoutGeneralResult, null, null) }, false) .SetName("OutputSufficientScenario3"); - yield return new TestCaseData(new GrassCoverErosionInwardsCalculation(0.1), true) + yield return new TestCaseData(new GrassCoverErosionInwardsCalculation(), true) .SetName("NoOutputScenario1"); - yield return new TestCaseData(new GrassCoverErosionInwardsCalculation(0.1) + yield return new TestCaseData(new GrassCoverErosionInwardsCalculation { InputParameters = { @@ -292,7 +285,7 @@ }, true) .SetName("NoOutputScenario2"); - yield return new TestCaseData(new GrassCoverErosionInwardsCalculation(0.1) + yield return new TestCaseData(new GrassCoverErosionInwardsCalculation { InputParameters = { @@ -305,15 +298,15 @@ }, true) .SetName("NoOutputScenario3"); - yield return new TestCaseData(new GrassCoverErosionInwardsCalculation(0.1) + yield return new TestCaseData(new GrassCoverErosionInwardsCalculation { Output = new GrassCoverErosionInwardsOutput(overtoppingOutputWithGeneralResult, null, null) }, true) .SetName("OvertoppingOutputWithRedundantGeneralResult"); - yield return new TestCaseData(new GrassCoverErosionInwardsCalculation(0.1) + yield return new TestCaseData(new GrassCoverErosionInwardsCalculation { InputParameters = { @@ -325,7 +318,7 @@ }, true) .SetName("OvertoppingOutputWithMissingGeneralResult"); - yield return new TestCaseData(new GrassCoverErosionInwardsCalculation(0.1) + yield return new TestCaseData(new GrassCoverErosionInwardsCalculation { InputParameters = { @@ -337,7 +330,7 @@ }, true) .SetName("DikeHeightOutputWithRedundantGeneralResult"); - yield return new TestCaseData(new GrassCoverErosionInwardsCalculation(0.1) + yield return new TestCaseData(new GrassCoverErosionInwardsCalculation { InputParameters = { @@ -350,7 +343,7 @@ }, true) .SetName("DikeHeightOutputWithMissingGeneralResult"); - yield return new TestCaseData(new GrassCoverErosionInwardsCalculation(0.1) + yield return new TestCaseData(new GrassCoverErosionInwardsCalculation { InputParameters = { @@ -362,7 +355,7 @@ }, true) .SetName("OvertoppingRateOutputWithRedundantGeneralResult"); - yield return new TestCaseData(new GrassCoverErosionInwardsCalculation(0.1) + yield return new TestCaseData(new GrassCoverErosionInwardsCalculation { InputParameters = { Index: Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsFailureMechanismTest.cs =================================================================== diff -u -r5c393bc8750c1cea8cc6e28e024f331aeea2ae52 -r1fe918dcdfcdd85b43edda919f033b594f5b4ce9 --- Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsFailureMechanismTest.cs (.../GrassCoverErosionInwardsFailureMechanismTest.cs) (revision 5c393bc8750c1cea8cc6e28e024f331aeea2ae52) +++ Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsFailureMechanismTest.cs (.../GrassCoverErosionInwardsFailureMechanismTest.cs) (revision 1fe918dcdfcdd85b43edda919f033b594f5b4ce9) @@ -117,9 +117,9 @@ Children = { new CalculationGroup(), - new GrassCoverErosionInwardsCalculation(0.1), + new GrassCoverErosionInwardsCalculation(), mocks.StrictMock(), - new GrassCoverErosionInwardsCalculation(0.1) + new GrassCoverErosionInwardsCalculation() } } }; Index: Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsInputTest.cs =================================================================== diff -u -r3dc13f8cf8663c06895bb8418e1dd92f28cfac88 -r1fe918dcdfcdd85b43edda919f033b594f5b4ce9 --- Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsInputTest.cs (.../GrassCoverErosionInwardsInputTest.cs) (revision 3dc13f8cf8663c06895bb8418e1dd92f28cfac88) +++ Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsInputTest.cs (.../GrassCoverErosionInwardsInputTest.cs) (revision 1fe918dcdfcdd85b43edda919f033b594f5b4ce9) @@ -132,10 +132,8 @@ StandardDeviation = (RoundedDouble) 0.0006 }; - double norm = new Random(21).NextDouble(1e-15, 0.1); - // Call - var input = new GrassCoverErosionInwardsInput(norm); + var input = new GrassCoverErosionInwardsInput(); // Assert Assert.IsInstanceOf(input); @@ -152,8 +150,8 @@ Assert.IsFalse(input.ShouldDikeHeightBeCalculated); Assert.IsFalse(input.ShouldOvertoppingRateBeCalculated); - Assert.AreEqual(norm, input.DikeHeightTargetProbability); - Assert.AreEqual(norm, input.OvertoppingRateTargetProbability); + Assert.IsNaN(input.DikeHeightTargetProbability); + Assert.IsNaN(input.OvertoppingRateTargetProbability); Assert.AreEqual(DikeHeightCalculationType.NoCalculation, input.DikeHeightCalculationType); Assert.AreEqual(OvertoppingRateCalculationType.NoCalculation, input.OvertoppingRateCalculationType); @@ -162,27 +160,12 @@ } [Test] - [TestCase(double.NaN)] - [TestCase(0.0)] - [TestCase(0.11)] - public void Constructor_InvalidNorm_ThrowsArgumentOutOfRangeException(double invalidNorm) - { - // Call - void Call() => new GrassCoverErosionInwardsInput(invalidNorm); - - // Assert - const string expectedMessage = "De waarde van de doelkans moet groter zijn dan 0.0 en kleiner dan of gelijk aan 0.1."; - var exception = Assert.Throws(Call); - StringAssert.StartsWith(expectedMessage, exception.Message); - } - - [Test] public void DikeProfile_SetNullValue_InputSyncedToDefaults() { // Setup DikeProfile dikeProfile = CreateTestDikeProfile(); - var input = new GrassCoverErosionInwardsInput(0.1) + var input = new GrassCoverErosionInwardsInput { DikeProfile = dikeProfile }; @@ -199,7 +182,7 @@ public void DikeProfile_SetNewValue_InputSyncedAccordingly(DikeProfile newDikeProfile) { // Setup - var input = new GrassCoverErosionInwardsInput(0.1); + var input = new GrassCoverErosionInwardsInput(); // Call input.DikeProfile = newDikeProfile; @@ -217,7 +200,7 @@ public void Orientation_SetNewValue_ValueIsRounded(double validOrientation) { // Setup - var input = new GrassCoverErosionInwardsInput(0.1); + var input = new GrassCoverErosionInwardsInput(); int originalNumberOfDecimalPlaces = input.Orientation.NumberOfDecimalPlaces; @@ -240,7 +223,7 @@ public void Orientation_SetInvalidValue_ThrowsArgumentOutOfRangeException(double invalidOrientation) { // Setup - var input = new GrassCoverErosionInwardsInput(0.1); + var input = new GrassCoverErosionInwardsInput(); // Call void Call() => input.Orientation = (RoundedDouble) invalidOrientation; @@ -254,7 +237,7 @@ public void DikeHeight_SetNewValue_ValueIsRounded() { // Setup - var input = new GrassCoverErosionInwardsInput(0.1); + var input = new GrassCoverErosionInwardsInput(); int originalNumberOfDecimalPlaces = input.DikeHeight.NumberOfDecimalPlaces; @@ -271,7 +254,7 @@ { // Setup var random = new Random(22); - var input = new GrassCoverErosionInwardsInput(0.1); + var input = new GrassCoverErosionInwardsInput(); RoundedDouble mean = random.NextRoundedDouble(0.01, double.MaxValue); RoundedDouble standardDeviation = random.NextRoundedDouble(0.01, double.MaxValue); var expectedDistribution = new LogNormalDistribution(4) @@ -301,8 +284,7 @@ public void DikeHeightTargetProbability_InvalidValue_ThrowsArgumentOutOfRangeException(double invalidValue) { // Setup - const double originalValue = 0.1; - var input = new GrassCoverErosionInwardsInput(originalValue); + var input = new GrassCoverErosionInwardsInput(); // Call void Call() => input.DikeHeightTargetProbability = invalidValue; @@ -311,7 +293,6 @@ const string expectedMessage = "De waarde van de doelkans moet groter zijn dan 0.0 en kleiner dan of gelijk aan 0.1."; var exception = Assert.Throws(Call); StringAssert.StartsWith(expectedMessage, exception.Message); - Assert.AreEqual(originalValue, input.DikeHeightTargetProbability); } [Test] @@ -321,7 +302,7 @@ public void DikeHeightTargetProbability_ValidValue_NewValueSet(double newValue) { // Setup - var input = new GrassCoverErosionInwardsInput(0.1); + var input = new GrassCoverErosionInwardsInput(); // Call input.DikeHeightTargetProbability = newValue; @@ -337,8 +318,7 @@ public void OvertoppingRateTargetProbability_InvalidValue_ThrowsArgumentOutOfRangeException(double invalidValue) { // Setup - const double originalValue = 0.1; - var input = new GrassCoverErosionInwardsInput(originalValue); + var input = new GrassCoverErosionInwardsInput(); // Call void Call() => input.OvertoppingRateTargetProbability = invalidValue; @@ -347,7 +327,6 @@ const string expectedMessage = "De waarde van de doelkans moet groter zijn dan 0.0 en kleiner dan of gelijk aan 0.1."; var exception = Assert.Throws(Call); StringAssert.StartsWith(expectedMessage, exception.Message); - Assert.AreEqual(originalValue, input.OvertoppingRateTargetProbability); } [Test] @@ -357,7 +336,7 @@ public void OvertoppingRateTargetProbability_ValidValue_NewValueSet(double newValue) { // Setup - var input = new GrassCoverErosionInwardsInput(0.1); + var input = new GrassCoverErosionInwardsInput(); // Call input.OvertoppingRateTargetProbability = newValue; @@ -370,7 +349,7 @@ public void IsDikeProfileInputSynchronized_DikeProfileNotSet_ReturnFalse() { // Setup - var input = new GrassCoverErosionInwardsInput(0.1); + var input = new GrassCoverErosionInwardsInput(); // Call bool synchronized = input.IsDikeProfileInputSynchronized; @@ -383,7 +362,7 @@ public void IsDikeProfileInputSynchronized_InputParametersAndDikeProfileInSync_ReturnTrue() { // Setup - var input = new GrassCoverErosionInwardsInput(0.1) + var input = new GrassCoverErosionInwardsInput { DikeProfile = DikeProfileTestFactory.CreateDikeProfile(new[] { @@ -406,7 +385,7 @@ // Setup DikeProfile dikeProfile = CreateTestDikeProfile(); - var input = new GrassCoverErosionInwardsInput(0.1) + var input = new GrassCoverErosionInwardsInput { DikeProfile = dikeProfile }; @@ -424,7 +403,7 @@ public void SynchronizeDikeProfileInput_DikeProfileNotSet_ExpectedValues() { // Setup - var input = new GrassCoverErosionInwardsInput(0.1); + var input = new GrassCoverErosionInwardsInput(); // Call input.SynchronizeDikeProfileInput(); @@ -440,7 +419,7 @@ // Setup DikeProfile dikeProfile = CreateTestDikeProfile(); - var input = new GrassCoverErosionInwardsInput(0.1) + var input = new GrassCoverErosionInwardsInput { DikeProfile = dikeProfile }; @@ -458,7 +437,7 @@ public void Clone_AllPropertiesSet_ReturnNewInstanceWithCopiedValues() { // Setup - var original = new GrassCoverErosionInwardsInput(0.1); + var original = new GrassCoverErosionInwardsInput(); GrassCoverErosionInwardsTestDataGenerator.SetRandomDataToGrassCoverErosionInwardsInput(original); @@ -473,7 +452,7 @@ public void Clone_NotAllPropertiesSet_ReturnNewInstanceWithCopiedValues() { // Setup - var original = new GrassCoverErosionInwardsInput(0.1); + var original = new GrassCoverErosionInwardsInput(); GrassCoverErosionInwardsTestDataGenerator.SetRandomDataToGrassCoverErosionInwardsInput(original);