Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Integration.Test/ClosingStructuresCalculationActivityIntegrationTest.cs =================================================================== diff -u -r80e51fdd446be6524d4f3bcc4175e8d3ae9c86ff -racca39f8e27f0fc74521a290ae5404227e3e646e --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Integration.Test/ClosingStructuresCalculationActivityIntegrationTest.cs (.../ClosingStructuresCalculationActivityIntegrationTest.cs) (revision 80e51fdd446be6524d4f3bcc4175e8d3ae9c86ff) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Integration.Test/ClosingStructuresCalculationActivityIntegrationTest.cs (.../ClosingStructuresCalculationActivityIntegrationTest.cs) (revision acca39f8e27f0fc74521a290ae5404227e3e646e) @@ -134,7 +134,10 @@ } [Test] - public void Run_InvalidCalculationAndRan_PerformValidationAndCalculationAndLogStartAndEndAndError() + [TestCase(true, "An error occurred")] + [TestCase(true, null)] + [TestCase(false, "An error occurred")] + public void Run_InvalidCalculationAndRan_PerformValidationAndCalculationAndActivityStateFailed(bool endInFailure, string lastErrorFileContent) { // Setup var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); @@ -164,135 +167,18 @@ using (new HydraRingCalculatorFactoryConfig()) { var calculator = ((TestHydraRingCalculatorFactory) HydraRingCalculatorFactory.Instance).StructuresClosureCalculator; - calculator.EndInFailure = true; - calculator.LastErrorFileContent = "An error occurred"; + calculator.EndInFailure = endInFailure; + calculator.LastErrorFileContent = lastErrorFileContent; // Call - Action call = () => activity.Run(); + activity.Run(); // Assert - TestHelper.AssertLogMessages(call, messages => - { - var msgs = messages.ToArray(); - Assert.AreEqual(6, 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]); - StringAssert.StartsWith(string.Format("De berekening voor kunstwerk sluiten '{0}' is niet gelukt. Bekijk het foutrapport door op details te klikken.", - calculation.Name), msgs[3]); - StringAssert.StartsWith("Betrouwbaarheid sluiting kunstwerk berekening is uitgevoerd op de tijdelijke locatie:", msgs[4]); - StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[5]); - }); Assert.AreEqual(ActivityState.Failed, activity.State); } } [Test] - public void Run_UnexplainedErrorInCalculation_PerformValidationAndCalculationAndLogStartAndEndAndError() - { - // Setup - var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); - - using (var importer = new HydraulicBoundaryDatabaseImporter()) - { - importer.Import(assessmentSection, validFilePath); - } - - var failureMechanism = new ClosingStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test section", new[] - { - new Point2D(0, 0), - new Point2D(1, 1) - })); - - var calculation = new TestClosingStructuresCalculation - { - InputParameters = - { - HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001) - } - }; - - var activity = new ClosingStructuresCalculationActivity(calculation, validFilePath, failureMechanism, assessmentSection); - using (new HydraRingCalculatorFactoryConfig()) - { - var calculator = ((TestHydraRingCalculatorFactory) HydraRingCalculatorFactory.Instance).StructuresClosureCalculator; - calculator.EndInFailure = true; - - // Call - Action call = () => activity.Run(); - - // Assert - TestHelper.AssertLogMessages(call, messages => - { - var msgs = messages.ToArray(); - Assert.AreEqual(6, 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]); - StringAssert.StartsWith(string.Format("De berekening voor kunstwerk sluiten '{0}' is niet gelukt. Er is geen foutrapport beschikbaar.", - calculation.Name), msgs[3]); - StringAssert.StartsWith("Betrouwbaarheid sluiting kunstwerk berekening is uitgevoerd op de tijdelijke locatie:", msgs[4]); - StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[5]); - }); - Assert.AreEqual(ActivityState.Failed, activity.State); - } - } - - [Test] - public void Run_ErrorInCalculation_PerformValidationAndCalculationAndLogStartAndEndAndError() - { - // Setup - var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); - - using (var importer = new HydraulicBoundaryDatabaseImporter()) - { - importer.Import(assessmentSection, validFilePath); - } - - var failureMechanism = new ClosingStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test section", new[] - { - new Point2D(0, 0), - new Point2D(1, 1) - })); - - var calculation = new TestClosingStructuresCalculation - { - InputParameters = - { - HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001) - } - }; - - var activity = new ClosingStructuresCalculationActivity(calculation, validFilePath, failureMechanism, assessmentSection); - using (new HydraRingCalculatorFactoryConfig()) - { - var calculator = ((TestHydraRingCalculatorFactory) HydraRingCalculatorFactory.Instance).StructuresClosureCalculator; - calculator.EndInFailure = false; - calculator.LastErrorFileContent = "An error occurred"; - - // Call - Action call = () => activity.Run(); - - // Assert - TestHelper.AssertLogMessages(call, messages => - { - var msgs = messages.ToArray(); - Assert.AreEqual(6, 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]); - StringAssert.StartsWith(string.Format("De berekening voor kunstwerk sluiten '{0}' is niet gelukt. Bekijk het foutrapport door op details te klikken.", - calculation.Name), msgs[3]); - StringAssert.StartsWith("Betrouwbaarheid sluiting kunstwerk berekening is uitgevoerd op de tijdelijke locatie:", msgs[4]); - StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[5]); - }); - Assert.AreEqual(ActivityState.Failed, activity.State); - } - } - - [Test] public void Finish_ValidCalculationAndRan_SetsOutputAndNotifyObserversOfCalculation() { // Setup Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Integration.Test/GrassCoverErosionOutwardsWaveConditionsCalculationActivityIntegrationTest.cs =================================================================== diff -u -r80e51fdd446be6524d4f3bcc4175e8d3ae9c86ff -racca39f8e27f0fc74521a290ae5404227e3e646e --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Integration.Test/GrassCoverErosionOutwardsWaveConditionsCalculationActivityIntegrationTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationActivityIntegrationTest.cs) (revision 80e51fdd446be6524d4f3bcc4175e8d3ae9c86ff) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Integration.Test/GrassCoverErosionOutwardsWaveConditionsCalculationActivityIntegrationTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationActivityIntegrationTest.cs) (revision acca39f8e27f0fc74521a290ae5404227e3e646e) @@ -293,7 +293,10 @@ } [Test] - public void Run_UnexplainedErrorInCalculation_ActivityStateFailed() + [TestCase(true, null)] + [TestCase(false, "An error occurred")] + [TestCase(true, "An error occurred")] + public void Run_ErrorInCalculation_ActivityStateFailed(bool endInFailure, string lastErrorFileContent) { // Setup var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); @@ -311,7 +314,8 @@ using (new HydraRingCalculatorFactoryConfig()) { var calculator = ((TestHydraRingCalculatorFactory) HydraRingCalculatorFactory.Instance).WaveConditionsCosineCalculator; - calculator.EndInFailure = true; + calculator.EndInFailure = endInFailure; + calculator.LastErrorFileContent = lastErrorFileContent; // Call activity.Run(); @@ -322,36 +326,6 @@ } [Test] - public void Run_ErrorInCalculation_ActivityStateFailed() - { - // Setup - var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); - - using (var importer = new HydraulicBoundaryDatabaseImporter()) - { - importer.Import(assessmentSection, validFilePath); - } - - var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); - - GrassCoverErosionOutwardsWaveConditionsCalculation calculation = GetValidCalculation(assessmentSection); - - var activity = new GrassCoverErosionOutwardsWaveConditionsCalculationActivity(calculation, testDataPath, failureMechanism, assessmentSection); - using (new HydraRingCalculatorFactoryConfig()) - { - var calculator = ((TestHydraRingCalculatorFactory) HydraRingCalculatorFactory.Instance).WaveConditionsCosineCalculator; - calculator.EndInFailure = false; - calculator.LastErrorFileContent = "An error occurred"; - - // Call - activity.Run(); - - // Assert - Assert.AreEqual(ActivityState.Failed, activity.State); - } - } - - [Test] public void Run_CalculationFailed_OutputNull() { // Setup Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Integration.Test/HeightStructuresCalculationActivityIntegrationTest.cs =================================================================== diff -u -r80e51fdd446be6524d4f3bcc4175e8d3ae9c86ff -racca39f8e27f0fc74521a290ae5404227e3e646e --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Integration.Test/HeightStructuresCalculationActivityIntegrationTest.cs (.../HeightStructuresCalculationActivityIntegrationTest.cs) (revision 80e51fdd446be6524d4f3bcc4175e8d3ae9c86ff) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Integration.Test/HeightStructuresCalculationActivityIntegrationTest.cs (.../HeightStructuresCalculationActivityIntegrationTest.cs) (revision acca39f8e27f0fc74521a290ae5404227e3e646e) @@ -87,7 +87,7 @@ } [Test] - public void Run_ValidCalculation_PerformHeightStructuresValidationAndCalculationAndLogStartAndEnd() + public void Run_ValidCalculation_PerformValidationAndCalculationAndLogStartAndEnd() { // Setup var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); @@ -135,7 +135,10 @@ } [Test] - public void Run_InvalidCalculationAndRan_PerformHeightStructuresValidationAndCalculationAndLogStartAndEndAndError() + [TestCase(true, "An error occurred")] + [TestCase(true, null)] + [TestCase(false, "An error occurred")] + public void Run_InvalidCalculationAndRan_PerformValidationAndCalculationAndActivityStateFailed(bool endInFailure, string lastErrorFileContent) { // Setup var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); @@ -166,134 +169,18 @@ using (new HydraRingCalculatorFactoryConfig()) { var calculator = ((TestHydraRingCalculatorFactory) HydraRingCalculatorFactory.Instance).StructuresOvertoppingCalculator; - calculator.EndInFailure = true; - calculator.LastErrorFileContent = "An error occurred"; + calculator.EndInFailure = endInFailure; + calculator.LastErrorFileContent = lastErrorFileContent; // Call - Action call = () => activity.Run(); + activity.Run(); // Assert - TestHelper.AssertLogMessages(call, messages => - { - var msgs = messages.ToArray(); - Assert.AreEqual(6, 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]); - StringAssert.StartsWith(string.Format("De berekening voor hoogte kunstwerk '{0}' is niet gelukt.", calculation.Name), msgs[3]); - StringAssert.StartsWith("Hoogte kunstwerk berekening is uitgevoerd op de tijdelijke locatie:", msgs[4]); - StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[5]); - }); Assert.AreEqual(ActivityState.Failed, activity.State); } } [Test] - public void Run_UnexplainedErrorInCalculation_PerformValidationAndCalculationAndLogStartAndEndAndError() - { - // Setup - var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); - - using (var importer = new HydraulicBoundaryDatabaseImporter()) - { - importer.Import(assessmentSection, validFilePath); - } - - var failureMechanism = new HeightStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test section", new[] - { - new Point2D(0, 0), - new Point2D(1, 1) - })); - - var calculation = new TestHeightStructuresCalculation - { - InputParameters = - { - HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001) - } - }; - - var activity = new HeightStructuresCalculationActivity(calculation, validFilePath, failureMechanism, assessmentSection); - using (new HydraRingCalculatorFactoryConfig()) - { - var calculator = ((TestHydraRingCalculatorFactory) HydraRingCalculatorFactory.Instance).StructuresOvertoppingCalculator; - calculator.EndInFailure = true; - - // Call - Action call = () => activity.Run(); - - // Assert - TestHelper.AssertLogMessages(call, messages => - { - var msgs = messages.ToArray(); - Assert.AreEqual(6, 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]); - StringAssert.StartsWith(string.Format("De berekening voor hoogte kunstwerk '{0}' is niet gelukt. Er is geen foutrapport beschikbaar.", - calculation.Name), msgs[3]); - StringAssert.StartsWith("Hoogte kunstwerk berekening is uitgevoerd op de tijdelijke locatie:", msgs[4]); - StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[5]); - }); - Assert.AreEqual(ActivityState.Failed, activity.State); - } - } - - [Test] - public void Run_ErrorInCalculation_PerformValidationAndCalculationAndLogStartAndEndAndError() - { - // Setup - var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); - - using (var importer = new HydraulicBoundaryDatabaseImporter()) - { - importer.Import(assessmentSection, validFilePath); - } - - var failureMechanism = new HeightStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test section", new[] - { - new Point2D(0, 0), - new Point2D(1, 1) - })); - - var calculation = new TestHeightStructuresCalculation - { - InputParameters = - { - HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001) - } - }; - - var activity = new HeightStructuresCalculationActivity(calculation, validFilePath, failureMechanism, assessmentSection); - using (new HydraRingCalculatorFactoryConfig()) - { - var calculator = ((TestHydraRingCalculatorFactory) HydraRingCalculatorFactory.Instance).StructuresOvertoppingCalculator; - calculator.EndInFailure = false; - calculator.LastErrorFileContent = "An error occurred"; - - // Call - Action call = () => activity.Run(); - - // Assert - TestHelper.AssertLogMessages(call, messages => - { - var msgs = messages.ToArray(); - Assert.AreEqual(6, 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]); - StringAssert.StartsWith(string.Format("De berekening voor hoogte kunstwerk '{0}' is niet gelukt. Bekijk het foutrapport door op details te klikken.", - calculation.Name), msgs[3]); - StringAssert.StartsWith("Hoogte kunstwerk berekening is uitgevoerd op de tijdelijke locatie:", msgs[4]); - StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[5]); - }); - Assert.AreEqual(ActivityState.Failed, activity.State); - } - } - - [Test] public void Finish_ValidCalculationAndRan_SetsOutputAndNotifyObserversOfCalculation() { // Setup Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Integration.Test/StabilityPointStructuresCalculationActivityIntegrationTest.cs =================================================================== diff -u -r80e51fdd446be6524d4f3bcc4175e8d3ae9c86ff -racca39f8e27f0fc74521a290ae5404227e3e646e --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Integration.Test/StabilityPointStructuresCalculationActivityIntegrationTest.cs (.../StabilityPointStructuresCalculationActivityIntegrationTest.cs) (revision 80e51fdd446be6524d4f3bcc4175e8d3ae9c86ff) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Integration.Test/StabilityPointStructuresCalculationActivityIntegrationTest.cs (.../StabilityPointStructuresCalculationActivityIntegrationTest.cs) (revision acca39f8e27f0fc74521a290ae5404227e3e646e) @@ -136,7 +136,10 @@ } [Test] - public void Run_InvalidCalculationAndRan_PerformValidationAndCalculationAndLogStartAndEndAndError() + [TestCase(true, "An error occurred")] + [TestCase(true, null)] + [TestCase(false, "An error occurred")] + public void Run_InvalidCalculationAndRan_PerformValidationAndCalculationAndActivityStateFailed(bool endInFailure, string lastErrorFileContent) { // Setup var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); @@ -168,136 +171,18 @@ using (new HydraRingCalculatorFactoryConfig()) { var calculator = ((TestHydraRingCalculatorFactory) HydraRingCalculatorFactory.Instance).StructuresStabilityPointCalculator; - calculator.EndInFailure = true; - calculator.LastErrorFileContent = "An error occurred"; + calculator.EndInFailure = endInFailure; + calculator.LastErrorFileContent = lastErrorFileContent; // Call - Action call = () => activity.Run(); + activity.Run(); // Assert - TestHelper.AssertLogMessages(call, messages => - { - var msgs = messages.ToArray(); - Assert.AreEqual(6, 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]); - StringAssert.StartsWith(string.Format("De berekening voor kunstwerk puntconstructies '{0}' is niet gelukt.", calculation.Name), msgs[3]); - StringAssert.StartsWith("Puntconstructies berekening is uitgevoerd op de tijdelijke locatie:", msgs[4]); - StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[5]); - }); Assert.AreEqual(ActivityState.Failed, activity.State); } } [Test] - public void Run_UnexplainedErrorInCalculation_PerformValidationAndCalculationAndLogStartAndEndAndError() - { - // Setup - var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); - - using (var importer = new HydraulicBoundaryDatabaseImporter()) - { - importer.Import(assessmentSection, validFilePath); - } - - var failureMechanism = new StabilityPointStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test section", new[] - { - new Point2D(0, 0), - new Point2D(1, 1) - })); - - var calculation = new TestStabilityPointStructuresCalculation - { - InputParameters = - { - HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001), - LoadSchematizationType = LoadSchematizationType.Linear - } - }; - - var activity = new StabilityPointStructuresCalculationActivity(calculation, validFilePath, failureMechanism, assessmentSection); - using (new HydraRingCalculatorFactoryConfig()) - { - var calculator = ((TestHydraRingCalculatorFactory) HydraRingCalculatorFactory.Instance).StructuresStabilityPointCalculator; - calculator.EndInFailure = true; - - // Call - Action call = () => activity.Run(); - - // Assert - TestHelper.AssertLogMessages(call, messages => - { - var msgs = messages.ToArray(); - Assert.AreEqual(6, 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]); - StringAssert.StartsWith(string.Format("De berekening voor kunstwerk puntconstructies '{0}' is niet gelukt. Er is geen foutrapport beschikbaar.", - calculation.Name), msgs[3]); - StringAssert.StartsWith("Puntconstructies berekening is uitgevoerd op de tijdelijke locatie:", msgs[4]); - StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[5]); - }); - Assert.AreEqual(ActivityState.Failed, activity.State); - } - } - - [Test] - public void Run_ErrorInCalculation_PerformValidationAndCalculationAndLogStartAndEndAndError() - { - // Setup - var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); - - using (var importer = new HydraulicBoundaryDatabaseImporter()) - { - importer.Import(assessmentSection, validFilePath); - } - - var failureMechanism = new StabilityPointStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test section", new[] - { - new Point2D(0, 0), - new Point2D(1, 1) - })); - - var calculation = new TestStabilityPointStructuresCalculation - { - InputParameters = - { - HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001), - LoadSchematizationType = LoadSchematizationType.Linear - } - }; - - var activity = new StabilityPointStructuresCalculationActivity(calculation, validFilePath, failureMechanism, assessmentSection); - using (new HydraRingCalculatorFactoryConfig()) - { - var calculator = ((TestHydraRingCalculatorFactory) HydraRingCalculatorFactory.Instance).StructuresStabilityPointCalculator; - calculator.EndInFailure = false; - calculator.LastErrorFileContent = "An error occurred"; - - // Call - Action call = () => activity.Run(); - - // Assert - TestHelper.AssertLogMessages(call, messages => - { - var msgs = messages.ToArray(); - Assert.AreEqual(6, 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]); - StringAssert.StartsWith(string.Format("De berekening voor kunstwerk puntconstructies '{0}' is niet gelukt. Bekijk het foutrapport door op details te klikken.", - calculation.Name), msgs[3]); - StringAssert.StartsWith("Puntconstructies berekening is uitgevoerd op de tijdelijke locatie:", msgs[4]); - StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[5]); - }); - Assert.AreEqual(ActivityState.Failed, activity.State); - } - } - - [Test] public void Finish_ValidCalculationAndRan_SetsOutputAndNotifyObserversOfCalculation() { // Setup Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Integration.Test/StabilityStoneCoverWaveConditionsCalculationActivityIntegrationTest.cs =================================================================== diff -u -r80e51fdd446be6524d4f3bcc4175e8d3ae9c86ff -racca39f8e27f0fc74521a290ae5404227e3e646e --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Integration.Test/StabilityStoneCoverWaveConditionsCalculationActivityIntegrationTest.cs (.../StabilityStoneCoverWaveConditionsCalculationActivityIntegrationTest.cs) (revision 80e51fdd446be6524d4f3bcc4175e8d3ae9c86ff) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Integration.Test/StabilityStoneCoverWaveConditionsCalculationActivityIntegrationTest.cs (.../StabilityStoneCoverWaveConditionsCalculationActivityIntegrationTest.cs) (revision acca39f8e27f0fc74521a290ae5404227e3e646e) @@ -384,9 +384,12 @@ } mockRepository.VerifyAll(); } - + [Test] - public void Run_UnexplainedErrorInCalculation_ActivityStateFailed() + [TestCase(true, null)] + [TestCase(false, "An error occurred")] + [TestCase(true, "An error occurred")] + public void Run_ErrorInCalculation_ActivityStateFailed(bool endInFailure, string lastErrorFileContent) { // Setup var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); @@ -404,7 +407,8 @@ using (new HydraRingCalculatorFactoryConfig()) { var calculator = ((TestHydraRingCalculatorFactory) HydraRingCalculatorFactory.Instance).WaveConditionsCosineCalculator; - calculator.EndInFailure = true; + calculator.EndInFailure = endInFailure; + calculator.LastErrorFileContent = lastErrorFileContent; // Call activity.Run(); @@ -415,36 +419,6 @@ } [Test] - public void Run_ErrorInCalculation_ActivityStateFailed() - { - // Setup - var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); - - using (var importer = new HydraulicBoundaryDatabaseImporter()) - { - importer.Import(assessmentSection, validFilePath); - } - - var failureMechanism = new StabilityStoneCoverFailureMechanism(); - - StabilityStoneCoverWaveConditionsCalculation calculation = GetValidCalculation(); - - var activity = new StabilityStoneCoverWaveConditionsCalculationActivity(calculation, testDataPath, failureMechanism, assessmentSection); - using (new HydraRingCalculatorFactoryConfig()) - { - var calculator = ((TestHydraRingCalculatorFactory) HydraRingCalculatorFactory.Instance).WaveConditionsCosineCalculator; - calculator.EndInFailure = false; - calculator.LastErrorFileContent = "An error occurred"; - - // Call - activity.Run(); - - // Assert - Assert.AreEqual(ActivityState.Failed, activity.State); - } - } - - [Test] public void Run_CalculationFailed_OutputNull() { // Setup Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Integration.Test/WaveImpactAsphaltCoverWaveConditionsCalculationActivityIntegrationTest.cs =================================================================== diff -u -r80e51fdd446be6524d4f3bcc4175e8d3ae9c86ff -racca39f8e27f0fc74521a290ae5404227e3e646e --- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Integration.Test/WaveImpactAsphaltCoverWaveConditionsCalculationActivityIntegrationTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationActivityIntegrationTest.cs) (revision 80e51fdd446be6524d4f3bcc4175e8d3ae9c86ff) +++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Integration.Test/WaveImpactAsphaltCoverWaveConditionsCalculationActivityIntegrationTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationActivityIntegrationTest.cs) (revision acca39f8e27f0fc74521a290ae5404227e3e646e) @@ -249,9 +249,12 @@ Assert.IsNull(calculation.Output); } } - + [Test] - public void Run_UnexplainedErrorInCalculation_ActivityStateFailed() + [TestCase(true, null)] + [TestCase(false, "An error occurred")] + [TestCase(true, "An error occurred")] + public void Run_ErrorInCalculation_ActivityStateFailed(bool endInFailure, string lastErrorFileContent) { // Setup var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); @@ -269,7 +272,8 @@ using (new HydraRingCalculatorFactoryConfig()) { var calculator = ((TestHydraRingCalculatorFactory) HydraRingCalculatorFactory.Instance).WaveConditionsCosineCalculator; - calculator.EndInFailure = true; + calculator.EndInFailure = endInFailure; + calculator.LastErrorFileContent = lastErrorFileContent; // Call activity.Run(); @@ -279,36 +283,6 @@ } } - [Test] - public void Run_ErrorInCalculation_ActivityStateFailed() - { - // Setup - var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); - - using (var importer = new HydraulicBoundaryDatabaseImporter()) - { - importer.Import(assessmentSection, validFilePath); - } - - var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); - - WaveImpactAsphaltCoverWaveConditionsCalculation calculation = GetValidCalculation(assessmentSection); - - var activity = new WaveImpactAsphaltCoverWaveConditionsCalculationActivity(calculation, testDataPath, failureMechanism, assessmentSection); - using (new HydraRingCalculatorFactoryConfig()) - { - var calculator = ((TestHydraRingCalculatorFactory) HydraRingCalculatorFactory.Instance).WaveConditionsCosineCalculator; - calculator.EndInFailure = false; - calculator.LastErrorFileContent = "An error occurred"; - - // Call - activity.Run(); - - // Assert - Assert.AreEqual(ActivityState.Failed, activity.State); - } - } - private static WaveImpactAsphaltCoverWaveConditionsCalculation GetValidCalculation(AssessmentSection assessmentSection) { var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation