Index: Riskeer/DuneErosion/test/Riskeer.DuneErosion.Plugin.Test/TreeNodeInfos/DuneErosionFailureMechanismSectionResultContextTreeNodeInfoTest.cs =================================================================== diff -u -rca9d1b4a3ae4d86d87cb47acbf359ce3e9bfa933 -rf3100c3b45fd61f451a147c48df8e25affaaae4c --- Riskeer/DuneErosion/test/Riskeer.DuneErosion.Plugin.Test/TreeNodeInfos/DuneErosionFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../DuneErosionFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision ca9d1b4a3ae4d86d87cb47acbf359ce3e9bfa933) +++ Riskeer/DuneErosion/test/Riskeer.DuneErosion.Plugin.Test/TreeNodeInfos/DuneErosionFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../DuneErosionFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision f3100c3b45fd61f451a147c48df8e25affaaae4c) @@ -25,9 +25,9 @@ using Core.Common.TestUtil; using Core.Gui; using Core.Gui.ContextMenu; -using Core.Gui.Forms.ViewHost; using NUnit.Framework; using Rhino.Mocks; +using Riskeer.Common.Plugin.TestUtil; using Riskeer.DuneErosion.Forms.PresentationObjects; using RiskeerCommonFormsResources = Riskeer.Common.Forms.Properties.Resources; @@ -46,60 +46,54 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(DuneErosionFailureMechanismSectionResultContext)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { - // Setup - using (plugin) - { - // Assert - Assert.IsNotNull(info.Text); - Assert.IsNull(info.ForeColor); - Assert.IsNotNull(info.Image); - Assert.IsNotNull(info.ContextMenuStrip); - Assert.IsNull(info.EnsureVisibleOnCreate); - Assert.IsNull(info.ExpandOnCreate); - Assert.IsNull(info.ChildNodeObjects); - Assert.IsNull(info.CanRename); - Assert.IsNull(info.OnNodeRenamed); - Assert.IsNull(info.CanRemove); - Assert.IsNull(info.OnNodeRemoved); - Assert.IsNull(info.CanCheck); - Assert.IsNull(info.CheckedState); - Assert.IsNull(info.OnNodeChecked); - Assert.IsNull(info.CanDrag); - Assert.IsNull(info.CanDrop); - Assert.IsNull(info.CanInsert); - Assert.IsNull(info.OnDrop); - } + // Assert + Assert.IsNotNull(info.Text); + Assert.IsNull(info.ForeColor); + Assert.IsNotNull(info.Image); + Assert.IsNotNull(info.ContextMenuStrip); + Assert.IsNull(info.EnsureVisibleOnCreate); + Assert.IsNull(info.ExpandOnCreate); + Assert.IsNull(info.ChildNodeObjects); + Assert.IsNull(info.CanRename); + Assert.IsNull(info.OnNodeRenamed); + Assert.IsNull(info.CanRemove); + Assert.IsNull(info.OnNodeRemoved); + Assert.IsNull(info.CanCheck); + Assert.IsNull(info.CheckedState); + Assert.IsNull(info.OnNodeChecked); + Assert.IsNull(info.CanDrag); + Assert.IsNull(info.CanDrop); + Assert.IsNull(info.CanInsert); + Assert.IsNull(info.OnDrop); } [Test] public void Text_Always_ReturnsName() { - // Setup - using (plugin) - { - // Call - string text = info.Text(null); + // Call + string text = info.Text(null); - // Assert - Assert.AreEqual("Resultaat", text); - } + // Assert + Assert.AreEqual("Resultaat", text); } [Test] public void Image_Always_ReturnsFailureMechanismSectionResultIcon() { - // Setup - using (plugin) - { - // Call - Image image = info.Image(null); + // Call + Image image = info.Image(null); - // Assert - TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.FailureMechanismSectionResultIcon, image); - } + // Assert + TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.FailureMechanismSectionResultIcon, image); } [Test] @@ -111,12 +105,11 @@ menuBuilder.Expect(mb => mb.AddOpenItem()).Return(menuBuilder); menuBuilder.Expect(mb => mb.Build()).Return(null); - using (plugin) + using (plugin) // This is needed to prevent interference from mocks in dispose using (var treeViewControl = new TreeViewControl()) { - var gui = mocks.Stub(); + IGui gui = StubFactory.CreateGuiStub(mocks); gui.Stub(g => g.Get(null, treeViewControl)).Return(menuBuilder); - gui.Stub(g => g.ViewHost).Return(mocks.Stub()); mocks.ReplayAll(); Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/PipingStructureFailureMechanismSectionResultContextTreeNodeInfoTest.cs =================================================================== diff -u -rca9d1b4a3ae4d86d87cb47acbf359ce3e9bfa933 -rf3100c3b45fd61f451a147c48df8e25affaaae4c --- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/PipingStructureFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../PipingStructureFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision ca9d1b4a3ae4d86d87cb47acbf359ce3e9bfa933) +++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/PipingStructureFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../PipingStructureFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision f3100c3b45fd61f451a147c48df8e25affaaae4c) @@ -45,61 +45,55 @@ plugin = new RiskeerPlugin(); info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(PipingStructureFailureMechanismSectionResultContext)); } - + + [TearDown] + public void TearDown() + { + plugin.Dispose(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { - // Setup - using (plugin) - { - // Assert - Assert.IsNotNull(info.Text); - Assert.IsNull(info.ForeColor); - Assert.IsNotNull(info.Image); - Assert.IsNotNull(info.ContextMenuStrip); - Assert.IsNull(info.EnsureVisibleOnCreate); - Assert.IsNull(info.ExpandOnCreate); - Assert.IsNull(info.ChildNodeObjects); - Assert.IsNull(info.CanRename); - Assert.IsNull(info.OnNodeRenamed); - Assert.IsNull(info.CanRemove); - Assert.IsNull(info.OnNodeRemoved); - Assert.IsNull(info.CanCheck); - Assert.IsNull(info.CheckedState); - Assert.IsNull(info.OnNodeChecked); - Assert.IsNull(info.CanDrag); - Assert.IsNull(info.CanDrop); - Assert.IsNull(info.CanInsert); - Assert.IsNull(info.OnDrop); - } + // Assert + Assert.IsNotNull(info.Text); + Assert.IsNull(info.ForeColor); + Assert.IsNotNull(info.Image); + Assert.IsNotNull(info.ContextMenuStrip); + Assert.IsNull(info.EnsureVisibleOnCreate); + Assert.IsNull(info.ExpandOnCreate); + Assert.IsNull(info.ChildNodeObjects); + Assert.IsNull(info.CanRename); + Assert.IsNull(info.OnNodeRenamed); + Assert.IsNull(info.CanRemove); + Assert.IsNull(info.OnNodeRemoved); + Assert.IsNull(info.CanCheck); + Assert.IsNull(info.CheckedState); + Assert.IsNull(info.OnNodeChecked); + Assert.IsNull(info.CanDrag); + Assert.IsNull(info.CanDrop); + Assert.IsNull(info.CanInsert); + Assert.IsNull(info.OnDrop); } [Test] public void Text_Always_ReturnsName() { - // Setup - using (plugin) - { - // Call - string text = info.Text(null); + // Call + string text = info.Text(null); - // Assert - Assert.AreEqual("Resultaat", text); - } + // Assert + Assert.AreEqual("Resultaat", text); } [Test] public void Image_Always_ReturnsFailureMechanismSectionResultIcon() { - // Setup - using (plugin) - { - // Call - Image image = info.Image(null); + // Call + Image image = info.Image(null); - // Assert - TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.FailureMechanismSectionResultIcon, image); - } + // Assert + TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.FailureMechanismSectionResultIcon, image); } [Test] @@ -111,7 +105,7 @@ menuBuilder.Expect(mb => mb.AddOpenItem()).Return(menuBuilder); menuBuilder.Expect(mb => mb.Build()).Return(null); - using (plugin) + using (plugin) // This is needed to prevent interference from mocks in dispose using (var treeViewControl = new TreeViewControl()) { IGui gui = StubFactory.CreateGuiStub(mocks); @@ -124,7 +118,7 @@ // Call info.ContextMenuStrip(null, null, treeViewControl); } - + // Assert mocks.VerifyAll(); }