Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/Structures/StructuresCalculationServiceBaseTest.cs =================================================================== diff -u -r9eebc429ea44944d1a010e4f6b28dc4d9c20772f -r470f6846d3dcd6f759a48d838cee8d1b9bbdeac7 --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/Structures/StructuresCalculationServiceBaseTest.cs (.../StructuresCalculationServiceBaseTest.cs) (revision 9eebc429ea44944d1a010e4f6b28dc4d9c20772f) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/Structures/StructuresCalculationServiceBaseTest.cs (.../StructuresCalculationServiceBaseTest.cs) (revision 470f6846d3dcd6f759a48d838cee8d1b9bbdeac7) @@ -434,13 +434,15 @@ } [Test] - public void Calculate_ValidInputButIllustrationPointsNull_IllustrationPointsNotSet() + public void Calculate_ValidInputButIllustrationPointsNull_IllustrationPointsNotSetAndLogs() { // Setup + const string parserMessage = "Parser error"; var mocks = new MockRepository(); var calculator = new TestStructuresCalculator { - OutputDirectory = validFilePath + OutputDirectory = validFilePath, + IllustrationPointsParserErrorMessage = parserMessage }; var calculatorFactory = mocks.StrictMock(); calculatorFactory.Expect(cf => cf.CreateStructuresCalculator(testDataPath)) @@ -472,6 +474,59 @@ TestHelper.AssertLogMessages(call, messages => { string[] msgs = messages.ToArray(); + Assert.AreEqual(4, msgs.Length); + + CalculationServiceTestHelper.AssertCalculationStartMessage(msgs[0]); + Assert.AreEqual(parserMessage, msgs[1]); + Assert.AreEqual(performedCalculationMessage, msgs[2]); + CalculationServiceTestHelper.AssertCalculationEndMessage(msgs[3]); + }); + Assert.IsNotNull(calculation.Output); + Assert.IsFalse(calculation.Output.HasIllustrationPoints); + } + mocks.VerifyAll(); + } + + [Test] + public void Calculate_ValidInputCalculateIllustrationPointsFalseAndIllustrationPointsParserErrorMessageNotNull_DoesNotLog() + { + // Setup + var mocks = new MockRepository(); + var calculator = new TestStructuresCalculator + { + OutputDirectory = validFilePath, + IllustrationPointsParserErrorMessage = "Parser error" + }; + var calculatorFactory = mocks.StrictMock(); + calculatorFactory.Expect(cf => cf.CreateStructuresCalculator(testDataPath)) + .Return(calculator); + + const string performedCalculationMessage = "Calculation succesful"; + var messageProvider = mocks.StrictMock(); + messageProvider.Expect(mp => mp.GetCalculationPerformedMessage(validFilePath)).Return(performedCalculationMessage); + mocks.ReplayAll(); + + var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(); + var calculation = new TestStructuresCalculation + { + InputParameters = + { + HydraulicBoundaryLocation = hydraulicBoundaryLocation, + ShouldIllustrationPointsBeCalculated = false + } + }; + + using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) + { + var service = new TestStructuresCalculationService(messageProvider); + + // Call + Action call = () => service.Calculate(calculation, new GeneralTestInput(), 1, 1, 1, validFilePath); + + // Assert + TestHelper.AssertLogMessages(call, messages => + { + string[] msgs = messages.ToArray(); Assert.AreEqual(3, msgs.Length); CalculationServiceTestHelper.AssertCalculationStartMessage(msgs[0]);