Index: Riskeer/Common/test/Riskeer.Common.Service.Test/Structures/StructuresCalculationServiceBaseTest.cs =================================================================== diff -u -rdba68d66079b1bb5335abc97cc6badafbd837d59 -r1f60dd6a93c28f0d2fe299239c7b3d6f90c86e03 --- Riskeer/Common/test/Riskeer.Common.Service.Test/Structures/StructuresCalculationServiceBaseTest.cs (.../StructuresCalculationServiceBaseTest.cs) (revision dba68d66079b1bb5335abc97cc6badafbd837d59) +++ Riskeer/Common/test/Riskeer.Common.Service.Test/Structures/StructuresCalculationServiceBaseTest.cs (.../StructuresCalculationServiceBaseTest.cs) (revision 1f60dd6a93c28f0d2fe299239c7b3d6f90c86e03) @@ -93,24 +93,23 @@ } [Test] - public void Validate_ValidCalculationInvalidHydraulicBoundaryDatabase_LogsErrorAndReturnsFalse() + public void Validate_CalculationWithoutHydraulicBoundaryLocation_LogsErrorAndReturnsFalse() { // Setup var mocks = new MockRepository(); IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(new TestCalculatableFailureMechanism(), - mocks, - Path.Combine(testDataPath, "notexisting.sqlite")); + mocks); mocks.ReplayAll(); var calculation = new TestStructuresCalculation { InputParameters = { - HydraulicBoundaryLocation = new TestHydraulicBoundaryLocation() + Structure = new TestStructure() } }; - var isValid = true; + var isValid = false; // Call void Call() => isValid = TestStructuresCalculationService.Validate(calculation, assessmentSection); @@ -121,8 +120,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 belastingenlocatie geselecteerd.", msgs[1]); CalculationServiceTestHelper.AssertValidationEndMessage(msgs[2]); }); Assert.IsFalse(isValid); @@ -131,13 +129,12 @@ } [Test] - public void Validate_ValidCalculationValidHydraulicBoundaryDatabaseNoSettings_LogsErrorAndReturnsFalse() + public void Validate_NoHydraulicBoundaryDatabase_LogsErrorAndReturnsFalse() { // Setup var mocks = new MockRepository(); IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(new TestCalculatableFailureMechanism(), - mocks, - Path.Combine(testDataPath, "HRD nosettings.sqlite")); + mocks); mocks.ReplayAll(); var calculation = new TestStructuresCalculation @@ -159,8 +156,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); @@ -169,12 +165,13 @@ } [Test] - public void Validate_WithoutImportedHydraulicBoundaryDatabase_LogsErrorAndReturnsFalse() + public void Validate_InvalidHydraulicBoundaryDatabase_LogsErrorAndReturnsFalse() { // Setup var mocks = new MockRepository(); IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(new TestCalculatableFailureMechanism(), - mocks); + mocks, + Path.Combine(testDataPath, "notexisting.sqlite")); mocks.ReplayAll(); var calculation = new TestStructuresCalculation @@ -185,7 +182,7 @@ } }; - var isValid = false; + var isValid = true; // Call void Call() => isValid = TestStructuresCalculationService.Validate(calculation, assessmentSection); @@ -196,7 +193,8 @@ 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); @@ -205,20 +203,20 @@ } [Test] - public void Validate_CalculationInputWithoutHydraulicBoundaryLocationValidHydraulicBoundaryDatabase_LogsErrorAndReturnsFalse() + public void Validate_HydraulicBoundaryDatabaseWithoutSettings_LogsErrorAndReturnsFalse() { // Setup var mocks = new MockRepository(); IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(new TestCalculatableFailureMechanism(), mocks, - validHrdFilePath); + Path.Combine(testDataPath, "HRD nosettings.sqlite")); mocks.ReplayAll(); var calculation = new TestStructuresCalculation { InputParameters = { - Structure = new TestStructure() + HydraulicBoundaryLocation = new TestHydraulicBoundaryLocation() } }; @@ -233,7 +231,8 @@ string[] msgs = messages.ToArray(); Assert.AreEqual(3, msgs.Length); CalculationServiceTestHelper.AssertValidationStartMessage(msgs[0]); - Assert.AreEqual("Er is geen hydraulische belastingenlocatie geselecteerd.", 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); @@ -242,7 +241,7 @@ } [Test] - public void Validate_CalculationWithoutStructuresValidHydraulicBoundaryDatabase_LogsErrorAndReturnsFalse() + public void Validate_CalculationWithoutStructures_LogsErrorAndReturnsFalse() { // Setup var failureMechanism = new TestCalculatableFailureMechanism();