Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Integration.Test/GrassCoverErosionOutwardsWaveConditionsCalculationActivityIntegrationTest.cs =================================================================== diff -u -r3a525b70c20312822d099cd69e89cb7f8bfd22ce -r17b937348105b25b7a75dd4bb62b95a0b75d8b04 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Integration.Test/GrassCoverErosionOutwardsWaveConditionsCalculationActivityIntegrationTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationActivityIntegrationTest.cs) (revision 3a525b70c20312822d099cd69e89cb7f8bfd22ce) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Integration.Test/GrassCoverErosionOutwardsWaveConditionsCalculationActivityIntegrationTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationActivityIntegrationTest.cs) (revision 17b937348105b25b7a75dd4bb62b95a0b75d8b04) @@ -708,22 +708,10 @@ private static GrassCoverErosionOutwardsWaveConditionsCalculation GetDefaultValidationInput(AssessmentSection assessmentSection) { - var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation - { - InputParameters = - { - HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001), - ForeshoreProfile = CreateForeshoreProfile(), - UseForeshore = true, - UseBreakWater = true, - StepSize = WaveConditionsInputStepSize.Half, - LowerBoundaryRevetment = (RoundedDouble) 4, - UpperBoundaryRevetment = (RoundedDouble) 10, - UpperBoundaryWaterLevels = (RoundedDouble) 5.4, - LowerBoundaryWaterLevels = (RoundedDouble) 5 - } - }; - calculation.InputParameters.HydraulicBoundaryLocation.DesignWaterLevel = (RoundedDouble) 9.3; + GrassCoverErosionOutwardsWaveConditionsCalculation calculation = GetValidCalculation(assessmentSection); + calculation.InputParameters.LowerBoundaryWaterLevels = (RoundedDouble) 5; + calculation.InputParameters.UpperBoundaryWaterLevels = (RoundedDouble) 5.4; + return calculation; } Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Integration.Test/StabilityStoneCoverWaveConditionsCalculationActivityIntegrationTest.cs =================================================================== diff -u -r3feb3855f71e0254ed24d385dedddc8fe3b13777 -r17b937348105b25b7a75dd4bb62b95a0b75d8b04 --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Integration.Test/StabilityStoneCoverWaveConditionsCalculationActivityIntegrationTest.cs (.../StabilityStoneCoverWaveConditionsCalculationActivityIntegrationTest.cs) (revision 3feb3855f71e0254ed24d385dedddc8fe3b13777) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Integration.Test/StabilityStoneCoverWaveConditionsCalculationActivityIntegrationTest.cs (.../StabilityStoneCoverWaveConditionsCalculationActivityIntegrationTest.cs) (revision 17b937348105b25b7a75dd4bb62b95a0b75d8b04) @@ -285,7 +285,7 @@ [TestCase(double.NegativeInfinity)] [TestCase(double.PositiveInfinity)] [TestCase(double.NaN)] - public void OnRun_CalculationWithForeshoreAndDoesNotUseBreakWaterAndHasInvalidBreakWaterHeight_PerformCalculationAndLogStartEnd(double breakWaterHeight) + public void OnRun_CalculationWithForeshoreAndDoesNotUseBreakWaterAndHasInvalidBreakWaterHeight_PerformCalculationAndLogStartAndErrorAndEnd(double breakWaterHeight) { // Setup var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); @@ -378,7 +378,7 @@ [TestCase(CalculationType.NoForeshore)] [TestCase(CalculationType.ForeShoreWithoutBreakWater)] [TestCase(CalculationType.ForeshoreWithValidBreakWater)] - public void OnRun_CalculationWithValidInputConditionsValidateForeshoreProfileCannotPerformCalculation_LogCalculationStartAndErrorAndEnd(CalculationType calculationType) + public void OnRun_CalculationWithValidInputConditionsValidateForeshoreProfile_PerformCalculationLogCalculationStartAndErrorAndEnd(CalculationType calculationType) { // Setup var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); @@ -767,22 +767,10 @@ private static StabilityStoneCoverWaveConditionsCalculation GetDefaultValidationInput(AssessmentSection assessmentSection) { - var calculation = new StabilityStoneCoverWaveConditionsCalculation() - { - InputParameters = - { - HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001), - ForeshoreProfile = CreateForeshoreProfile(), - UseForeshore = true, - UseBreakWater = true, - StepSize = WaveConditionsInputStepSize.Half, - LowerBoundaryRevetment = (RoundedDouble) 4, - UpperBoundaryRevetment = (RoundedDouble) 10.0, - UpperBoundaryWaterLevels = (RoundedDouble) 5.4, - LowerBoundaryWaterLevels = (RoundedDouble) 5 - } - }; - calculation.InputParameters.HydraulicBoundaryLocation.DesignWaterLevel = (RoundedDouble) 12.0; + StabilityStoneCoverWaveConditionsCalculation calculation = GetValidCalculation(assessmentSection); + calculation.InputParameters.LowerBoundaryWaterLevels = (RoundedDouble) 5; + calculation.InputParameters.UpperBoundaryWaterLevels = (RoundedDouble) 5.4; + return calculation; } Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Integration.Test/WaveImpactAsphaltCoverWaveConditionsCalculationActivityIntegrationTest.cs =================================================================== diff -u -r4c15716555ea6ca122c2c9149d3703f956e3f529 -r17b937348105b25b7a75dd4bb62b95a0b75d8b04 --- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Integration.Test/WaveImpactAsphaltCoverWaveConditionsCalculationActivityIntegrationTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationActivityIntegrationTest.cs) (revision 4c15716555ea6ca122c2c9149d3703f956e3f529) +++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Integration.Test/WaveImpactAsphaltCoverWaveConditionsCalculationActivityIntegrationTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationActivityIntegrationTest.cs) (revision 17b937348105b25b7a75dd4bb62b95a0b75d8b04) @@ -282,6 +282,7 @@ } [Test] + [TestCase(double.NegativeInfinity)] [TestCase(double.PositiveInfinity)] [TestCase(double.NaN)] public void OnRun_CalculationWithForeshoreAndDoesNotUseBreakWaterAndHasInvalidBreakWaterHeight_PerformCalculationAndLogStartEnd(double breakWaterHeight) @@ -344,6 +345,7 @@ } [Test] + [TestCase((double.NegativeInfinity))] [TestCase(double.PositiveInfinity)] [TestCase(double.NaN)] public void OnRun_CalculationWithForeshoreAndUsesBreakWaterAndHasInvalidBreakWaterHeight_DoesNotPerformCalculationAndLogStartEnd(double breakWaterHeight) @@ -394,89 +396,32 @@ } [Test] - public void OnRun_CalculationWithValidInputConditionsAndWithoutForeshoreProfileCannotPerformCalculation_LogCalculationStartAndErrorAndEnd() + [TestCase(CalculationType.NoForeshore)] + [TestCase(CalculationType.ForeShoreWithoutBreakWater)] + [TestCase(CalculationType.ForeshoreWithValidBreakWater)] + public void OnRun_CalculationWithValidInputConditionsValidateForeshoreProfile_PerformCalculationLogCalculationStartAndErrorAndEnd(CalculationType calculationType) { // Setup var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); ImportHydraulicBoundaryDatabase(assessmentSection); - var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation() - { - InputParameters = - { - HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001), - ForeshoreProfile = null, - UseForeshore = false, - UseBreakWater = false, - StepSize = WaveConditionsInputStepSize.Half, - LowerBoundaryRevetment = (RoundedDouble) 4, - UpperBoundaryRevetment = (RoundedDouble) 10.0, - UpperBoundaryWaterLevels = (RoundedDouble) 5.4, - LowerBoundaryWaterLevels = (RoundedDouble) 5 - } - }; - calculation.InputParameters.HydraulicBoundaryLocation.DesignWaterLevel = (RoundedDouble) 12.0; + WaveImpactAsphaltCoverWaveConditionsCalculation calculation = GetDefaultValidationInput(assessmentSection); - var activity = new WaveImpactAsphaltCoverWaveConditionsCalculationActivity(calculation, - testDataPath, - assessmentSection.WaveImpactAsphaltCover, - assessmentSection); - - using (new HydraRingCalculationServiceConfig()) + switch (calculationType) { - // Call - Action call = () => activity.Run(); - - // Assert - TestHelper.AssertLogMessages(call, messages => - { - var msgs = messages.ToArray(); - Assert.AreEqual(10, msgs.Length); - - StringAssert.StartsWith(string.Format("Validatie van '{0}' gestart om: ", calculation.Name), msgs[0]); - StringAssert.StartsWith(string.Format("Validatie van '{0}' beëindigd om: ", calculation.Name), msgs[1]); - StringAssert.StartsWith(string.Format("Berekening van '{0}' gestart om: ", calculation.Name), msgs[2]); - - int i = 2; - foreach (var waterLevel in calculation.InputParameters.WaterLevels) - { - StringAssert.StartsWith(string.Format("Berekening '{0}' voor waterstand '{1}' gestart om: ", calculation.Name, waterLevel), msgs[i + 1]); - Assert.AreEqual(string.Format("Berekening '{0}' voor waterstand '{1}' is niet gelukt.", calculation.Name, waterLevel), msgs[i + 2]); - StringAssert.StartsWith(string.Format("Berekening '{0}' voor waterstand '{1}' beëindigd om: ", calculation.Name, waterLevel), msgs[i + 3]); - - i = i + 3; - } - - StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[9]); - }); - Assert.AreEqual(ActivityState.Failed, activity.State); + case CalculationType.NoForeshore: + calculation.InputParameters.ForeshoreProfile = null; + calculation.InputParameters.UseForeshore = false; + calculation.InputParameters.UseBreakWater = false; + break; + case CalculationType.ForeShoreWithoutBreakWater: + calculation.InputParameters.ForeshoreProfile = CreateForeshoreProfile(null); + calculation.InputParameters.UseBreakWater = false; + break; + case CalculationType.ForeshoreWithValidBreakWater: + break; } - } - [Test] - public void OnRun_CalculationWithValidInputConditionsAndForeshoreProfileWithoutBreakWaterCannotPerformCalculation_LogCalculationStartAndEnd() - { - // Setup - var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); - ImportHydraulicBoundaryDatabase(assessmentSection); - - var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation - { - InputParameters = - { - HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001), - ForeshoreProfile = CreateForeshoreProfile(null), - UseForeshore = true, - UseBreakWater = false, - StepSize = WaveConditionsInputStepSize.Half, - LowerBoundaryRevetment = (RoundedDouble) 4, - UpperBoundaryRevetment = (RoundedDouble) 10.0, - UpperBoundaryWaterLevels = (RoundedDouble) 5.4, - LowerBoundaryWaterLevels = (RoundedDouble) 5 - } - }; - calculation.InputParameters.HydraulicBoundaryLocation.DesignWaterLevel = (RoundedDouble) 12.0; - var activity = new WaveImpactAsphaltCoverWaveConditionsCalculationActivity(calculation, testDataPath, assessmentSection.WaveImpactAsphaltCover, @@ -514,51 +459,6 @@ } [Test] - public void OnRun_CalculationWithValidInputConditionsAndForeshoreProfileWithBreakWaterCannotPerformCalculation_LogCalculationStartAndEnd() - { - // Setup - var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); - ImportHydraulicBoundaryDatabase(assessmentSection); - - WaveImpactAsphaltCoverWaveConditionsCalculation calculation = GetValidCalculation(assessmentSection); - - var activity = new WaveImpactAsphaltCoverWaveConditionsCalculationActivity(calculation, - testDataPath, - assessmentSection.WaveImpactAsphaltCover, - assessmentSection); - - using (new HydraRingCalculationServiceConfig()) - { - // Call - Action call = () => activity.Run(); - - // Assert - TestHelper.AssertLogMessages(call, messages => - { - var msgs = messages.ToArray(); - Assert.AreEqual(13, msgs.Length); - - StringAssert.StartsWith(string.Format("Validatie van '{0}' gestart om: ", calculation.Name), msgs[0]); - StringAssert.StartsWith(string.Format("Validatie van '{0}' beëindigd om: ", calculation.Name), msgs[1]); - StringAssert.StartsWith(string.Format("Berekening van '{0}' gestart om: ", calculation.Name), msgs[2]); - - int i = 2; - foreach (var waterLevel in calculation.InputParameters.WaterLevels) - { - StringAssert.StartsWith(string.Format("Berekening '{0}' voor waterstand '{1}' gestart om: ", calculation.Name, waterLevel), msgs[i + 1]); - Assert.AreEqual(string.Format("Berekening '{0}' voor waterstand '{1}' is niet gelukt.", calculation.Name, waterLevel), msgs[i + 2]); - StringAssert.StartsWith(string.Format("Berekening '{0}' voor waterstand '{1}' beëindigd om: ", calculation.Name, waterLevel), msgs[i + 3]); - - i = i + 3; - } - - StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[12]); - }); - Assert.AreEqual(ActivityState.Failed, activity.State); - } - } - - [Test] public void OnRun_CalculationWithValidCalculation_PerformCalculationAndLogStartAndEnd() { // Setup @@ -802,6 +702,13 @@ } } + public enum CalculationType + { + NoForeshore, + ForeshoreWithValidBreakWater, + ForeShoreWithoutBreakWater + } + private static WaveImpactAsphaltCoverWaveConditionsCalculation GetValidCalculation(AssessmentSection assessmentSection) { var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation @@ -823,6 +730,15 @@ return calculation; } + private static WaveImpactAsphaltCoverWaveConditionsCalculation GetDefaultValidationInput(AssessmentSection assessmentSection) + { + WaveImpactAsphaltCoverWaveConditionsCalculation calculation = GetValidCalculation(assessmentSection); + calculation.InputParameters.LowerBoundaryWaterLevels = (RoundedDouble) 5; + calculation.InputParameters.UpperBoundaryWaterLevels = (RoundedDouble) 5.4; + + return calculation; + } + private void ImportHydraulicBoundaryDatabase(AssessmentSection assessmentSection) { string validFilePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite");