Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Integration.Test/ClosingStructuresCalculationActivityIntegrationTest.cs =================================================================== diff -u -r4f6a54b97b4102b79fa75d8eb087321a9e6975a2 -r6ccbad472d5ea7881e999691a59a204e072f7c7d --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Integration.Test/ClosingStructuresCalculationActivityIntegrationTest.cs (.../ClosingStructuresCalculationActivityIntegrationTest.cs) (revision 4f6a54b97b4102b79fa75d8eb087321a9e6975a2) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Integration.Test/ClosingStructuresCalculationActivityIntegrationTest.cs (.../ClosingStructuresCalculationActivityIntegrationTest.cs) (revision 6ccbad472d5ea7881e999691a59a204e072f7c7d) @@ -375,7 +375,10 @@ var activity = new ClosingStructuresCalculationActivity(calculation, testDataPath, failureMechanism, assessmentSection); - activity.Run(); + using (new HydraRingCalculatorFactoryConfig()) + { + activity.Run(); + } // Call activity.Finish(); Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/ClosingStructuresCalculationServiceTest.cs =================================================================== diff -u -ra5c4c7f5d662747b036b9059332120d89ae698af -r6ccbad472d5ea7881e999691a59a204e072f7c7d --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/ClosingStructuresCalculationServiceTest.cs (.../ClosingStructuresCalculationServiceTest.cs) (revision a5c4c7f5d662747b036b9059332120d89ae698af) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/ClosingStructuresCalculationServiceTest.cs (.../ClosingStructuresCalculationServiceTest.cs) (revision 6ccbad472d5ea7881e999691a59a204e072f7c7d) @@ -419,6 +419,52 @@ } [Test] + [Combinatorial] + public void Validate_UsesBreakWaterAndHasInvalidBreakWaterSettings_ReturnsFalse( + [Values(ClosingStructureInflowModelType.VerticalWall, ClosingStructureInflowModelType.LowSill, ClosingStructureInflowModelType.FloodedCulvert)] ClosingStructureInflowModelType inflowModelType, + [Values(double.NaN, double.NegativeInfinity, double.PositiveInfinity)] double breakWaterHeight) + { + // Setup + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(new ClosingStructuresFailureMechanism(), mockRepository); + mockRepository.ReplayAll(); + + assessmentSectionStub.HydraulicBoundaryDatabase.FilePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite"); + + const string name = ""; + + var calculation = new TestClosingStructuresCalculation + { + Name = name, + InputParameters = + { + InflowModelType = inflowModelType, + HydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "name", 2, 2), + ForeshoreProfile = new TestForeshoreProfile(new BreakWater(BreakWaterType.Dam, breakWaterHeight)), + UseBreakWater = true + } + }; + + bool isValid = false; + + // Call + Action call = () => isValid = ClosingStructuresCalculationService.Validate(calculation, assessmentSectionStub); + + // Assert + TestHelper.AssertLogMessages(call, messages => + { + var msgs = messages.ToArray(); + Assert.AreEqual(3, msgs.Length); + StringAssert.StartsWith(string.Format("Validatie van '{0}' gestart om: ", name), msgs[0]); + StringAssert.StartsWith("Validatie mislukt: Er is geen geldige damhoogte ingevoerd.", msgs[1]); + StringAssert.StartsWith(string.Format("Validatie van '{0}' beƫindigd om: ", name), msgs[2]); + }); + Assert.IsFalse(isValid); + + mockRepository.VerifyAll(); + } + + [Test] public void Calculate_InvalidInFlowModelType_ThrowsInvalidEnumArgumentException() { // Setup @@ -467,52 +513,6 @@ } [Test] - [Combinatorial] - public void Validate_UsesBreakWaterAndHasInvalidBreakWaterSettings_ReturnsFalse( - [Values(ClosingStructureInflowModelType.VerticalWall, ClosingStructureInflowModelType.LowSill, ClosingStructureInflowModelType.FloodedCulvert)] ClosingStructureInflowModelType inflowModelType, - [Values(double.NaN, double.NegativeInfinity, double.PositiveInfinity)] double breakWaterHeight) - { - // Setup - var mockRepository = new MockRepository(); - IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(new ClosingStructuresFailureMechanism(), mockRepository); - mockRepository.ReplayAll(); - - assessmentSectionStub.HydraulicBoundaryDatabase.FilePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite"); - - const string name = ""; - - var calculation = new TestClosingStructuresCalculation - { - Name = name, - InputParameters = - { - InflowModelType = inflowModelType, - HydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "name", 2, 2), - ForeshoreProfile = new TestForeshoreProfile(new BreakWater(BreakWaterType.Dam, breakWaterHeight)), - UseBreakWater = true - } - }; - - bool isValid = false; - - // Call - Action call = () => isValid = ClosingStructuresCalculationService.Validate(calculation, assessmentSectionStub); - - // Assert - TestHelper.AssertLogMessages(call, messages => - { - var msgs = messages.ToArray(); - Assert.AreEqual(3, msgs.Length); - StringAssert.StartsWith(string.Format("Validatie van '{0}' gestart om: ", name), msgs[0]); - StringAssert.StartsWith("Validatie mislukt: Er is geen geldige damhoogte ingevoerd.", msgs[1]); - StringAssert.StartsWith(string.Format("Validatie van '{0}' beƫindigd om: ", name), msgs[2]); - }); - Assert.IsFalse(isValid); - - mockRepository.VerifyAll(); - } - - [Test] [TestCase(true, false)] [TestCase(true, true)] [TestCase(false, false)]