Index: Core/Common/test/Core.Common.Controls.TreeView.Test/TreeViewControlTest.cs =================================================================== diff -u -r851a4fd176950c1d9fae55847218fe1e0e715012 -re8b38c279ab010c360bd6589c8600e9cf387b11f --- Core/Common/test/Core.Common.Controls.TreeView.Test/TreeViewControlTest.cs (.../TreeViewControlTest.cs) (revision 851a4fd176950c1d9fae55847218fe1e0e715012) +++ Core/Common/test/Core.Common.Controls.TreeView.Test/TreeViewControlTest.cs (.../TreeViewControlTest.cs) (revision e8b38c279ab010c360bd6589c8600e9cf387b11f) @@ -253,21 +253,22 @@ treeViewControl.Data = dataObject; treeViewControl.NodeUpdated += (s, e) => hit++; - // Call - Action test = () => - { - treeViewControl.TryRenameNodeForData(dataObject); - }; - - // Assert + string messageBoxText = null; DialogBoxHandler = (name, wnd) => { var helper = new MessageBoxTester(wnd); - Assert.AreEqual(Properties.Resources.TreeViewControl_The_selected_item_cannot_be_renamed, helper.Text); + + messageBoxText = helper.Text; + helper.ClickOk(); }; - test(); + + // Call + treeViewControl.TryRenameNodeForData(dataObject); + + // Assert Assert.AreEqual(0, hit); + Assert.AreEqual(Properties.Resources.TreeViewControl_The_selected_item_cannot_be_renamed, messageBoxText); } } @@ -399,22 +400,24 @@ var dataObject = new object(); treeViewControl.Data = dataObject; - // Call - Action test = () => - { - treeViewControl.TryRemoveNodeForData(dataObject); - }; - - // Assert + string messageBoxText = null; DialogBoxHandler = (name, wnd) => { var helper = new MessageBoxTester(wnd); - Assert.AreEqual(Properties.Resources.TreeViewControl_The_selected_item_cannot_be_removed, helper.Text); + + messageBoxText = helper.Text; + helper.ClickOk(); }; - test(); + + // Call + treeViewControl.TryRemoveNodeForData(dataObject); + + // Assert Assert.AreEqual(0, onNodeRemovedHit); Assert.AreEqual(0, onDataDeletedHit); + + Assert.AreEqual(Properties.Resources.TreeViewControl_The_selected_item_cannot_be_removed, messageBoxText); } } @@ -442,23 +445,24 @@ { WindowsFormsTestHelper.Show(treeViewControl); - // Call - Action test = () => - { - treeViewControl.TryRemoveNodeForData(dataObject); - }; - - // Assert + string messageBoxText = null; DialogBoxHandler = (name, wnd) => { var helper = new MessageBoxTester(wnd); - Assert.AreEqual(Properties.Resources.TreeViewControl_Are_you_sure_you_want_to_remove_the_selected_item, helper.Text); + + messageBoxText = helper.Text; + helper.ClickOk(); }; - test(); + // Call + treeViewControl.TryRemoveNodeForData(dataObject); + + // Assert Assert.AreEqual(1, onNodeRemovedHit); Assert.AreEqual(1, onDataDeletedHit); + + Assert.AreEqual(Properties.Resources.TreeViewControl_Are_you_sure_you_want_to_remove_the_selected_item, messageBoxText); } finally { @@ -489,22 +493,23 @@ { WindowsFormsTestHelper.Show(treeViewControl); - // Call - Action test = () => - { - treeViewControl.TryRemoveNodeForData(dataObject); - }; - - // Assert + string messageBoxText = null; DialogBoxHandler = (name, wnd) => { var helper = new MessageBoxTester(wnd); - Assert.AreEqual(Properties.Resources.TreeViewControl_Are_you_sure_you_want_to_remove_the_selected_item, helper.Text); + + messageBoxText = helper.Text; + helper.ClickCancel(); }; - test(); + // Call + treeViewControl.TryRemoveNodeForData(dataObject); + + // Assert Assert.AreEqual(0, hit); + + Assert.AreEqual(Properties.Resources.TreeViewControl_Are_you_sure_you_want_to_remove_the_selected_item, messageBoxText); } finally { Index: Core/Common/test/Core.Common.Integration.Test/Ringtoets/Application.Ringtoets/GuiImportHandlerTest.cs =================================================================== diff -u -r791e86bf9004a55178386416eb6a9c545380bd1c -re8b38c279ab010c360bd6589c8600e9cf387b11f --- Core/Common/test/Core.Common.Integration.Test/Ringtoets/Application.Ringtoets/GuiImportHandlerTest.cs (.../GuiImportHandlerTest.cs) (revision 791e86bf9004a55178386416eb6a9c545380bd1c) +++ Core/Common/test/Core.Common.Integration.Test/Ringtoets/Application.Ringtoets/GuiImportHandlerTest.cs (.../GuiImportHandlerTest.cs) (revision e8b38c279ab010c360bd6589c8600e9cf387b11f) @@ -15,23 +15,32 @@ [Test] public void NoImporterAvailableGivesMessageBox() { + // Setup var applicationCore = new ApplicationCore(); var mocks = new MockRepository(); var mainWindow = mocks.Stub(); mocks.ReplayAll(); + string messageBoxTitle = null, messageBoxText = null; DialogBoxHandler = (name, wnd) => { var messageBox = new MessageBoxTester(wnd); - Assert.AreEqual("Geen enkele 'Importer' is beschikbaar voor dit element.", messageBox.Text); - Assert.AreEqual("Fout", messageBox.Title); + + messageBoxText = messageBox.Text; + messageBoxTitle = messageBox.Title; + messageBox.ClickOk(); }; var importHandler = new GuiImportHandler(mainWindow, applicationCore); + // Call importHandler.ImportDataTo(typeof(Int64)); + + // Assert + Assert.AreEqual("Fout", messageBoxTitle); + Assert.AreEqual("Geen enkele 'Importer' is beschikbaar voor dit element.", messageBoxText); } } } \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -rded51ed5be07b08a299605abbeaed5ba70a7f89c -re8b38c279ab010c360bd6589c8600e9cf387b11f --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationContextTreeNodeInfoTest.cs (.../PipingCalculationContextTreeNodeInfoTest.cs) (revision ded51ed5be07b08a299605abbeaed5ba70a7f89c) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationContextTreeNodeInfoTest.cs (.../PipingCalculationContextTreeNodeInfoTest.cs) (revision e8b38c279ab010c360bd6589c8600e9cf387b11f) @@ -490,14 +490,17 @@ mocks.ReplayAll(); - DialogBoxHandler = (name, wnd) => { }; - plugin.Gui = gui; calculation.Attach(observer); var contextMenuAdapter = info.ContextMenuStrip(pipingCalculationContext, null, treeViewControlMock); + DialogBoxHandler = (name, wnd) => + { + // Don't care about dialogs in this test. + }; + // When Action action = () => { contextMenuAdapter.Items[calculateContextMenuItemIndex].PerformClick(); }; @@ -584,8 +587,6 @@ mocks.ReplayAll(); - DialogBoxHandler = (name, wnd) => { }; - plugin.Gui = gui; calculation.InputParameters.AssessmentLevel = validPipingInput.AssessmentLevel; @@ -616,6 +617,11 @@ var contextMenuAdapter = info.ContextMenuStrip(pipingCalculationContext, null, treeViewControlMock); + DialogBoxHandler = (name, wnd) => + { + // Don't care about dialogs in this test. + }; + // When Action action = () => { contextMenuAdapter.Items[calculateContextMenuItemIndex].PerformClick(); }; @@ -671,11 +677,12 @@ var contextMenuAdapter = info.ContextMenuStrip(pipingCalculationContext, null, treeViewControlMock); + string messageBoxText = null, messageBoxTitle = null; DialogBoxHandler = (name, wnd) => { var messageBox = new MessageBoxTester(wnd); - Assert.AreEqual("Weet u zeker dat u de uitvoer van deze berekening wilt wissen?", messageBox.Text); - Assert.AreEqual("Bevestigen", messageBox.Title); + messageBoxText = messageBox.Text; + messageBoxTitle = messageBox.Title; if (confirm) { messageBox.ClickOk(); @@ -691,7 +698,8 @@ // Then Assert.AreNotEqual(confirm, calculation.HasOutput); - + Assert.AreEqual("Bevestigen", messageBoxTitle); + Assert.AreEqual("Weet u zeker dat u de uitvoer van deze berekening wilt wissen?", messageBoxText); mocks.VerifyAll(); } } Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -rdc41fb966f99f5200c570d70e16397087ffa87c8 -re8b38c279ab010c360bd6589c8600e9cf387b11f --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs (.../PipingCalculationGroupContextTreeNodeInfoTest.cs) (revision dc41fb966f99f5200c570d70e16397087ffa87c8) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs (.../PipingCalculationGroupContextTreeNodeInfoTest.cs) (revision e8b38c279ab010c360bd6589c8600e9cf387b11f) @@ -719,10 +719,13 @@ plugin.Gui = gui; - DialogBoxHandler = (name, wnd) => { }; - var contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl); + DialogBoxHandler = (name, wnd) => + { + // Don't care about dialogs in this test. + }; + // Call contextMenu.Items[contextMenuCalculateAllIndex].PerformClick(); @@ -781,11 +784,14 @@ plugin.Gui = gui; + string messageBoxTitle = null, messageBoxText = null; DialogBoxHandler = (name, wnd) => { var messageBox = new MessageBoxTester(wnd); - Assert.AreEqual("Weet u zeker dat u alle uitvoer wilt wissen?", messageBox.Text); - Assert.AreEqual("Bevestigen", messageBox.Title); + + messageBoxText = messageBox.Text; + messageBoxTitle = messageBox.Title; + if (confirm) { messageBox.ClickOk(); @@ -808,6 +814,9 @@ Assert.AreNotEqual(confirm, @group.HasOutput); Assert.AreNotEqual(confirm, calculation1.HasOutput); Assert.AreNotEqual(confirm, calculation2.HasOutput); + + Assert.AreEqual("Bevestigen", messageBoxTitle); + Assert.AreEqual("Weet u zeker dat u alle uitvoer wilt wissen?", messageBoxText); mocks.VerifyAll(); } Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingFailureMechanismTreeNodeInfoTest.cs =================================================================== diff -u -rf98cc7191a717793f69485dad2923cd34f6d48de -re8b38c279ab010c360bd6589c8600e9cf387b11f --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingFailureMechanismTreeNodeInfoTest.cs (.../PipingFailureMechanismTreeNodeInfoTest.cs) (revision f98cc7191a717793f69485dad2923cd34f6d48de) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingFailureMechanismTreeNodeInfoTest.cs (.../PipingFailureMechanismTreeNodeInfoTest.cs) (revision e8b38c279ab010c360bd6589c8600e9cf387b11f) @@ -174,11 +174,14 @@ ContextMenuStrip contextMenuAdapter = info.ContextMenuStrip(dataMock, null, treeViewControl); + string messageBoxTitle = null, messageBoxText = null; DialogBoxHandler = (name, wnd) => { var messageBox = new MessageBoxTester(wnd); - Assert.AreEqual("Weet u zeker dat u alle uitvoer wilt wissen?", messageBox.Text); - Assert.AreEqual("Bevestigen", messageBox.Title); + + messageBoxText = messageBox.Text; + messageBoxTitle = messageBox.Title; + if (confirm) { messageBox.ClickOk(); @@ -195,6 +198,8 @@ // Then Assert.AreNotEqual(confirm, dataMock.CalculationsGroup.HasOutput); + Assert.AreEqual("Bevestigen", messageBoxTitle); + Assert.AreEqual("Weet u zeker dat u alle uitvoer wilt wissen?", messageBoxText); mocks.VerifyAll(); } @@ -534,12 +539,15 @@ mocks.ReplayAll(); - DialogBoxHandler = (name, wnd) => { }; - plugin.Gui = gui; var contextMenu = info.ContextMenuStrip(failureMechanism, null, treeViewControl); + DialogBoxHandler = (name, wnd) => + { + // Don't care about dialogs in this test. + }; + // Call contextMenu.Items[contextMenuCalculateAllIndex].PerformClick();