Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingPlugin.cs =================================================================== diff -u -r8e76b131cb428f9af9910a8a309c90ae315b3c99 -r3f9fb75bb98fcc5a336f6df2870b611c41239b89 --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingPlugin.cs (.../PipingPlugin.cs) (revision 8e76b131cb428f9af9910a8a309c90ae315b3c99) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingPlugin.cs (.../PipingPlugin.cs) (revision 3f9fb75bb98fcc5a336f6df2870b611c41239b89) @@ -817,8 +817,7 @@ private void UpdatedSurfaceLineDependentDataOfCalculation(PipingCalculation scenario) { - string message = - Resources.PipingPlugin_VerifyEntryAndExitPointUpdates_Confirm_calculation_output_cleared_when_updating_entry_and_exit_points_definitions; + string message = RingtoetsCommonFormsResources.VerifyUpdate_Confirm_calculation_output_cleared; if (VerifyEntryAndExitPointUpdates(new[] { scenario Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/Properties/Resources.Designer.cs =================================================================== diff -u -rf8732f8bbec8b197d9bc91e91d27e0c9d20b4ed3 -r3f9fb75bb98fcc5a336f6df2870b611c41239b89 --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision f8732f8bbec8b197d9bc91e91d27e0c9d20b4ed3) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 3f9fb75bb98fcc5a336f6df2870b611c41239b89) @@ -130,18 +130,6 @@ } /// - /// Looks up a localized string similar to Wanneer het intrede- of uittredepunt wijzigt als gevolg van het bijwerken, zal het resultaat van deze berekening worden verwijderd. - /// - ///Weet u zeker dat u wilt doorgaan?. - /// - public static string PipingPlugin_VerifyEntryAndExitPointUpdates_Confirm_calculation_output_cleared_when_updating_entry_and_exit_points_definitions { - get { - return ResourceManager.GetString("PipingPlugin_VerifyEntryAndExitPointUpdates_Confirm_calculation_output_cleared_wh" + - "en_updating_entry_and_exit_points_definitions", resourceCulture); - } - } - - /// /// Looks up a localized string similar to Wanneer de intrede- of uittredepunten wijzigen als gevolg van het bijwerken, zullen de resultaten van berekeningen die deze profielschematisaties gebruiken, worden verwijderd. /// ///Weet u zeker dat u wilt doorgaan?. Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/Properties/Resources.resx =================================================================== diff -u -rf8732f8bbec8b197d9bc91e91d27e0c9d20b4ed3 -r3f9fb75bb98fcc5a336f6df2870b611c41239b89 --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/Properties/Resources.resx (.../Resources.resx) (revision f8732f8bbec8b197d9bc91e91d27e0c9d20b4ed3) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/Properties/Resources.resx (.../Resources.resx) (revision 3f9fb75bb98fcc5a336f6df2870b611c41239b89) @@ -222,11 +222,6 @@ Weet u zeker dat u wilt doorgaan? - - Wanneer het intrede- of uittredepunt wijzigt als gevolg van het bijwerken, zal het resultaat van deze berekening worden verwijderd. - -Weet u zeker dat u wilt doorgaan? - Als u profielschematisaties importeert, dan worden alle rekenresultaten van dit toetsspoor verwijderd. Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/PipingCalculationScenarioContextTreeNodeInfoTest.cs =================================================================== diff -u -r8e76b131cb428f9af9910a8a309c90ae315b3c99 -r3f9fb75bb98fcc5a336f6df2870b611c41239b89 --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/PipingCalculationScenarioContextTreeNodeInfoTest.cs (.../PipingCalculationScenarioContextTreeNodeInfoTest.cs) (revision 8e76b131cb428f9af9910a8a309c90ae315b3c99) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/PipingCalculationScenarioContextTreeNodeInfoTest.cs (.../PipingCalculationScenarioContextTreeNodeInfoTest.cs) (revision 3f9fb75bb98fcc5a336f6df2870b611c41239b89) @@ -508,7 +508,7 @@ plugin.Gui = gui; - UpdateSurfaceLine(surfaceLine); + ChangeSurfaceLine(surfaceLine); // Call using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) @@ -524,7 +524,7 @@ } [Test] - public void GivenCalculationWithSurfaceLineWithoutOutput_WhenEntryAndExitPointUpdatedAndUpdateEntryAndExitPointClicked_ThenNoInquiryAndPointsUpdatedAndInputObserverNotified() + public void GivenCalculationWithSurfaceLineWithoutOutput_WhenSurfaceLineChangedAndUpdateClicked_ThenNoInquiryAndPointsUpdatedAndObserversNotified() { using (var treeViewControl = new TreeViewControl()) { @@ -556,27 +556,24 @@ plugin.Gui = gui; + ChangeSurfaceLine(surfaceLine); + using (ContextMenuStrip contextMenuStrip = info.ContextMenuStrip(nodeData, null, treeViewControl)) { // When - UpdateSurfaceLine(surfaceLine); - contextMenuStrip.Items[contextMenuUpdateEntryAndExitPointIndex].PerformClick(); // Then - PipingInput inputParameters = calculation.InputParameters; - Assert.AreSame(surfaceLine, inputParameters.SurfaceLine); - Assert.AreEqual(new RoundedDouble(2, 2), inputParameters.EntryPointL); - Assert.AreEqual(new RoundedDouble(3, 3), inputParameters.ExitPointL); Assert.IsFalse(calculation.HasOutput); + Assert.IsTrue(calculation.InputParameters.IsEntryAndExitPointInputSynchronized); // Note: observer assertions are verified in TearDown } } } [Test] - public void GivenCalculationWithSurfaceLineAndOutput_WhenEntryAndExitPointsUpdatedAndUpdateEntryAndExitPointClickedAndContinued_ThenPointsUpdatedOutputsRemovedAndObserversNotified() + public void GivenCalculationWithSurfaceLineAndOutput_WhenSurfaceLineChangedAndUpdateClickedAndContinued_ThenPointsUpdatedOutputsRemovedAndObserversNotified() { using (var treeViewControl = new TreeViewControl()) { @@ -618,22 +615,18 @@ helper.ClickOk(); }; + ChangeSurfaceLine(surfaceLine); + using (ContextMenuStrip contextMenuStrip = info.ContextMenuStrip(nodeData, null, treeViewControl)) { // When - UpdateSurfaceLine(surfaceLine); - contextMenuStrip.Items[contextMenuUpdateEntryAndExitPointIndex].PerformClick(); // Then - PipingInput inputParameters = calculation.InputParameters; - Assert.AreSame(surfaceLine, inputParameters.SurfaceLine); - Assert.AreEqual(new RoundedDouble(2, 2), inputParameters.EntryPointL); - Assert.AreEqual(new RoundedDouble(3, 3), inputParameters.ExitPointL); Assert.IsFalse(calculation.HasOutput); + Assert.IsTrue(calculation.InputParameters.IsEntryAndExitPointInputSynchronized); - string expectedMessage = "Wanneer het intrede- of uittredepunt wijzigt als gevolg van het bijwerken, " + - "zal het resultaat van deze berekening worden " + + string expectedMessage = "Als u kiest voor bijwerken, dan wordt het resultaat van deze berekening " + $"verwijderd.{Environment.NewLine}{Environment.NewLine}Weet u zeker dat u wilt doorgaan?"; Assert.AreEqual(expectedMessage, textBoxMessage); @@ -643,88 +636,11 @@ } [Test] - public void GivenCalculationWithSurfaceLineAndOutput_WhenUpdatedEntryAndExitPointsHasNoChangeAndUpdateEntryAndExitPointClickedAndContinued_ThenOutputNotRemovedAndObserversNotNotified() + public void GivenCalculationWithSurfaceLineAndOutput_WhenSurfaceLineChangedAndUpdateClickedAndCancelled_ThenCalculationNotUpdatedAndObserversNotUpdated() { using (var treeViewControl = new TreeViewControl()) { // Given - var surfaceLine = new RingtoetsPipingSurfaceLine(); - surfaceLine.SetGeometry(new[] - { - new Point3D(1, 2, 3), - new Point3D(4, 5, 6) - }); - var calculation = new PipingCalculationScenario(new GeneralPipingInput()) - { - InputParameters = - { - SurfaceLine = surfaceLine, - EntryPointL = (RoundedDouble) 2, - ExitPointL = (RoundedDouble) 3 - }, - Output = new TestPipingOutput() - }; - - var pipingFailureMechanism = new TestPipingFailureMechanism(); - var assessmentSection = mocks.Stub(); - var nodeData = new PipingCalculationScenarioContext(calculation, - Enumerable.Empty(), - Enumerable.Empty(), - pipingFailureMechanism, - assessmentSection); - - var inputObserver = mocks.StrictMock(); - calculation.InputParameters.Attach(inputObserver); - - var calculationObserver = mocks.StrictMock(); - calculation.Attach(calculationObserver); - - var mainWindow = mocks.Stub(); - var gui = mocks.Stub(); - gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); - gui.Stub(g => g.MainWindow).Return(mainWindow); - mocks.ReplayAll(); - - plugin.Gui = gui; - - string textBoxMessage = null; - DialogBoxHandler = (name, wnd) => - { - var helper = new MessageBoxTester(wnd); - textBoxMessage = helper.Text; - helper.ClickOk(); - }; - - using (ContextMenuStrip contextMenuStrip = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // When - UpdateSurfaceLine(surfaceLine); - - contextMenuStrip.Items[contextMenuUpdateEntryAndExitPointIndex].PerformClick(); - - // Then - PipingInput inputParameters = calculation.InputParameters; - Assert.AreSame(surfaceLine, inputParameters.SurfaceLine); - Assert.AreEqual(new RoundedDouble(2, 2), inputParameters.EntryPointL); - Assert.AreEqual(new RoundedDouble(3, 3), inputParameters.ExitPointL); - Assert.IsTrue(calculation.HasOutput); - - string expectedMessage = "Wanneer het intrede- of uittredepunt wijzigt als gevolg van het bijwerken, " + - "zal het resultaat van deze berekening worden " + - $"verwijderd.{Environment.NewLine}{Environment.NewLine}Weet u zeker dat u wilt doorgaan?"; - Assert.AreEqual(expectedMessage, textBoxMessage); - - // Note: observer assertions are verified in TearDown - } - } - } - - [Test] - public void GivenCalculationWithSurfaceLineAndOutput_WhenEntryAndExitPointsUpdatedAndUpdateEntryAndExitPointClickedAndDiscontinued_ThenCalculationNotUpdatedAndObserversNotUpdated() - { - using (var treeViewControl = new TreeViewControl()) - { - // Given RingtoetsPipingSurfaceLine surfaceLine; PipingCalculationScenario calculation; CreateCalculationWithSurfaceLine(out calculation, out surfaceLine); @@ -760,22 +676,18 @@ helper.ClickCancel(); }; + ChangeSurfaceLine(surfaceLine); + using (ContextMenuStrip contextMenuStrip = info.ContextMenuStrip(nodeData, null, treeViewControl)) { // When - UpdateSurfaceLine(surfaceLine); - contextMenuStrip.Items[contextMenuUpdateEntryAndExitPointIndex].PerformClick(); // Then - PipingInput inputParameters = calculation.InputParameters; - Assert.AreSame(surfaceLine, inputParameters.SurfaceLine); - Assert.AreEqual(new RoundedDouble(2, 0), inputParameters.EntryPointL); - Assert.AreEqual(new RoundedDouble(3, 1), inputParameters.ExitPointL); Assert.IsTrue(calculation.HasOutput); + Assert.IsFalse(calculation.InputParameters.IsEntryAndExitPointInputSynchronized); - string expectedMessage = "Wanneer het intrede- of uittredepunt wijzigt als gevolg van het bijwerken, " + - "zal het resultaat van deze berekening worden " + + string expectedMessage = "Als u kiest voor bijwerken, dan wordt het resultaat van deze berekening " + $"verwijderd.{Environment.NewLine}{Environment.NewLine}Weet u zeker dat u wilt doorgaan?"; Assert.AreEqual(expectedMessage, textBoxMessage); @@ -1120,7 +1032,7 @@ } } - private static void UpdateSurfaceLine(RingtoetsPipingSurfaceLine surfaceLine) + private static void ChangeSurfaceLine(RingtoetsPipingSurfaceLine surfaceLine) { surfaceLine.SetGeometry(new[] { @@ -1135,7 +1047,7 @@ surfaceLine.SetDikeToeAtPolderAt(new Point3D(3, 0, 0)); } - private void CreateCalculationWithSurfaceLine(out PipingCalculationScenario calculation, out RingtoetsPipingSurfaceLine surfaceLine) + private static void CreateCalculationWithSurfaceLine(out PipingCalculationScenario calculation, out RingtoetsPipingSurfaceLine surfaceLine) { surfaceLine = new RingtoetsPipingSurfaceLine(); surfaceLine.SetGeometry(new[]