Index: Core/Common/src/Core.Common.Gui/Forms/ViewHost/DocumentViewController.cs =================================================================== diff -u -r8eb9e190d7762dc253fb7691774f0378aaf41132 -r6fc42a91bd445cd4896eb833ffb2fcd88a54cdbe --- Core/Common/src/Core.Common.Gui/Forms/ViewHost/DocumentViewController.cs (.../DocumentViewController.cs) (revision 8eb9e190d7762dc253fb7691774f0378aaf41132) +++ Core/Common/src/Core.Common.Gui/Forms/ViewHost/DocumentViewController.cs (.../DocumentViewController.cs) (revision 6fc42a91bd445cd4896eb833ffb2fcd88a54cdbe) @@ -32,7 +32,7 @@ /// /// Class responsible for finding a view given some data object. /// - public class DocumentViewController : IDocumentViewController, IDisposable + public class DocumentViewController : IDocumentViewController { private readonly IViewHost viewHost; private readonly ViewInfo[] viewInfos; Index: Core/Common/src/Core.Common.Gui/Forms/ViewHost/IDocumentViewController.cs =================================================================== diff -u -r8eb9e190d7762dc253fb7691774f0378aaf41132 -r6fc42a91bd445cd4896eb833ffb2fcd88a54cdbe --- Core/Common/src/Core.Common.Gui/Forms/ViewHost/IDocumentViewController.cs (.../IDocumentViewController.cs) (revision 8eb9e190d7762dc253fb7691774f0378aaf41132) +++ Core/Common/src/Core.Common.Gui/Forms/ViewHost/IDocumentViewController.cs (.../IDocumentViewController.cs) (revision 6fc42a91bd445cd4896eb833ffb2fcd88a54cdbe) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using System.Collections.Generic; using Core.Common.Gui.Plugin; @@ -38,7 +39,7 @@ /// /// /// - public interface IDocumentViewController + public interface IDocumentViewController : IDisposable { /// /// Opens a view for . Index: Core/Common/src/Core.Common.Gui/GuiCore.cs =================================================================== diff -u -rac96d7c315129af851634ed5a4a6800b59ede718 -r6fc42a91bd445cd4896eb833ffb2fcd88a54cdbe --- Core/Common/src/Core.Common.Gui/GuiCore.cs (.../GuiCore.cs) (revision ac96d7c315129af851634ed5a4a6800b59ede718) +++ Core/Common/src/Core.Common.Gui/GuiCore.cs (.../GuiCore.cs) (revision 6fc42a91bd445cd4896eb833ffb2fcd88a54cdbe) @@ -264,7 +264,11 @@ mainWindow = null; } - DocumentViewController = null; + if (DocumentViewController != null) + { + DocumentViewController.Dispose(); + DocumentViewController = null; + } splashScreen = null; Index: Core/Common/test/Core.Common.Gui.Test/GuiCoreTest.cs =================================================================== diff -u -r8eb9e190d7762dc253fb7691774f0378aaf41132 -r6fc42a91bd445cd4896eb833ffb2fcd88a54cdbe --- Core/Common/test/Core.Common.Gui.Test/GuiCoreTest.cs (.../GuiCoreTest.cs) (revision 8eb9e190d7762dc253fb7691774f0378aaf41132) +++ Core/Common/test/Core.Common.Gui.Test/GuiCoreTest.cs (.../GuiCoreTest.cs) (revision 6fc42a91bd445cd4896eb833ffb2fcd88a54cdbe) @@ -131,6 +131,7 @@ "OS not supporting visual styles, therefore application shouldn't be render with visual styles."); } } + mocks.VerifyAll(); } @@ -163,6 +164,7 @@ const string expectedMessage = "Value cannot be null."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); } + mocks.VerifyAll(); } @@ -218,6 +220,7 @@ // Assert Assert.Throws(test); } + mocks.VerifyAll(); } @@ -318,6 +321,7 @@ Assert.IsTrue(mainWindow.IsWindowDisposed); Assert.IsNull(gui.MainWindow); } + mocks.VerifyAll(); } @@ -360,6 +364,7 @@ { rootLogger.RemoveAppender(messageWindowLogAppender); } + mocks.VerifyAll(); } @@ -388,6 +393,7 @@ CollectionAssert.IsEmpty(gui.ViewHost.ToolViews); Assert.IsTrue(toolView.IsDisposed); } + mocks.VerifyAll(); } @@ -417,6 +423,7 @@ Assert.IsNull(gui.DocumentViewController); Assert.IsTrue(documentView.IsDisposed); } + mocks.VerifyAll(); } @@ -460,6 +467,7 @@ rootLogger.AddAppender(appender); } } + mocks.VerifyAll(); } @@ -506,6 +514,7 @@ rootLogger.AddAppender(originalAppender); } } + mocks.VerifyAll(); } @@ -552,6 +561,7 @@ string expectedTitle = $"{fileName} - {fixedSettings.MainWindowTitle} {SettingsHelper.Instance.ApplicationVersion}"; Assert.AreEqual(expectedTitle, mainWindow.Title); } + mocks.VerifyAll(); } @@ -594,6 +604,7 @@ string expectedTitle = $"{expectedProjectName} - {fixedSettings.MainWindowTitle} {SettingsHelper.Instance.ApplicationVersion}"; Assert.AreEqual(expectedTitle, mainWindow.Title); } + mocks.VerifyAll(); } @@ -640,6 +651,7 @@ string expectedTitle = $"{expectedProjectName} - {fixedSettings.MainWindowTitle} {SettingsHelper.Instance.ApplicationVersion}"; Assert.AreEqual(expectedTitle, mainWindow.Title); } + mocks.VerifyAll(); } @@ -695,6 +707,7 @@ string expectedTitle = $"{expectedProjectName} - {fixedSettings.MainWindowTitle} {SettingsHelper.Instance.ApplicationVersion}"; Assert.AreEqual(expectedTitle, mainWindow.Title); } + mocks.VerifyAll(); } @@ -745,6 +758,7 @@ string expectedTitle = $"{expectedProjectName} - {fixedSettings.MainWindowTitle} {SettingsHelper.Instance.ApplicationVersion}"; Assert.AreEqual(expectedTitle, mainWindow.Title); } + mocks.VerifyAll(); } @@ -784,6 +798,7 @@ string expectedTitle = $"{expectedProjectName} - {fixedSettings.MainWindowTitle} {SettingsHelper.Instance.ApplicationVersion}"; Assert.AreEqual(expectedTitle, mainWindow.Title); } + mocks.VerifyAll(); } @@ -814,6 +829,7 @@ // Assert Assert.AreSame(gui, plugin.Gui); } + mocks.VerifyAll(); } @@ -841,6 +857,7 @@ // Call gui.Run(); } + // Assert mocks.VerifyAll(); // Expect calls on plugin } @@ -874,6 +891,7 @@ Tuple expectedMessageAndLogLevel = Tuple.Create(expectedMessage, LogLevelConstant.Error); TestHelper.AssertLogMessageWithLevelIsGenerated(call, expectedMessageAndLogLevel); } + mocks.VerifyAll(); // Expect Dispose call on plugin } @@ -928,6 +946,7 @@ // Assert CollectionAssert.IsEmpty(dataInstancesWithViewDefinitions); } + mocks.VerifyAll(); } @@ -976,6 +995,7 @@ }; CollectionAssert.AreEquivalent(expectedDataDefinitions, dataInstancesWithViewDefinitions); } + mocks.VerifyAll(); } @@ -1037,6 +1057,7 @@ }; CollectionAssert.AreEquivalent(expectedDataDefinitions, dataInstancesWithViewDefinitions); } + mocks.VerifyAll(); } @@ -1141,6 +1162,7 @@ string message = Assert.Throws(call).Message; Assert.AreEqual("Call IGui.Run in order to initialize dependencies before getting the ContextMenuBuilder.", message); } + mocks.VerifyAll(); } @@ -1176,6 +1198,7 @@ .Build(); Assert.AreEqual(9, contextMenu.Items.Count); } + mocks.VerifyAll(); } @@ -1215,6 +1238,7 @@ Assert.AreEqual(1, openedCallCount); Assert.AreEqual(1, beforeOpenCallCount); } + mocks.VerifyAll(); } @@ -1245,6 +1269,7 @@ // Then Assert.AreSame(selectionProvider.Selection, gui.Selection); } + mocks.VerifyAll(); } @@ -1274,6 +1299,7 @@ // Then Assert.AreSame(selectionProvider.Selection, gui.Selection); } + mocks.VerifyAll(); } @@ -1304,6 +1330,7 @@ // Then Assert.AreSame(selectionProvider.Selection, gui.Selection); } + mocks.VerifyAll(); } @@ -1337,6 +1364,7 @@ // Then Assert.AreSame(selection, gui.Selection); } + mocks.VerifyAll(); } @@ -1367,6 +1395,7 @@ // Then Assert.AreSame(selection, gui.Selection); } + mocks.VerifyAll(); } @@ -1397,6 +1426,7 @@ // Then Assert.AreSame(selection, gui.Selection); } + mocks.VerifyAll(); } @@ -1428,6 +1458,7 @@ // Then Assert.IsNull(gui.Selection); } + mocks.VerifyAll(); } @@ -1461,6 +1492,7 @@ // Then Assert.IsNull(gui.Selection); } + mocks.VerifyAll(); }