Index: Core/Common/test/Core.Common.Gui.Test/Core.Common.Gui.Test.csproj
===================================================================
diff -u -r1e9f415cb615bf84526faeecb51f9a70498f9ffc -re4ee8a21ab07f3446dc417e50574b6bc6106f460
--- Core/Common/test/Core.Common.Gui.Test/Core.Common.Gui.Test.csproj (.../Core.Common.Gui.Test.csproj) (revision 1e9f415cb615bf84526faeecb51f9a70498f9ffc)
+++ Core/Common/test/Core.Common.Gui.Test/Core.Common.Gui.Test.csproj (.../Core.Common.Gui.Test.csproj) (revision e4ee8a21ab07f3446dc417e50574b6bc6106f460)
@@ -141,6 +141,7 @@
+
Index: Core/Common/test/Core.Common.Gui.Test/RingtoetsGuiTests.cs
===================================================================
diff -u
--- Core/Common/test/Core.Common.Gui.Test/RingtoetsGuiTests.cs (revision 0)
+++ Core/Common/test/Core.Common.Gui.Test/RingtoetsGuiTests.cs (revision e4ee8a21ab07f3446dc417e50574b6bc6106f460)
@@ -0,0 +1,319 @@
+using System;
+using System.Linq;
+
+using Core.Common.Base.Plugin;
+using Core.Common.Base.Storage;
+using Core.Common.Controls.TreeView;
+using Core.Common.Gui.Forms.MainWindow;
+using Core.Common.Gui.Forms.MessageWindow;
+using Core.Common.Gui.Plugin;
+using Core.Common.Gui.Test.Forms.ViewManager;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+namespace Core.Common.Gui.Test
+{
+ [TestFixture]
+ public class RingtoetsGuiTests
+ {
+ private MessageWindowLogAppender originalAppender;
+
+ [SetUp]
+ public void SetUp()
+ {
+ originalAppender = MessageWindowLogAppender.Instance;
+ MessageWindowLogAppender.Instance = new MessageWindowLogAppender();
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ MessageWindowLogAppender.Instance = originalAppender;
+ }
+
+ [Test]
+ [STAThread]
+ public void DisposingGuiDisposesApplication()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var projectStore = mocks.Stub();
+ var applicationCore = mocks.Stub();
+ applicationCore.Expect(ac => ac.Dispose());
+ mocks.ReplayAll();
+
+ var gui = new RingtoetsGui(new MainWindow(), projectStore, applicationCore);
+
+ // Call
+ gui.Dispose();
+
+ // Assert
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [STAThread]
+ public void Run_WithFile_LoadProjectFromFile()
+ {
+ // Setup
+ var testFile = "SomeFile";
+
+ var mocks = new MockRepository();
+ var projectStore = mocks.Stub();
+ projectStore.Expect(ps => ps.LoadProject(testFile));
+ mocks.ReplayAll();
+
+ using (var gui = new RingtoetsGui(new MainWindow(), projectStore))
+ {
+ // Call
+ gui.Run(testFile);
+
+ // Assert
+ Assert.AreEqual(testFile, gui.ProjectFilePath);
+ }
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [STAThread]
+ public void CheckViewPropertyEditorIsInitialized()
+ {
+ var mocks = new MockRepository();
+ var projectStore = mocks.Stub();
+ mocks.ReplayAll();
+
+ using (new RingtoetsGui(new MainWindow(), projectStore))
+ {
+ Assert.NotNull(ViewPropertyEditor.ViewCommands);
+ }
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [STAThread]
+ public void GetAllDataWithViewDefinitionsRecursively_DataHasNoViewDefinitions_ReturnEmpty()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var projectStore = mocks.Stub();
+ mocks.ReplayAll();
+
+ using (var ringtoetsGui = new RingtoetsGui(new MainWindow(), projectStore))
+ {
+ var rootData = new object();
+
+ // Call
+ var dataInstancesWithViewDefinitions = ringtoetsGui.GetAllDataWithViewDefinitionsRecursively(rootData);
+
+ // Assert
+ CollectionAssert.IsEmpty(dataInstancesWithViewDefinitions);
+ }
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [STAThread]
+ public void GetAllDataWithViewDefinitionsRecursively_MultiplePluginsHaveViewDefinitionsForRoot_ReturnRootObject()
+ {
+ // Setup
+ var rootData = new object();
+
+ var mocks = new MockRepository();
+ var projectStore = mocks.Stub();
+
+ var plugin1 = mocks.StrictMock();
+ plugin1.Expect(p => p.GetChildDataWithViewDefinitions(rootData)).Return(new[]
+ {
+ rootData
+ });
+ plugin1.Stub(p => p.Dispose());
+ plugin1.Stub(p => p.Deactivate());
+ var plugin2 = mocks.StrictMock();
+ plugin2.Expect(p => p.GetChildDataWithViewDefinitions(rootData)).Return(new[]
+ {
+ rootData
+ });
+ plugin2.Stub(p => p.Dispose());
+ plugin2.Stub(p => p.Deactivate());
+ mocks.ReplayAll();
+
+ using (var ringtoetsGui = new RingtoetsGui(new MainWindow(), projectStore))
+ {
+ ringtoetsGui.Plugins.Add(plugin1);
+ ringtoetsGui.Plugins.Add(plugin2);
+
+ // Call
+ var dataInstancesWithViewDefinitions = ringtoetsGui.GetAllDataWithViewDefinitionsRecursively(rootData).OfType