Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/Structures/StructuresCalculationServiceBaseTest.cs =================================================================== diff -u -r2e944cbf52d124fd501ed4ed8e991aa50299cc69 -r9a6b8bd8e680c7b847ad548bad1c5a8c2d33b143 --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/Structures/StructuresCalculationServiceBaseTest.cs (.../StructuresCalculationServiceBaseTest.cs) (revision 2e944cbf52d124fd501ed4ed8e991aa50299cc69) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/Structures/StructuresCalculationServiceBaseTest.cs (.../StructuresCalculationServiceBaseTest.cs) (revision 9a6b8bd8e680c7b847ad548bad1c5a8c2d33b143) @@ -597,7 +597,7 @@ } [Test] - public void Calculate_ValidInputButIllustrationPointResultsWithDuplicateStochasts_IllustrationPointsNotSetAndLogsWarning() + public void Calculate_CalculationRanErrorInSettingIllustrationPoints_GeneralResultNotSetAndLogsWarning() { // Setup var mocks = new MockRepository(); @@ -653,291 +653,6 @@ } [Test] - public void Calculate_ValidInputButIllustrationPointResultsWithIncorrectTopLevelStochasts_IllustrationPointsNotSetAndLogsWarning() - { - // Setup - var mocks = new MockRepository(); - var calculator = new TestStructuresCalculator - { - OutputDirectory = validFilePath, - IllustrationPointsResult = GeneralResultTestFactory.CreateGeneralResultFaultTreeWithIncorrectTopLevelStochasts() - }; - var calculatorFactory = mocks.StrictMock(); - calculatorFactory.Expect(cf => cf.CreateStructuresCalculator(testDataPath)) - .Return(calculator); - - const string performedCalculationMessage = "Calculation successful"; - 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 = true - } - }; - - using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) - { - var service = new TestStructuresCalculationService(messageProvider); - - // Call - Action call = () => service.Calculate(calculation, new GeneralTestInput(), 1, 1, 1, validFilePath); - - // Assert - TestHelper.AssertLogMessagesWithLevelAndLoggedExceptions(call, messages => - { - Tuple[] tupleArray = messages.ToArray(); - - string[] msgs = tupleArray.Select(tuple => tuple.Item1).ToArray(); - Assert.AreEqual(4, msgs.Length); - - CalculationServiceTestHelper.AssertCalculationStartMessage(msgs[0]); - Assert.AreEqual("Fout bij het uitlezen van de illustratiepunten voor berekening Nieuwe berekening: " + - "De stochasten van een illustratiepunt bevatten niet dezelfde stochasten als in de onderliggende illustratiepunten. " + - "Het uitlezen van illustratiepunten wordt overgeslagen.", msgs[1]); - Assert.AreEqual(performedCalculationMessage, msgs[2]); - CalculationServiceTestHelper.AssertCalculationEndMessage(msgs[3]); - }); - Assert.IsNotNull(calculation.Output); - Assert.IsFalse(calculation.Output.HasGeneralResult); - } - mocks.VerifyAll(); - } - - [Test] - public void Calculate_ValidInputButIllustrationPointResultsWithIncorrectStochastsInChildren_IllustrationPointsNotSetAndLogsWarning() - { - // Setup - var mocks = new MockRepository(); - var calculator = new TestStructuresCalculator - { - OutputDirectory = validFilePath, - IllustrationPointsResult = GeneralResultTestFactory.CreateGeneralResultWithIncorrectStochastsInChildren() - }; - var calculatorFactory = mocks.StrictMock(); - calculatorFactory.Expect(cf => cf.CreateStructuresCalculator(testDataPath)) - .Return(calculator); - - const string performedCalculationMessage = "Calculation successful"; - 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 = true - } - }; - - using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) - { - var service = new TestStructuresCalculationService(messageProvider); - - // Call - Action call = () => service.Calculate(calculation, new GeneralTestInput(), 1, 1, 1, validFilePath); - - // Assert - TestHelper.AssertLogMessagesWithLevelAndLoggedExceptions(call, messages => - { - Tuple[] tupleArray = messages.ToArray(); - - string[] msgs = tupleArray.Select(tuple => tuple.Item1).ToArray(); - Assert.AreEqual(4, msgs.Length); - - CalculationServiceTestHelper.AssertCalculationStartMessage(msgs[0]); - Assert.AreEqual("Fout bij het uitlezen van de illustratiepunten voor berekening Nieuwe berekening: " + - "De stochasten van een illustratiepunt bevatten niet dezelfde stochasten als in de onderliggende illustratiepunten. " + - "Het uitlezen van illustratiepunten wordt overgeslagen.", msgs[1]); - Assert.AreEqual(performedCalculationMessage, msgs[2]); - CalculationServiceTestHelper.AssertCalculationEndMessage(msgs[3]); - }); - Assert.IsNotNull(calculation.Output); - Assert.IsFalse(calculation.Output.HasGeneralResult); - } - mocks.VerifyAll(); - } - - [Test] - public void Calculate_ValidInputButIllustrationPointResultsWithDuplicateIllustrationPoints_IllustrationPointsNotSetAndLogsWarning() - { - // Setup - var mocks = new MockRepository(); - var calculator = new TestStructuresCalculator - { - OutputDirectory = validFilePath, - IllustrationPointsResult = GeneralResultTestFactory.CreateGeneralResultFaultTreeWithDuplicateIllustrationPoints() - }; - var calculatorFactory = mocks.StrictMock(); - calculatorFactory.Expect(cf => cf.CreateStructuresCalculator(testDataPath)) - .Return(calculator); - - const string performedCalculationMessage = "Calculation successful"; - 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 = true - } - }; - - using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) - { - var service = new TestStructuresCalculationService(messageProvider); - - // Call - Action call = () => service.Calculate(calculation, new GeneralTestInput(), 1, 1, 1, validFilePath); - - // Assert - TestHelper.AssertLogMessagesWithLevelAndLoggedExceptions(call, messages => - { - Tuple[] tupleArray = messages.ToArray(); - - string[] msgs = tupleArray.Select(tuple => tuple.Item1).ToArray(); - Assert.AreEqual(4, msgs.Length); - - CalculationServiceTestHelper.AssertCalculationStartMessage(msgs[0]); - Assert.AreEqual("Fout bij het uitlezen van de illustratiepunten voor berekening Nieuwe berekening: " + - "Een of meerdere illustratiepunten hebben dezelfde combinatie van sluitscenario en windrichting. " + - "Het uitlezen van illustratiepunten wordt overgeslagen.", msgs[1]); - Assert.AreEqual(performedCalculationMessage, msgs[2]); - CalculationServiceTestHelper.AssertCalculationEndMessage(msgs[3]); - }); - Assert.IsNotNull(calculation.Output); - Assert.IsFalse(calculation.Output.HasGeneralResult); - } - mocks.VerifyAll(); - } - - [Test] - public void Calculate_ValidInputButIllustrationPointResultsWithDuplicateIllustrationPointResults_IllustrationPointsNotSetAndLogsWarning() - { - // Setup - var mocks = new MockRepository(); - var calculator = new TestStructuresCalculator - { - OutputDirectory = validFilePath, - IllustrationPointsResult = GeneralResultTestFactory.CreateGeneralResultFaultTreeWithDuplicateIllustrationPointResults() - }; - var calculatorFactory = mocks.StrictMock(); - calculatorFactory.Expect(cf => cf.CreateStructuresCalculator(testDataPath)) - .Return(calculator); - - const string performedCalculationMessage = "Calculation successful"; - 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 = true - } - }; - - using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) - { - var service = new TestStructuresCalculationService(messageProvider); - - // Call - Action call = () => service.Calculate(calculation, new GeneralTestInput(), 1, 1, 1, validFilePath); - - // Assert - TestHelper.AssertLogMessagesWithLevelAndLoggedExceptions(call, messages => - { - Tuple[] tupleArray = messages.ToArray(); - - string[] msgs = tupleArray.Select(tuple => tuple.Item1).ToArray(); - Assert.AreEqual(4, msgs.Length); - - CalculationServiceTestHelper.AssertCalculationStartMessage(msgs[0]); - Assert.AreEqual("Fout bij het uitlezen van de illustratiepunten voor berekening Nieuwe berekening: " + - "Een of meerdere uitvoer variabelen hebben dezelfde naam. " + - "Het uitlezen van illustratiepunten wordt overgeslagen.", msgs[1]); - Assert.AreEqual(performedCalculationMessage, msgs[2]); - CalculationServiceTestHelper.AssertCalculationEndMessage(msgs[3]); - }); - Assert.IsNotNull(calculation.Output); - Assert.IsFalse(calculation.Output.HasGeneralResult); - } - mocks.VerifyAll(); - } - - [Test] - public void Calculate_ValidInputButIllustrationPointResultsWithDuplicateNamesInChildren_IllustrationPointsNotSetAndLogsWarning() - { - // Setup - var mocks = new MockRepository(); - var calculator = new TestStructuresCalculator - { - OutputDirectory = validFilePath, - IllustrationPointsResult = GeneralResultTestFactory.CreateGeneralResultWithDuplicateNamesInChildren() - }; - var calculatorFactory = mocks.StrictMock(); - calculatorFactory.Expect(cf => cf.CreateStructuresCalculator(testDataPath)) - .Return(calculator); - - const string performedCalculationMessage = "Calculation successful"; - 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 = true - } - }; - - using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) - { - var service = new TestStructuresCalculationService(messageProvider); - - // Call - Action call = () => service.Calculate(calculation, new GeneralTestInput(), 1, 1, 1, validFilePath); - - // Assert - TestHelper.AssertLogMessagesWithLevelAndLoggedExceptions(call, messages => - { - Tuple[] tupleArray = messages.ToArray(); - - string[] msgs = tupleArray.Select(tuple => tuple.Item1).ToArray(); - Assert.AreEqual(4, msgs.Length); - - CalculationServiceTestHelper.AssertCalculationStartMessage(msgs[0]); - Assert.AreEqual("Fout bij het uitlezen van de illustratiepunten voor berekening Nieuwe berekening: " + - "Een of meerdere illustratiepunten bevatten illustratiepunten met dezelfde naam. " + - "Het uitlezen van illustratiepunten wordt overgeslagen.", msgs[1]); - Assert.AreEqual(performedCalculationMessage, msgs[2]); - CalculationServiceTestHelper.AssertCalculationEndMessage(msgs[3]); - }); - Assert.IsNotNull(calculation.Output); - Assert.IsFalse(calculation.Output.HasGeneralResult); - } - mocks.VerifyAll(); - } - - [Test] public void Calculate_CancelCalculationWithValidInput_CancelsCalculatorAndHasNullOutput() { // Setup