Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/MacroStabilityInwardsCalculationServiceTest.cs =================================================================== diff -u -rf89803f0c1c7d98c1b9f99bf1ab96280e569cf33 -rbf3867a5c8ba43b554015933b613cda908734735 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/MacroStabilityInwardsCalculationServiceTest.cs (.../MacroStabilityInwardsCalculationServiceTest.cs) (revision f89803f0c1c7d98c1b9f99bf1ab96280e569cf33) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/MacroStabilityInwardsCalculationServiceTest.cs (.../MacroStabilityInwardsCalculationServiceTest.cs) (revision bf3867a5c8ba43b554015933b613cda908734735) @@ -502,23 +502,36 @@ CalculationServiceTestHelper.AssertCalculationEndMessage(messages[2].Item1); }); + Assert.IsTrue(exceptionThrown); Assert.IsNull(testCalculation.Output); } } [Test] - public void Calculate_KernelReturnsCalculationErrors_LogAggregatedErrorMessageAndReturnFalse() + public void Calculate_KernelReturnsCalculationErrors_LogAggregatedErrorMessageAndThrowException() { // Setup using (new MacroStabilityInwardsCalculatorFactoryConfig()) { var calculator = (TestMacroStabilityInwardsCalculatorFactory) MacroStabilityInwardsCalculatorFactory.Instance; calculator.LastCreatedUpliftVanCalculator.ReturnCalculationError = true; + var exceptionThrown = false; + // Call - Action call = () => MacroStabilityInwardsCalculationService.Calculate(testCalculation, - AssessmentSectionHelper.GetTestAssessmentLevel()); + Action call = () => + { + try + { + MacroStabilityInwardsCalculationService.Calculate(testCalculation, + AssessmentSectionHelper.GetTestAssessmentLevel()); + } + catch (UpliftVanCalculatorException) + { + exceptionThrown = true; + } + }; // Assert TestHelper.AssertLogMessagesWithLevelAndLoggedExceptions(call, messages => @@ -540,11 +553,14 @@ Assert.AreEqual(Level.Error, tupleArray[1].Item2); }); + + Assert.IsTrue(exceptionThrown); + Assert.IsNull(testCalculation.Output); } } [Test] - public void Calculate_KernelReturnsCalculationWarnings_LogAggregatedWarningMessageAndReturnTrue() + public void Calculate_KernelReturnsCalculationWarnings_LogAggregatedWarningMessageAndSetOutput() { // Setup using (new MacroStabilityInwardsCalculatorFactoryConfig()) @@ -577,10 +593,12 @@ Assert.AreEqual(Level.Warn, tupleArray[1].Item2); }); } + + Assert.IsNotNull(testCalculation.Output); } [Test] - public void Calculate_KernelReturnsCalculationErrorsAndWarnings_LogAggregatedErrorMessageAndReturnFalse() + public void Calculate_KernelReturnsCalculationErrorsAndWarnings_LogAggregatedErrorMessageAndThrowException() { // Setup using (new MacroStabilityInwardsCalculatorFactoryConfig()) @@ -589,9 +607,21 @@ calculator.LastCreatedUpliftVanCalculator.ReturnCalculationWarning = true; calculator.LastCreatedUpliftVanCalculator.ReturnCalculationError = true; + var exceptionThrown = false; + // Call - Action call = () => MacroStabilityInwardsCalculationService.Calculate(testCalculation, - AssessmentSectionHelper.GetTestAssessmentLevel()); + Action call = () => + { + try + { + MacroStabilityInwardsCalculationService.Calculate(testCalculation, + AssessmentSectionHelper.GetTestAssessmentLevel()); + } + catch (UpliftVanCalculatorException) + { + exceptionThrown = true; + } + }; // Assert TestHelper.AssertLogMessagesWithLevelAndLoggedExceptions(call, messages => @@ -617,6 +647,9 @@ Assert.AreEqual(Level.Error, tupleArray[1].Item2); }); + + Assert.IsTrue(exceptionThrown); + Assert.IsNull(testCalculation.Output); } }