Index: Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Service.Test/GrassCoverErosionInwardsCalculationServiceTest.cs =================================================================== diff -u -r54ed6c0d1b17e218d89fb5b1a4be658162e11609 -r143b215a688f17f9dfa0265db7be7e84d3fb46b7 --- Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Service.Test/GrassCoverErosionInwardsCalculationServiceTest.cs (.../GrassCoverErosionInwardsCalculationServiceTest.cs) (revision 54ed6c0d1b17e218d89fb5b1a4be658162e11609) +++ Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Service.Test/GrassCoverErosionInwardsCalculationServiceTest.cs (.../GrassCoverErosionInwardsCalculationServiceTest.cs) (revision 143b215a688f17f9dfa0265db7be7e84d3fb46b7) @@ -56,7 +56,7 @@ // Setup var mockRepository = new MockRepository(); IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub( - new GrassCoverErosionInwardsFailureMechanism(), mockRepository, validHrdFilePath); + new GrassCoverErosionInwardsFailureMechanism(), mockRepository); mockRepository.ReplayAll(); var calculation = new GrassCoverErosionInwardsCalculation @@ -86,15 +86,12 @@ } [Test] - public void Validate_InvalidHydraulicBoundaryDatabase_LogsMessageAndReturnsFalse() + public void Validate_NoHydraulicBoundaryDatabase_LogsMessageAndReturnsFalse() { // Setup - string invalidFilePath = Path.Combine(testDataPath, "notexisting.sqlite"); - var mockRepository = new MockRepository(); IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(new GrassCoverErosionInwardsFailureMechanism(), - mockRepository, - invalidFilePath); + mockRepository); mockRepository.ReplayAll(); var calculation = new GrassCoverErosionInwardsCalculation @@ -107,7 +104,7 @@ }; // Call - var isValid = true; + var isValid = false; void Call() => isValid = GrassCoverErosionInwardsCalculationService.Validate(calculation, assessmentSection); // Assert @@ -116,7 +113,7 @@ string[] msgs = messages.ToArray(); Assert.AreEqual(3, msgs.Length); CalculationServiceTestHelper.AssertValidationStartMessage(msgs[0]); - StringAssert.StartsWith("Herstellen van de verbinding met de hydraulische belastingendatabase is mislukt. Fout bij het lezen van bestand", msgs[1]); + Assert.AreEqual("Er is geen hydraulische belastingendatabase geïmporteerd.", msgs[1]); CalculationServiceTestHelper.AssertValidationEndMessage(msgs[2]); }); Assert.IsFalse(isValid); @@ -125,10 +122,10 @@ } [Test] - public void Validate_ValidHydraulicBoundaryDatabaseWithoutSettings_LogsMessageAndReturnsFalse() + public void Validate_InvalidHydraulicBoundaryDatabase_LogsMessageAndReturnsFalse() { // Setup - string invalidFilePath = Path.Combine(testDataPath, "HRD nosettings.sqlite"); + string invalidFilePath = Path.Combine(testDataPath, "notexisting.sqlite"); var mockRepository = new MockRepository(); IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(new GrassCoverErosionInwardsFailureMechanism(), @@ -146,7 +143,7 @@ }; // Call - var isValid = false; + var isValid = true; void Call() => isValid = GrassCoverErosionInwardsCalculationService.Validate(calculation, assessmentSection); // Assert @@ -164,12 +161,15 @@ } [Test] - public void Validate_WithoutImportedHydraulicBoundaryDatabase_LogsMessageAndReturnsFalse() + public void Validate_HydraulicBoundaryDatabaseWithoutSettings_LogsMessageAndReturnsFalse() { // Setup + string invalidFilePath = Path.Combine(testDataPath, "HRD nosettings.sqlite"); + var mockRepository = new MockRepository(); IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(new GrassCoverErosionInwardsFailureMechanism(), - mockRepository); + mockRepository, + invalidFilePath); mockRepository.ReplayAll(); var calculation = new GrassCoverErosionInwardsCalculation @@ -191,7 +191,7 @@ string[] msgs = messages.ToArray(); Assert.AreEqual(3, msgs.Length); CalculationServiceTestHelper.AssertValidationStartMessage(msgs[0]); - Assert.AreEqual("Er is geen hydraulische belastingendatabase geïmporteerd.", msgs[1]); + StringAssert.StartsWith("Herstellen van de verbinding met de hydraulische belastingendatabase is mislukt. Fout bij het lezen van bestand", msgs[1]); CalculationServiceTestHelper.AssertValidationEndMessage(msgs[2]); }); Assert.IsFalse(isValid);