Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Service/DuneErosionBoundaryCalculationActivity.cs =================================================================== diff -u -r22b6bdeb7d18ce2492b61394783e0a93257859a7 -re93f3cb97066cae85be4a977098261d47ba6eb57 --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Service/DuneErosionBoundaryCalculationActivity.cs (.../DuneErosionBoundaryCalculationActivity.cs) (revision 22b6bdeb7d18ce2492b61394783e0a93257859a7) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Service/DuneErosionBoundaryCalculationActivity.cs (.../DuneErosionBoundaryCalculationActivity.cs) (revision e93f3cb97066cae85be4a977098261d47ba6eb57) @@ -72,7 +72,7 @@ return true; } - return DuneErosionBoundaryCalculationService.Validate(hydraulicBoundaryDatabaseFilePath); + return DuneErosionBoundaryCalculationService.Validate(duneLocation.Name, hydraulicBoundaryDatabaseFilePath); } protected override void PerformCalculation() Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Service/DuneErosionBoundaryCalculationService.cs =================================================================== diff -u -r22b6bdeb7d18ce2492b61394783e0a93257859a7 -re93f3cb97066cae85be4a977098261d47ba6eb57 --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Service/DuneErosionBoundaryCalculationService.cs (.../DuneErosionBoundaryCalculationService.cs) (revision 22b6bdeb7d18ce2492b61394783e0a93257859a7) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Service/DuneErosionBoundaryCalculationService.cs (.../DuneErosionBoundaryCalculationService.cs) (revision e93f3cb97066cae85be4a977098261d47ba6eb57) @@ -51,16 +51,25 @@ /// /// Performs validation over the values on the given . + /// Error and status information is logged during the execution of the operation. /// + /// The name of the dune location. /// The file path of the hydraulic boundary /// database file which to validate. /// True if there were no validation errors; False otherwise. - public static bool Validate(string hydraulicBoundaryDatabaseFilePath) + public static bool Validate(string duneLocationName, string hydraulicBoundaryDatabaseFilePath) { + string calculationName = GetCalculationName(duneLocationName); + + CalculationServiceHelper.LogValidationBegin(calculationName); + string[] validationProblems = ValidateInput(hydraulicBoundaryDatabaseFilePath); CalculationServiceHelper.LogMessagesAsError(RingtoetsCommonServiceResources.Hydraulic_boundary_database_connection_failed_0_, validationProblems); + + CalculationServiceHelper.LogValidationEnd(calculationName); + return !validationProblems.Any(); } Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/GuiServices/DuneLocationCalculationGuiServiceTest.cs =================================================================== diff -u -r22b6bdeb7d18ce2492b61394783e0a93257859a7 -re93f3cb97066cae85be4a977098261d47ba6eb57 --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/GuiServices/DuneLocationCalculationGuiServiceTest.cs (.../DuneLocationCalculationGuiServiceTest.cs) (revision 22b6bdeb7d18ce2492b61394783e0a93257859a7) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/GuiServices/DuneLocationCalculationGuiServiceTest.cs (.../DuneLocationCalculationGuiServiceTest.cs) (revision e93f3cb97066cae85be4a977098261d47ba6eb57) @@ -28,6 +28,7 @@ using Core.Common.TestUtil; using NUnit.Framework; using Rhino.Mocks; +using Ringtoets.Common.Service.TestUtil; using Ringtoets.DuneErosion.Data; using Ringtoets.DuneErosion.Forms.GuiServices; using Ringtoets.HydraRing.Calculation.Calculator.Factory; @@ -117,17 +118,26 @@ List messageList = messages.ToList(); // Assert - Assert.AreEqual(10, messageList.Count); - Assert.AreEqual("Berekening van 'Hydraulische belasting berekenen voor locatie 'A'' gestart.", messageList[0]); - Assert.AreEqual("Hydraulische randvoorwaarden berekening voor locatie 'A' is niet geconvergeerd.", messageList[1]); - StringAssert.StartsWith("Hydraulische randvoorwaarden berekening is uitgevoerd op de tijdelijke locatie", messageList[2]); - Assert.AreEqual("Berekening van 'Hydraulische belasting berekenen voor locatie 'A'' beëindigd.", messageList[3]); - Assert.AreEqual("Berekening van 'Hydraulische belasting berekenen voor locatie 'B'' gestart.", messageList[4]); - Assert.AreEqual("Hydraulische randvoorwaarden berekening voor locatie 'B' is niet geconvergeerd.", messageList[5]); - StringAssert.StartsWith("Hydraulische randvoorwaarden berekening is uitgevoerd op de tijdelijke locatie", messageList[6]); - Assert.AreEqual("Berekening van 'Hydraulische belasting berekenen voor locatie 'B'' beëindigd.", messageList[7]); - Assert.AreEqual("Hydraulische randvoorwaarden berekenen voor locatie 'A' is gelukt.", messageList[8]); - Assert.AreEqual("Hydraulische randvoorwaarden berekenen voor locatie 'B' is gelukt.", messageList[9]); + Assert.AreEqual(14, messageList.Count); + + const string calculationNameA = "Hydraulische belasting berekenen voor locatie 'A'"; + CalculationServiceTestHelper.AssertValidationStartMessage(calculationNameA, messageList[0]); + CalculationServiceTestHelper.AssertValidationEndMessage(calculationNameA, messageList[1]); + CalculationServiceTestHelper.AssertCalculationStartMessage(calculationNameA, messageList[2]); + Assert.AreEqual("Hydraulische randvoorwaarden berekening voor locatie 'A' is niet geconvergeerd.", messageList[3]); + StringAssert.StartsWith("Hydraulische randvoorwaarden berekening is uitgevoerd op de tijdelijke locatie", messageList[4]); + CalculationServiceTestHelper.AssertCalculationEndMessage(calculationNameA, messageList[5]); + + const string calculationNameB = "Hydraulische belasting berekenen voor locatie 'B'"; + CalculationServiceTestHelper.AssertValidationStartMessage(calculationNameB, messageList[6]); + CalculationServiceTestHelper.AssertValidationEndMessage(calculationNameB, messageList[7]); + CalculationServiceTestHelper.AssertCalculationStartMessage(calculationNameB, messageList[8]); + Assert.AreEqual("Hydraulische randvoorwaarden berekening voor locatie 'B' is niet geconvergeerd.", messageList[9]); + StringAssert.StartsWith("Hydraulische randvoorwaarden berekening is uitgevoerd op de tijdelijke locatie", messageList[10]); + CalculationServiceTestHelper.AssertCalculationEndMessage(calculationNameB, messageList[11]); + + Assert.AreEqual("Hydraulische randvoorwaarden berekenen voor locatie 'A' is gelukt.", messageList[12]); + Assert.AreEqual("Hydraulische randvoorwaarden berekenen voor locatie 'B' is gelukt.", messageList[13]); }); } Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Ringtoets.DuneErosion.Forms.Test.csproj =================================================================== diff -u -r12d03593998d6ac93c231ef947f00ff87c71e100 -re93f3cb97066cae85be4a977098261d47ba6eb57 --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Ringtoets.DuneErosion.Forms.Test.csproj (.../Ringtoets.DuneErosion.Forms.Test.csproj) (revision 12d03593998d6ac93c231ef947f00ff87c71e100) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Ringtoets.DuneErosion.Forms.Test.csproj (.../Ringtoets.DuneErosion.Forms.Test.csproj) (revision e93f3cb97066cae85be4a977098261d47ba6eb57) @@ -124,6 +124,10 @@ {D24FA2F7-28A7-413B-AFD3-EE10E985630B} Ringtoets.Common.Forms.TestUtil + + {52093DA6-D545-476A-ADFD-12F56625E36B} + Ringtoets.Common.Service.TestUtil + {888D4097-8BC2-4703-9FB1-8744C94D525E} Ringtoets.HydraRing.Calculation Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Views/DuneLocationsViewTest.cs =================================================================== diff -u -rb633ec894f0b9c1878e978b24a0c870480fd604b -re93f3cb97066cae85be4a977098261d47ba6eb57 --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Views/DuneLocationsViewTest.cs (.../DuneLocationsViewTest.cs) (revision b633ec894f0b9c1878e978b24a0c870480fd604b) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Views/DuneLocationsViewTest.cs (.../DuneLocationsViewTest.cs) (revision e93f3cb97066cae85be4a977098261d47ba6eb57) @@ -37,6 +37,7 @@ using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.Hydraulics; using Ringtoets.Common.Forms.Views; +using Ringtoets.Common.Service.TestUtil; using Ringtoets.DuneErosion.Data; using Ringtoets.DuneErosion.Forms.GuiServices; using Ringtoets.DuneErosion.Forms.PresentationObjects; @@ -395,12 +396,16 @@ List messageList = messages.ToList(); // Assert - Assert.AreEqual(5, messageList.Count); - Assert.AreEqual("Berekening van 'Hydraulische belasting berekenen voor locatie '1'' gestart.", messageList[0]); - Assert.AreEqual("Hydraulische randvoorwaarden berekening voor locatie '1' is niet geconvergeerd.", messageList[1]); - StringAssert.StartsWith("Hydraulische randvoorwaarden berekening is uitgevoerd op de tijdelijke locatie", messageList[2]); - Assert.AreEqual("Berekening van 'Hydraulische belasting berekenen voor locatie '1'' beëindigd.", messageList[3]); - Assert.AreEqual("Hydraulische randvoorwaarden berekenen voor locatie '1' is gelukt.", messageList[4]); + Assert.AreEqual(7, messageList.Count); + + const string calculationNameA = "Hydraulische belasting berekenen voor locatie '1'"; + CalculationServiceTestHelper.AssertValidationStartMessage(calculationNameA, messageList[0]); + CalculationServiceTestHelper.AssertValidationEndMessage(calculationNameA, messageList[1]); + CalculationServiceTestHelper.AssertCalculationStartMessage(calculationNameA, messageList[2]); + Assert.AreEqual("Hydraulische randvoorwaarden berekening voor locatie '1' is niet geconvergeerd.", messageList[3]); + StringAssert.StartsWith("Hydraulische randvoorwaarden berekening is uitgevoerd op de tijdelijke locatie", messageList[4]); + CalculationServiceTestHelper.AssertCalculationEndMessage(calculationNameA, messageList[5]); + Assert.AreEqual("Hydraulische randvoorwaarden berekenen voor locatie '1' is gelukt.", messageList[6]); }); Assert.AreSame(originalDataSource, dataGridView.DataSource); Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Integration.Test/DuneErosionBoundaryCalculationActivityIntegrationTest.cs =================================================================== diff -u -r22b6bdeb7d18ce2492b61394783e0a93257859a7 -re93f3cb97066cae85be4a977098261d47ba6eb57 --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Integration.Test/DuneErosionBoundaryCalculationActivityIntegrationTest.cs (.../DuneErosionBoundaryCalculationActivityIntegrationTest.cs) (revision 22b6bdeb7d18ce2492b61394783e0a93257859a7) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Integration.Test/DuneErosionBoundaryCalculationActivityIntegrationTest.cs (.../DuneErosionBoundaryCalculationActivityIntegrationTest.cs) (revision e93f3cb97066cae85be4a977098261d47ba6eb57) @@ -75,11 +75,14 @@ messages => { string[] msgs = messages.ToArray(); - Assert.AreEqual(4, msgs.Length); - CalculationServiceTestHelper.AssertCalculationStartMessage(calculationName, msgs[0]); - Assert.AreEqual($"Hydraulische randvoorwaarden berekening voor locatie '{duneLocation.Name}' is niet geconvergeerd.", msgs[1]); - StringAssert.StartsWith("Hydraulische randvoorwaarden berekening is uitgevoerd op de tijdelijke locatie", msgs[2]); - CalculationServiceTestHelper.AssertCalculationEndMessage(calculationName, msgs[3]); + Assert.AreEqual(6, msgs.Length); + + CalculationServiceTestHelper.AssertValidationStartMessage(calculationName, msgs[0]); + CalculationServiceTestHelper.AssertValidationEndMessage(calculationName, msgs[1]); + CalculationServiceTestHelper.AssertCalculationStartMessage(calculationName, msgs[2]); + Assert.AreEqual($"Hydraulische randvoorwaarden berekening voor locatie '{duneLocation.Name}' is niet geconvergeerd.", msgs[3]); + StringAssert.StartsWith("Hydraulische randvoorwaarden berekening is uitgevoerd op de tijdelijke locatie", msgs[4]); + CalculationServiceTestHelper.AssertCalculationEndMessage(calculationName, msgs[5]); }); Assert.AreEqual(ActivityState.Executed, activity.State); } Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Plugin.Test/Ringtoets.DuneErosion.Plugin.Test.csproj =================================================================== diff -u -r12d03593998d6ac93c231ef947f00ff87c71e100 -re93f3cb97066cae85be4a977098261d47ba6eb57 --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Plugin.Test/Ringtoets.DuneErosion.Plugin.Test.csproj (.../Ringtoets.DuneErosion.Plugin.Test.csproj) (revision 12d03593998d6ac93c231ef947f00ff87c71e100) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Plugin.Test/Ringtoets.DuneErosion.Plugin.Test.csproj (.../Ringtoets.DuneErosion.Plugin.Test.csproj) (revision e93f3cb97066cae85be4a977098261d47ba6eb57) @@ -119,6 +119,10 @@ {4843D6E5-066F-4795-94F5-1D53932DD03C} Ringtoets.Common.Data.TestUtil + + {52093DA6-D545-476A-ADFD-12F56625E36B} + Ringtoets.Common.Service.TestUtil + {888D4097-8BC2-4703-9FB1-8744C94D525E} Ringtoets.HydraRing.Calculation Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Plugin.Test/TreeNodeInfos/DuneLocationsContextTreeNodeInfoTest.cs =================================================================== diff -u -rb633ec894f0b9c1878e978b24a0c870480fd604b -re93f3cb97066cae85be4a977098261d47ba6eb57 --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Plugin.Test/TreeNodeInfos/DuneLocationsContextTreeNodeInfoTest.cs (.../DuneLocationsContextTreeNodeInfoTest.cs) (revision b633ec894f0b9c1878e978b24a0c870480fd604b) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Plugin.Test/TreeNodeInfos/DuneLocationsContextTreeNodeInfoTest.cs (.../DuneLocationsContextTreeNodeInfoTest.cs) (revision e93f3cb97066cae85be4a977098261d47ba6eb57) @@ -37,6 +37,7 @@ using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.Contribution; using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Service.TestUtil; using Ringtoets.DuneErosion.Data; using Ringtoets.DuneErosion.Data.TestUtil; using Ringtoets.DuneErosion.Forms.PresentationObjects; @@ -450,17 +451,25 @@ List messageList = messages.ToList(); // Assert - Assert.AreEqual(10, messageList.Count); - Assert.AreEqual("Berekening van 'Hydraulische belasting berekenen voor locatie 'A'' gestart.", messageList[0]); - Assert.AreEqual("Hydraulische randvoorwaarden berekening voor locatie 'A' is niet geconvergeerd.", messageList[1]); - StringAssert.StartsWith("Hydraulische randvoorwaarden berekening is uitgevoerd op de tijdelijke locatie", messageList[2]); - Assert.AreEqual("Berekening van 'Hydraulische belasting berekenen voor locatie 'A'' beëindigd.", messageList[3]); - Assert.AreEqual("Berekening van 'Hydraulische belasting berekenen voor locatie 'B'' gestart.", messageList[4]); - Assert.AreEqual("Hydraulische randvoorwaarden berekening voor locatie 'B' is niet geconvergeerd.", messageList[5]); - StringAssert.StartsWith("Hydraulische randvoorwaarden berekening is uitgevoerd op de tijdelijke locatie", messageList[6]); - Assert.AreEqual("Berekening van 'Hydraulische belasting berekenen voor locatie 'B'' beëindigd.", messageList[7]); - Assert.AreEqual("Hydraulische randvoorwaarden berekenen voor locatie 'A' is gelukt.", messageList[8]); - Assert.AreEqual("Hydraulische randvoorwaarden berekenen voor locatie 'B' is gelukt.", messageList[9]); + Assert.AreEqual(14, messageList.Count); + const string calculationNameA = "Hydraulische belasting berekenen voor locatie 'A'"; + CalculationServiceTestHelper.AssertValidationStartMessage(calculationNameA, messageList[0]); + CalculationServiceTestHelper.AssertValidationEndMessage(calculationNameA, messageList[1]); + CalculationServiceTestHelper.AssertCalculationStartMessage(calculationNameA, messageList[2]); + Assert.AreEqual("Hydraulische randvoorwaarden berekening voor locatie 'A' is niet geconvergeerd.", messageList[3]); + StringAssert.StartsWith("Hydraulische randvoorwaarden berekening is uitgevoerd op de tijdelijke locatie", messageList[4]); + CalculationServiceTestHelper.AssertCalculationEndMessage(calculationNameA, messageList[5]); + + const string calculationNameB = "Hydraulische belasting berekenen voor locatie 'B'"; + CalculationServiceTestHelper.AssertValidationStartMessage(calculationNameB, messageList[6]); + CalculationServiceTestHelper.AssertValidationEndMessage(calculationNameB, messageList[7]); + CalculationServiceTestHelper.AssertCalculationStartMessage(calculationNameB, messageList[8]); + Assert.AreEqual("Hydraulische randvoorwaarden berekening voor locatie 'B' is niet geconvergeerd.", messageList[9]); + StringAssert.StartsWith("Hydraulische randvoorwaarden berekening is uitgevoerd op de tijdelijke locatie", messageList[10]); + CalculationServiceTestHelper.AssertCalculationEndMessage(calculationNameB, messageList[11]); + + Assert.AreEqual("Hydraulische randvoorwaarden berekenen voor locatie 'A' is gelukt.", messageList[12]); + Assert.AreEqual("Hydraulische randvoorwaarden berekenen voor locatie 'B' is gelukt.", messageList[13]); }); } } Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Service.Test/DuneErosionBoundaryCalculationActivityTest.cs =================================================================== diff -u -r22b6bdeb7d18ce2492b61394783e0a93257859a7 -re93f3cb97066cae85be4a977098261d47ba6eb57 --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Service.Test/DuneErosionBoundaryCalculationActivityTest.cs (.../DuneErosionBoundaryCalculationActivityTest.cs) (revision 22b6bdeb7d18ce2492b61394783e0a93257859a7) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Service.Test/DuneErosionBoundaryCalculationActivityTest.cs (.../DuneErosionBoundaryCalculationActivityTest.cs) (revision e93f3cb97066cae85be4a977098261d47ba6eb57) @@ -104,9 +104,12 @@ TestHelper.AssertLogMessages(call, messages => { string[] msgs = messages.ToArray(); - Assert.AreEqual(1, msgs.Length); + Assert.AreEqual(3, msgs.Length); - StringAssert.StartsWith("Herstellen van de verbinding met de hydraulische randvoorwaardendatabase is mislukt. Fout bij het lezen van bestand", msgs[0]); + string calculationName = GetCalculationName(duneLocation.Name); + CalculationServiceTestHelper.AssertValidationStartMessage(calculationName, msgs[0]); + StringAssert.StartsWith("Herstellen van de verbinding met de hydraulische randvoorwaardendatabase is mislukt. Fout bij het lezen van bestand", msgs[1]); + CalculationServiceTestHelper.AssertValidationEndMessage(calculationName, msgs[2]); }); Assert.AreEqual(ActivityState.Failed, activity.State); } @@ -141,12 +144,14 @@ TestHelper.AssertLogMessages(call, m => { string[] messages = m.ToArray(); - Assert.AreEqual(3, messages.Length); + Assert.AreEqual(5, messages.Length); string calculationName = GetCalculationName(duneLocation.Name); - CalculationServiceTestHelper.AssertCalculationStartMessage(calculationName, messages[0]); - StringAssert.StartsWith("Hydraulische randvoorwaarden berekening is uitgevoerd op de tijdelijke locatie", messages[1]); - CalculationServiceTestHelper.AssertCalculationEndMessage(calculationName, messages[2]); + CalculationServiceTestHelper.AssertValidationStartMessage(calculationName, messages[0]); + CalculationServiceTestHelper.AssertValidationEndMessage(calculationName, messages[1]); + CalculationServiceTestHelper.AssertCalculationStartMessage(calculationName, messages[2]); + StringAssert.StartsWith("Hydraulische randvoorwaarden berekening is uitgevoerd op de tijdelijke locatie", messages[3]); + CalculationServiceTestHelper.AssertCalculationEndMessage(calculationName, messages[4]); }); DunesBoundaryConditionsCalculationInput calculationInput = calculator.ReceivedInputs.First(); @@ -260,7 +265,7 @@ // Assert string calculationfailedMessage = $"Hydraulische randvoorwaarden berekening voor locatie '{duneLocation.Name}' is niet gelukt. {detailedReport}"; - TestHelper.AssertLogMessageIsGenerated(call, calculationfailedMessage, 4); + TestHelper.AssertLogMessageIsGenerated(call, calculationfailedMessage, 6); } mockRepository.VerifyAll(); } @@ -294,13 +299,15 @@ TestHelper.AssertLogMessages(call, messages => { string[] msgs = messages.ToArray(); - Assert.AreEqual(4, msgs.Length); + Assert.AreEqual(6, msgs.Length); string calculationName = GetCalculationName(duneLocation.Name); - CalculationServiceTestHelper.AssertCalculationStartMessage(calculationName, msgs[0]); - Assert.AreEqual($"Hydraulische randvoorwaarden berekening voor locatie '{duneLocation.Name}' is niet geconvergeerd.", msgs[1]); - StringAssert.StartsWith("Hydraulische randvoorwaarden berekening is uitgevoerd op de tijdelijke locatie", msgs[2]); - CalculationServiceTestHelper.AssertCalculationEndMessage(calculationName, msgs[3]); + CalculationServiceTestHelper.AssertValidationStartMessage(calculationName, msgs[0]); + CalculationServiceTestHelper.AssertValidationEndMessage(calculationName, msgs[1]); + CalculationServiceTestHelper.AssertCalculationStartMessage(calculationName, msgs[2]); + Assert.AreEqual($"Hydraulische randvoorwaarden berekening voor locatie '{duneLocation.Name}' is niet geconvergeerd.", msgs[3]); + StringAssert.StartsWith("Hydraulische randvoorwaarden berekening is uitgevoerd op de tijdelijke locatie", msgs[4]); + CalculationServiceTestHelper.AssertCalculationEndMessage(calculationName, msgs[5]); }); Assert.AreEqual(CalculationConvergence.CalculatedNotConverged, duneLocation.Output.CalculationConvergence); Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Service.Test/DuneErosionBoundaryCalculationServiceTest.cs =================================================================== diff -u -r22b6bdeb7d18ce2492b61394783e0a93257859a7 -re93f3cb97066cae85be4a977098261d47ba6eb57 --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Service.Test/DuneErosionBoundaryCalculationServiceTest.cs (.../DuneErosionBoundaryCalculationServiceTest.cs) (revision 22b6bdeb7d18ce2492b61394783e0a93257859a7) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Service.Test/DuneErosionBoundaryCalculationServiceTest.cs (.../DuneErosionBoundaryCalculationServiceTest.cs) (revision e93f3cb97066cae85be4a977098261d47ba6eb57) @@ -47,54 +47,75 @@ public void Validate_ValidHydraulicBoundaryDatabasePath_ReturnsTrue() { // Setup + const string locationName = "locationName"; var valid = false; // Call - Action call = () => valid = DuneErosionBoundaryCalculationService.Validate(validFilePath); + Action call = () => valid = DuneErosionBoundaryCalculationService.Validate(locationName, validFilePath); // Assert - TestHelper.AssertLogMessagesCount(call, 0); + TestHelper.AssertLogMessages(call, messages => + { + string[] msgs = messages.ToArray(); + Assert.AreEqual(2, msgs.Length); + + string calculationName = GetCalculationName(locationName); + CalculationServiceTestHelper.AssertValidationStartMessage(calculationName, msgs[0]); + CalculationServiceTestHelper.AssertValidationEndMessage(calculationName, msgs[1]); + }); Assert.IsTrue(valid); } [Test] public void Validate_InvalidHydraulicBoundaryDatabasePath_LogsErrorAndReturnsFalse() { // Setup + const string locationName = "locationName"; string notValidFilePath = Path.Combine(testDataPath, "notexisting.sqlite"); var valid = false; // Call - Action call = () => valid = DuneErosionBoundaryCalculationService.Validate(notValidFilePath); + Action call = () => valid = DuneErosionBoundaryCalculationService.Validate(locationName, notValidFilePath); // Assert - TestHelper.AssertLogMessagesWithLevelAreGenerated(call, new[] + TestHelper.AssertLogMessages(call, messages => { - Tuple.Create("Herstellen van de verbinding met de hydraulische randvoorwaardendatabase is mislukt. " + - $"Fout bij het lezen van bestand '{notValidFilePath}': het bestand bestaat niet.", - LogLevelConstant.Error) - }, 1); + string[] msgs = messages.ToArray(); + Assert.AreEqual(3, msgs.Length); + + string calculationName = GetCalculationName(locationName); + CalculationServiceTestHelper.AssertValidationStartMessage(calculationName, msgs[0]); + StringAssert.StartsWith("Herstellen van de verbinding met de hydraulische randvoorwaardendatabase is mislukt. " + + $"Fout bij het lezen van bestand '{notValidFilePath}'", msgs[1]); + CalculationServiceTestHelper.AssertValidationEndMessage(calculationName, msgs[2]); + }); Assert.IsFalse(valid); } [Test] public void Validate_ValidHydraulicBoundaryDatabaseWithoutSettings_LogsErrorAndReturnsFalse() { // Setup + const string locationName = "locationName"; string notValidFilePath = Path.Combine(testDataPath, "HRD nosettings.sqlite"); string missingConfigFilePath = Path.Combine(testDataPath, "HRD nosettings.config.sqlite"); var valid = false; // Call - Action call = () => valid = DuneErosionBoundaryCalculationService.Validate(notValidFilePath); + Action call = () => valid = DuneErosionBoundaryCalculationService.Validate(locationName, notValidFilePath); // Assert - TestHelper.AssertLogMessagesWithLevelAreGenerated(call, new[] + TestHelper.AssertLogMessages(call, messages => { - Tuple.Create("Herstellen van de verbinding met de hydraulische randvoorwaardendatabase is mislukt. " + - $"Fout bij het lezen van bestand '{missingConfigFilePath}': het bestand bestaat niet.", - LogLevelConstant.Error) - }, 1); + string[] msgs = messages.ToArray(); + Assert.AreEqual(3, msgs.Length); + + string calculationName = GetCalculationName(locationName); + CalculationServiceTestHelper.AssertValidationStartMessage(calculationName, msgs[0]); + StringAssert.StartsWith("Herstellen van de verbinding met de hydraulische randvoorwaardendatabase is mislukt. " + + $"Fout bij het lezen van bestand '{missingConfigFilePath}'", msgs[1]); + CalculationServiceTestHelper.AssertValidationEndMessage(calculationName, msgs[2]); + }); Assert.IsFalse(valid); }