Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Integration.Test/HeightStructuresCalculationServiceIntegrationTest.cs =================================================================== diff -u -rf27092df1f897798c4a0b24f6fc91f49c9f294ce -rb2306061789f5e34a6f0994552b4431d01d220f0 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Integration.Test/HeightStructuresCalculationServiceIntegrationTest.cs (.../HeightStructuresCalculationServiceIntegrationTest.cs) (revision f27092df1f897798c4a0b24f6fc91f49c9f294ce) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Integration.Test/HeightStructuresCalculationServiceIntegrationTest.cs (.../HeightStructuresCalculationServiceIntegrationTest.cs) (revision b2306061789f5e34a6f0994552b4431d01d220f0) @@ -57,7 +57,7 @@ // Call bool isValid = false; - Action call = () => isValid = HeightStructuresCalculationService.Validate(calculation, assessmentSection); + Action call = () => isValid = new HeightStructuresCalculationService().Validate(calculation, assessmentSection); // Assert TestHelper.AssertLogMessages(call, messages => @@ -96,7 +96,7 @@ // Call bool isValid = false; - Action call = () => isValid = HeightStructuresCalculationService.Validate(calculation, assessmentSection); + Action call = () => isValid = new HeightStructuresCalculationService().Validate(calculation, assessmentSection); // Assert TestHelper.AssertLogMessages(call, messages => @@ -130,7 +130,7 @@ // Call bool isValid = false; - Action call = () => isValid = HeightStructuresCalculationService.Validate(calculation, assessmentSection); + Action call = () => isValid = new HeightStructuresCalculationService().Validate(calculation, assessmentSection); // Assert TestHelper.AssertLogMessages(call, messages => @@ -165,25 +165,29 @@ }; var failureMechanismSection = assessmentSection.HeightStructures.Sections.First(); - ExceedanceProbabilityCalculationOutput output = null; // Call - Action call = () => output = HeightStructuresCalculationService.Calculate(calculation, testDataPath, failureMechanismSection, failureMechanismSection.Name, assessmentSection.HeightStructures.GeneralInput); + Action call = () => new HeightStructuresCalculationService().Calculate(calculation, + assessmentSection, + failureMechanismSection, + assessmentSection.HeightStructures.GeneralInput, + assessmentSection.HeightStructures.Contribution, + testDataPath); // Assert TestHelper.AssertLogMessages(call, messages => { var msgs = messages.ToArray(); Assert.AreEqual(3, msgs.Length); StringAssert.StartsWith(string.Format("Berekening van '{0}' gestart om: ", calculation.Name), msgs[0]); - StringAssert.StartsWith("Hydra-Ring berekeningsverslag. Klik op details voor meer informatie.", msgs[1]); + StringAssert.StartsWith("Hoogte kunstwerken berekeningsverslag. Klik op details voor meer informatie.", msgs[1]); StringAssert.StartsWith(string.Format("Berekening van '{0}' beƫindigd om: ", calculation.Name), msgs[2]); }); - Assert.IsNotNull(output); + Assert.IsNotNull(calculation.Output); } [Test] - public void Calculate_InvalidCalculation_LogStartAndEndAndErrorMessageAndReturnNull() + public void Calculate_InvalidCalculation_LogStartAndEndAndErrorMessageAndThrowsException() { // Setup var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); @@ -204,22 +208,38 @@ }; var failureMechanismSection = assessmentSection.HeightStructures.Sections.First(); - ExceedanceProbabilityCalculationOutput output = null; + var exception = false; // Call - Action call = () => output = HeightStructuresCalculationService.Calculate(calculation, testDataPath, failureMechanismSection, failureMechanismSection.Name, assessmentSection.HeightStructures.GeneralInput); + Action call = () => + { + try + { + new HeightStructuresCalculationService().Calculate(calculation, + assessmentSection, + failureMechanismSection, + assessmentSection.HeightStructures.GeneralInput, + assessmentSection.HeightStructures.Contribution, + testDataPath); + } + catch + { + exception = true; + } + }; // Assert TestHelper.AssertLogMessages(call, messages => { var msgs = messages.ToArray(); Assert.AreEqual(4, msgs.Length); StringAssert.StartsWith(string.Format("Berekening van '{0}' gestart om: ", calculation.Name), msgs[0]); - StringAssert.StartsWith("Hydra-Ring berekeningsverslag. Klik op details voor meer informatie.", msgs[1]); - StringAssert.StartsWith(string.Format("De berekening voor hoogte kunstwerk '{0}' is niet gelukt.", calculation.Name), msgs[2]); + StringAssert.StartsWith(string.Format("De berekening voor hoogte kunstwerk '{0}' is niet gelukt.", calculation.Name), msgs[1]); + StringAssert.StartsWith("Hoogte kunstwerken berekeningsverslag. Klik op details voor meer informatie.", msgs[2]); StringAssert.StartsWith(string.Format("Berekening van '{0}' beƫindigd om: ", calculation.Name), msgs[3]); }); - Assert.IsNull(output); + Assert.IsNull(calculation.Output); + Assert.IsTrue(exception); } private void ImportHydraulicBoundaryDatabase(AssessmentSection assessmentSection)