Index: Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapDataCollectionTreeNodeInfoTest.cs =================================================================== diff -u -rc73100fd8408a2865d6fb32bd17608502686b605 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapDataCollectionTreeNodeInfoTest.cs (.../MapDataCollectionTreeNodeInfoTest.cs) (revision c73100fd8408a2865d6fb32bd17608502686b605) +++ Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapDataCollectionTreeNodeInfoTest.cs (.../MapDataCollectionTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -24,25 +24,35 @@ private MapLegendView mapLegendView; private TreeNodeInfo info; private IContextMenuBuilderProvider contextMenuBuilderProvider; - private IWin32Window parentWindow; [SetUp] public void SetUp() { mocks = new MockRepository(); contextMenuBuilderProvider = mocks.StrictMock(); - parentWindow = mocks.Stub(); + var parentWindow = mocks.Stub(); mapLegendView = new MapLegendView(contextMenuBuilderProvider, parentWindow); - var treeViewControl = TypeUtils.GetField(mapLegendView, "treeViewControl"); - var treeNodeInfoLookup = TypeUtils.GetField>(treeViewControl, "tagTypeTreeNodeInfoLookup"); + TreeViewControl treeViewControl = TypeUtils.GetField(mapLegendView, "treeViewControl"); + Dictionary treeNodeInfoLookup = TypeUtils.GetField>(treeViewControl, "tagTypeTreeNodeInfoLookup"); info = treeNodeInfoLookup[typeof(MapDataCollection)]; } + [TearDown] + public void TearDown() + { + mapLegendView.Dispose(); + + mocks.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(MapDataCollection), info.TagType); Assert.IsNull(info.ForeColor); @@ -70,12 +80,14 @@ // Assert Assert.AreEqual(mapDataCollection.Name, text); - mocks.VerifyAll(); } [Test] public void Image_Always_ReturnsImageFromResource() { + // Setup + mocks.ReplayAll(); + // Call var image = info.Image(null); @@ -109,8 +121,6 @@ mapData2, mapData1 }, objects); - - mocks.VerifyAll(); } [Test] @@ -126,8 +136,6 @@ // Assert Assert.IsFalse(canDrop); - - mocks.VerifyAll(); } [Test] @@ -144,8 +152,6 @@ // Assert Assert.IsTrue(canDrop); - - mocks.VerifyAll(); } [Test] @@ -161,8 +167,6 @@ // Assert Assert.IsFalse(canInsert); - - mocks.VerifyAll(); } [Test] @@ -179,8 +183,6 @@ // Assert Assert.IsTrue(canInsert); - - mocks.VerifyAll(); } [Test] @@ -190,7 +192,6 @@ public void OnDrop_MapDataMovedToPositionInsideRange_SetsNewReverseOrder(int position) { // Setup - var observer = mocks.StrictMock(); var mapData1 = mocks.StrictMock("test data"); var mapData2 = mocks.StrictMock("test data"); var mapData3 = mocks.StrictMock("test data"); @@ -200,6 +201,8 @@ mapData2, mapData3 }, "test data"); + + var observer = mocks.StrictMock(); observer.Expect(o => o.UpdateObserver()); mocks.ReplayAll(); @@ -215,7 +218,6 @@ var reversedIndex = 2 - position; Assert.AreSame(mapData1, mapDataCollection.List.ElementAt(reversedIndex)); } - mocks.VerifyAll(); // UpdateObserver should be called } [Test] @@ -248,16 +250,15 @@ // Assert Assert.Throws(test); } - mocks.VerifyAll(); // UpdateObserver should not be called } [Test] public void ContextMenuStrip_Always_CallsContextMenuBuilderMethods() { // Setup - var menuBuilderMock = mocks.StrictMock(); var mapDataCollection = mocks.StrictMock(Enumerable.Empty(), "test data"); + var menuBuilderMock = mocks.StrictMock(); menuBuilderMock.Expect(mb => mb.AddCustomItem(null)).IgnoreArguments().Return(menuBuilderMock); menuBuilderMock.Expect(mb => mb.Build()).Return(null); @@ -270,8 +271,9 @@ // Call info.ContextMenuStrip(mapDataCollection, null, treeViewControl); } + // Assert - mocks.VerifyAll(); + // Expectancies will be asserted in TearDown() } [Test] @@ -293,7 +295,6 @@ // Assert TestHelper.AssertContextMenuStripContainsItem(contextMenu, 0, expectedItemText, expectedItemTooltip, DotSpatialResources.MapIcon); } - mocks.VerifyAll(); } } } \ No newline at end of file Index: Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapLineDataTreeNodeInfoTest.cs =================================================================== diff -u -r170ec8698dfed095e23f4fa822fe2198b3e5f242 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapLineDataTreeNodeInfoTest.cs (.../MapLineDataTreeNodeInfoTest.cs) (revision 170ec8698dfed095e23f4fa822fe2198b3e5f242) +++ Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapLineDataTreeNodeInfoTest.cs (.../MapLineDataTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -19,18 +19,39 @@ [TestFixture] public class MapLineDataTreeNodeInfoTest { + private MockRepository mocks; private MapLegendView mapLegendView; private TreeNodeInfo info; + [SetUp] + public void SetUp() + { + mocks = new MockRepository(); + var contextMenuBuilderProvider = mocks.StrictMock(); + var parentWindow = mocks.StrictMock(); + + mapLegendView = new MapLegendView(contextMenuBuilderProvider, parentWindow); + + TreeViewControl treeViewControl = TypeUtils.GetField(mapLegendView, "treeViewControl"); + Dictionary treeNodeInfoLookup = TypeUtils.GetField>(treeViewControl, "tagTypeTreeNodeInfoLookup"); + + info = treeNodeInfoLookup[typeof(MapLineData)]; + } + [TearDown] public void TearDown() { mapLegendView.Dispose(); + + mocks.VerifyAll(); } [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(MapLineData), info.TagType); Assert.IsNull(info.ForeColor); @@ -50,7 +71,6 @@ public void Text_Always_ReturnsNameFromMapData() { // Setup - var mocks = CreateDefaultMocks(); var mapLineData = mocks.StrictMock(Enumerable.Empty(), "MapLineData"); mocks.ReplayAll(); @@ -59,12 +79,14 @@ // Assert Assert.AreEqual(mapLineData.Name, text); - mocks.VerifyAll(); } [Test] public void Image_Always_ReturnsImageFromResource() { + // Setup + mocks.ReplayAll(); + // Call var image = info.Image(null); @@ -76,7 +98,6 @@ public void CanCheck_Always_ReturnsTrue() { // Setup - var mocks = CreateDefaultMocks(); var lineData = mocks.StrictMock(Enumerable.Empty(), "test data"); mocks.ReplayAll(); @@ -86,16 +107,13 @@ // Assert Assert.IsTrue(canCheck); - - mocks.VerifyAll(); } [TestCase(true)] [TestCase(false)] public void IsChecked_Always_ReturnsAccordingToVisibleStateOfLineData(bool isVisible) { // Setup - var mocks = CreateDefaultMocks(); var lineData = mocks.StrictMock(Enumerable.Empty(), "test data"); lineData.IsVisible = isVisible; @@ -107,16 +125,13 @@ // Assert Assert.AreEqual(isVisible, canCheck); - - mocks.VerifyAll(); } [TestCase(true)] [TestCase(false)] public void OnNodeChecked_LineDataNodeWithoutParent_SetsLineDataVisibility(bool initialVisibleState) { // Setup - var mocks = CreateDefaultMocks(); var lineData = mocks.StrictMock(Enumerable.Empty(), "test data"); mocks.ReplayAll(); @@ -128,21 +143,18 @@ // Assert Assert.AreEqual(!initialVisibleState, lineData.IsVisible); - - mocks.VerifyAll(); } [TestCase(true)] [TestCase(false)] public void OnNodeChecked_LineDataNodeWithObservableParent_SetsLineDataVisibilityAndNotifiesParentObservers(bool initialVisibleState) { // Setup - var mocks = CreateDefaultMocks(); var observable = mocks.StrictMock(); - var lineData = mocks.StrictMock(Enumerable.Empty(), "test data"); - observable.Expect(o => o.NotifyObservers()); + var lineData = mocks.StrictMock(Enumerable.Empty(), "test data"); + mocks.ReplayAll(); lineData.IsVisible = initialVisibleState; @@ -152,15 +164,12 @@ // Assert Assert.AreEqual(!initialVisibleState, lineData.IsVisible); - - mocks.VerifyAll(); } [Test] public void CanDrag_Always_ReturnsTrue() { // Setup - var mocks = CreateDefaultMocks(); var lineData = mocks.StrictMock(Enumerable.Empty(), "test data"); mocks.ReplayAll(); @@ -170,24 +179,6 @@ // Assert Assert.IsTrue(canDrag); - - mocks.VerifyAll(); } - - private MockRepository CreateDefaultMocks() - { - var mockRepository = new MockRepository(); - var contextMenuBuilderProvider = mockRepository.StrictMock(); - var parentWindow = mockRepository.StrictMock(); - - mapLegendView = new MapLegendView(contextMenuBuilderProvider, parentWindow); - - var treeViewControl = TypeUtils.GetField(mapLegendView, "treeViewControl"); - var treeNodeInfoLookup = TypeUtils.GetField>(treeViewControl, "tagTypeTreeNodeInfoLookup"); - - info = treeNodeInfoLookup[typeof(MapLineData)]; - - return mockRepository; - } } } \ No newline at end of file Index: Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapPointDataTreeNodeInfoTest.cs =================================================================== diff -u -r170ec8698dfed095e23f4fa822fe2198b3e5f242 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapPointDataTreeNodeInfoTest.cs (.../MapPointDataTreeNodeInfoTest.cs) (revision 170ec8698dfed095e23f4fa822fe2198b3e5f242) +++ Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapPointDataTreeNodeInfoTest.cs (.../MapPointDataTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -19,12 +19,37 @@ [TestFixture] public class MapPointDataTreeNodeInfoTest { + private MockRepository mocks; private MapLegendView mapLegendView; private TreeNodeInfo info; + [SetUp] + public void SetUp() + { + mocks = new MockRepository(); + var contextMenuBuilderProvider = mocks.StrictMock(); + var parentWindow = mocks.StrictMock(); + + mapLegendView = new MapLegendView(contextMenuBuilderProvider, parentWindow); + + TreeViewControl treeViewControl = TypeUtils.GetField(mapLegendView, "treeViewControl"); + Dictionary treeNodeInfoLookup = TypeUtils.GetField>(treeViewControl, "tagTypeTreeNodeInfoLookup"); + + info = treeNodeInfoLookup[typeof(MapPointData)]; + } + + [TearDown] + public void TearDown() + { + mapLegendView.Dispose(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(MapPointData), info.TagType); Assert.IsNull(info.ForeColor); @@ -44,7 +69,6 @@ public void Text_Always_ReturnsNameFromMapData() { // Setup - var mocks = CreateDefaultMocks(); var mapPointData = mocks.StrictMock(Enumerable.Empty(), "MapPointData"); mocks.ReplayAll(); @@ -53,12 +77,14 @@ // Assert Assert.AreEqual(mapPointData.Name, text); - mocks.VerifyAll(); } [Test] public void Image_Always_ReturnsImageFromResource() { + // Setup + mocks.ReplayAll(); + // Call var image = info.Image(null); @@ -70,7 +96,6 @@ public void CanCheck_Always_ReturnsTrue() { // Setup - var mocks = CreateDefaultMocks(); var lineData = mocks.StrictMock(Enumerable.Empty(), "test data"); mocks.ReplayAll(); @@ -80,18 +105,14 @@ // Assert Assert.IsTrue(canCheck); - - mocks.VerifyAll(); } [TestCase(true)] [TestCase(false)] public void IsChecked_Always_ReturnsAccordingToVisibleStateOfLineData(bool isVisible) { // Setup - var mocks = CreateDefaultMocks(); var lineData = mocks.StrictMock(Enumerable.Empty(), "test data"); - lineData.IsVisible = isVisible; mocks.ReplayAll(); @@ -101,16 +122,13 @@ // Assert Assert.AreEqual(isVisible, canCheck); - - mocks.VerifyAll(); } [TestCase(true)] [TestCase(false)] public void OnNodeChecked_LineDataNodeWithoutParent_SetsLineDataVisibility(bool initialVisibleState) { // Setup - var mocks = CreateDefaultMocks(); var lineData = mocks.StrictMock(Enumerable.Empty(), "test data"); mocks.ReplayAll(); @@ -122,19 +140,16 @@ // Assert Assert.AreEqual(!initialVisibleState, lineData.IsVisible); - - mocks.VerifyAll(); } [TestCase(true)] [TestCase(false)] public void OnNodeChecked_LineDataNodeWithObservableParent_SetsLineDataVisibilityAndNotifiesParentObservers(bool initialVisibleState) { // Setup - var mocks = CreateDefaultMocks(); - var observable = mocks.StrictMock(); var lineData = mocks.StrictMock(Enumerable.Empty(), "test data"); + var observable = mocks.StrictMock(); observable.Expect(o => o.NotifyObservers()); mocks.ReplayAll(); @@ -146,15 +161,12 @@ // Assert Assert.AreEqual(!initialVisibleState, lineData.IsVisible); - - mocks.VerifyAll(); } [Test] public void CanDrag_Always_ReturnsTrue() { // Setup - var mocks = CreateDefaultMocks(); var pointData = mocks.StrictMock(Enumerable.Empty(), "test data"); mocks.ReplayAll(); @@ -164,25 +176,6 @@ // Assert Assert.IsTrue(canDrag); - - mocks.VerifyAll(); } - - private MockRepository CreateDefaultMocks() - { - var mockRepository = new MockRepository(); - var contextMenuBuilderProvider = mockRepository.StrictMock(); - var parentWindow = mockRepository.StrictMock(); - mockRepository.ReplayAll(); - - mapLegendView = new MapLegendView(contextMenuBuilderProvider, parentWindow); - - var treeViewControl = TypeUtils.GetField(mapLegendView, "treeViewControl"); - var treeNodeInfoLookup = TypeUtils.GetField>(treeViewControl, "tagTypeTreeNodeInfoLookup"); - - info = treeNodeInfoLookup[typeof(MapPointData)]; - - return mockRepository; - } } } \ No newline at end of file Index: Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapPolygonDataTreeNodeInfoTest.cs =================================================================== diff -u -r170ec8698dfed095e23f4fa822fe2198b3e5f242 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapPolygonDataTreeNodeInfoTest.cs (.../MapPolygonDataTreeNodeInfoTest.cs) (revision 170ec8698dfed095e23f4fa822fe2198b3e5f242) +++ Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapPolygonDataTreeNodeInfoTest.cs (.../MapPolygonDataTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -19,12 +19,41 @@ [TestFixture] public class MapPolygonDataTreeNodeInfoTest { + private MockRepository mocks; private MapLegendView mapLegendView; private TreeNodeInfo info; + [SetUp] + public void SetUp() + { + var mockRepository = new MockRepository(); + var contextMenuBuilderProvider = mockRepository.StrictMock(); + var parentWindow = mockRepository.StrictMock(); + + mapLegendView = new MapLegendView(contextMenuBuilderProvider, parentWindow); + + TreeViewControl treeViewControl = TypeUtils.GetField(mapLegendView, "treeViewControl"); + Dictionary treeNodeInfoLookup = TypeUtils.GetField>(treeViewControl, "tagTypeTreeNodeInfoLookup"); + + info = treeNodeInfoLookup[typeof(MapPolygonData)]; + + mocks = mockRepository; + } + + [TearDown] + public void TearDown() + { + mapLegendView.Dispose(); + + mocks.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(MapPolygonData), info.TagType); Assert.IsNull(info.ForeColor); @@ -44,7 +73,6 @@ public void Text_Always_ReturnsNameFromMapData() { // Setup - var mocks = CreateDefaultMocks(); var mapPolygonData = mocks.StrictMock(Enumerable.Empty(), "MapPolygonData"); mocks.ReplayAll(); @@ -53,12 +81,14 @@ // Assert Assert.AreEqual(mapPolygonData.Name, text); - mocks.VerifyAll(); } [Test] public void Image_Always_ReturnsImageFromResource() { + // Setup + mocks.ReplayAll(); + // Call var image = info.Image(null); @@ -70,7 +100,6 @@ public void CanCheck_Always_ReturnsTrue() { // Setup - var mocks = CreateDefaultMocks(); var lineData = mocks.StrictMock(Enumerable.Empty(), "test data"); mocks.ReplayAll(); @@ -80,15 +109,12 @@ // Assert Assert.IsTrue(canCheck); - - mocks.VerifyAll(); } [Test] public void CanDrag_Always_ReturnsTrue() { // Setup - var mocks = CreateDefaultMocks(); var polygonData = mocks.StrictMock(Enumerable.Empty(), "test data"); mocks.ReplayAll(); @@ -98,18 +124,14 @@ // Assert Assert.IsTrue(canDrag); - - mocks.VerifyAll(); } [TestCase(true)] [TestCase(false)] public void IsChecked_Always_ReturnsAccordingToVisibleStateOfLineData(bool isVisible) { // Setup - var mocks = CreateDefaultMocks(); var lineData = mocks.StrictMock(Enumerable.Empty(), "test data"); - lineData.IsVisible = isVisible; mocks.ReplayAll(); @@ -119,16 +141,13 @@ // Assert Assert.AreEqual(isVisible, canCheck); - - mocks.VerifyAll(); } [TestCase(true)] [TestCase(false)] public void OnNodeChecked_LineDataNodeWithoutParent_SetsLineDataVisibility(bool initialVisibleState) { // Setup - var mocks = CreateDefaultMocks(); var lineData = mocks.StrictMock(Enumerable.Empty(), "test data"); mocks.ReplayAll(); @@ -140,19 +159,16 @@ // Assert Assert.AreEqual(!initialVisibleState, lineData.IsVisible); - - mocks.VerifyAll(); } [TestCase(true)] [TestCase(false)] public void OnNodeChecked_LineDataNodeWithObservableParent_SetsLineDataVisibilityAndNotifiesParentObservers(bool initialVisibleState) { // Setup - var mocks = CreateDefaultMocks(); - var observable = mocks.StrictMock(); var lineData = mocks.StrictMock(Enumerable.Empty(), "test data"); + var observable = mocks.StrictMock(); observable.Expect(o => o.NotifyObservers()); mocks.ReplayAll(); @@ -164,25 +180,6 @@ // Assert Assert.AreEqual(!initialVisibleState, lineData.IsVisible); - - mocks.VerifyAll(); } - - private MockRepository CreateDefaultMocks() - { - var mockRepository = new MockRepository(); - var contextMenuBuilderProvider = mockRepository.StrictMock(); - var parentWindow = mockRepository.StrictMock(); - mockRepository.ReplayAll(); - - mapLegendView = new MapLegendView(contextMenuBuilderProvider, parentWindow); - - var treeViewControl = TypeUtils.GetField(mapLegendView, "treeViewControl"); - var treeNodeInfoLookup = TypeUtils.GetField>(treeViewControl, "tagTypeTreeNodeInfoLookup"); - - info = treeNodeInfoLookup[typeof(MapPolygonData)]; - - return mockRepository; - } } } \ No newline at end of file Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartAreaDataTreeNodeInfoTest.cs =================================================================== diff -u -r8ca6a4ce40d75a96784c6ce8839e06e0b11052da -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartAreaDataTreeNodeInfoTest.cs (.../ChartAreaDataTreeNodeInfoTest.cs) (revision 8ca6a4ce40d75a96784c6ce8839e06e0b11052da) +++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartAreaDataTreeNodeInfoTest.cs (.../ChartAreaDataTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -27,8 +27,8 @@ mocks = new MockRepository(); chartLegendView = new ChartLegendView(); - var treeViewControl = TypeUtils.GetField(chartLegendView, "treeViewControl"); - var treeNodeInfoLookup = TypeUtils.GetField>(treeViewControl, "tagTypeTreeNodeInfoLookup"); + TreeViewControl treeViewControl = TypeUtils.GetField(chartLegendView, "treeViewControl"); + Dictionary treeNodeInfoLookup = TypeUtils.GetField>(treeViewControl, "tagTypeTreeNodeInfoLookup"); info = treeNodeInfoLookup[typeof(ChartAreaData)]; } @@ -37,11 +37,16 @@ public void TearDown() { chartLegendView.Dispose(); + + mocks.VerifyAll(); } [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(ChartAreaData), info.TagType); Assert.IsNull(info.ForeColor); @@ -70,8 +75,6 @@ // Assert Assert.AreEqual(areaData.Name, text); - - mocks.VerifyAll(); } [Test] @@ -87,8 +90,6 @@ // Assert TestHelper.AssertImagesAreEqual(Resources.AreaIcon, image); - - mocks.VerifyAll(); } [Test] @@ -104,8 +105,6 @@ // Assert Assert.IsTrue(canDrag); - - mocks.VerifyAll(); } [Test] @@ -121,8 +120,6 @@ // Assert Assert.IsTrue(canCheck); - - mocks.VerifyAll(); } [TestCase(true)] @@ -131,7 +128,6 @@ { // Setup var areaData = mocks.StrictMock(Enumerable.Empty(), "test data"); - areaData.IsVisible = isVisible; mocks.ReplayAll(); @@ -141,8 +137,6 @@ // Assert Assert.AreEqual(isVisible, canCheck); - - mocks.VerifyAll(); } [TestCase(true)] @@ -161,8 +155,6 @@ // Assert Assert.AreEqual(!initialVisibleState, areaData.IsVisible); - - mocks.VerifyAll(); } [TestCase(true)] @@ -184,8 +176,6 @@ // Assert Assert.AreEqual(!initialVisibleState, areaData.IsVisible); - - mocks.VerifyAll(); } } } \ No newline at end of file Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartDataCollectionTreeNodeInfoTest.cs =================================================================== diff -u -r4e6c8ac0eb663ddfe4565745fb4829a8432019e2 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartDataCollectionTreeNodeInfoTest.cs (.../ChartDataCollectionTreeNodeInfoTest.cs) (revision 4e6c8ac0eb663ddfe4565745fb4829a8432019e2) +++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartDataCollectionTreeNodeInfoTest.cs (.../ChartDataCollectionTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -9,7 +9,6 @@ using Core.Plugins.OxyPlot.Legend; using NUnit.Framework; using Rhino.Mocks; -using Resources = Core.Plugins.OxyPlot.Properties.Resources; using GuiResources = Core.Common.Gui.Properties.Resources; namespace Core.Plugins.OxyPlot.Test.Legend @@ -27,8 +26,8 @@ mocks = new MockRepository(); chartLegendView = new ChartLegendView(); - var treeViewControl = TypeUtils.GetField(chartLegendView, "treeViewControl"); - var treeNodeInfoLookup = TypeUtils.GetField>(treeViewControl, "tagTypeTreeNodeInfoLookup"); + TreeViewControl treeViewControl = TypeUtils.GetField(chartLegendView, "treeViewControl"); + Dictionary treeNodeInfoLookup = TypeUtils.GetField>(treeViewControl, "tagTypeTreeNodeInfoLookup"); info = treeNodeInfoLookup[typeof(ChartDataCollection)]; } @@ -37,11 +36,16 @@ public void TearDown() { chartLegendView.Dispose(); + + mocks.VerifyAll(); } [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(ChartDataCollection), info.TagType); Assert.IsNull(info.ForeColor); @@ -70,8 +74,6 @@ // Assert Assert.AreEqual(chartDataCollection.Name, text); - - mocks.VerifyAll(); } [Test] @@ -87,8 +89,6 @@ // Assert TestHelper.AssertImagesAreEqual(GuiResources.folder, image); - - mocks.VerifyAll(); } [Test] @@ -112,8 +112,6 @@ // Assert CollectionAssert.AreEqual(new[] { chartData3, chartData2, chartData1 }, objects); - - mocks.VerifyAll(); } [Test] @@ -129,8 +127,6 @@ // Assert Assert.IsFalse(canDrop); - - mocks.VerifyAll(); } [Test] @@ -147,8 +143,6 @@ // Assert Assert.IsTrue(canDrop); - - mocks.VerifyAll(); } [Test] @@ -164,8 +158,6 @@ // Assert Assert.IsFalse(canInsert); - - mocks.VerifyAll(); } [Test] @@ -182,8 +174,6 @@ // Assert Assert.IsTrue(canInsert); - - mocks.VerifyAll(); } [Test] @@ -219,7 +209,7 @@ var reversedIndex = 2 - position; Assert.AreSame(chartData1, chartDataCollection.List.ElementAt(reversedIndex)); } - mocks.VerifyAll(); // UpdateObserver should be called + // Assert observer is notified in TearDown() } [Test] @@ -252,7 +242,7 @@ // Assert Assert.Throws(test); } - mocks.VerifyAll(); // UpdateObserver should be not called + // Assert UpdateObserver be not called by TearDown() } } } \ No newline at end of file Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartLineDataTreeNodeInfoTest.cs =================================================================== diff -u -r8ca6a4ce40d75a96784c6ce8839e06e0b11052da -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartLineDataTreeNodeInfoTest.cs (.../ChartLineDataTreeNodeInfoTest.cs) (revision 8ca6a4ce40d75a96784c6ce8839e06e0b11052da) +++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartLineDataTreeNodeInfoTest.cs (.../ChartLineDataTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -27,8 +27,8 @@ mocks = new MockRepository(); chartLegendView = new ChartLegendView(); - var treeViewControl = TypeUtils.GetField(chartLegendView, "treeViewControl"); - var treeNodeInfoLookup = TypeUtils.GetField>(treeViewControl, "tagTypeTreeNodeInfoLookup"); + TreeViewControl treeViewControl = TypeUtils.GetField(chartLegendView, "treeViewControl"); + Dictionary treeNodeInfoLookup = TypeUtils.GetField>(treeViewControl, "tagTypeTreeNodeInfoLookup"); info = treeNodeInfoLookup[typeof(ChartLineData)]; } @@ -37,11 +37,16 @@ public void TearDown() { chartLegendView.Dispose(); + + mocks.VerifyAll(); } [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(ChartLineData), info.TagType); Assert.IsNull(info.ForeColor); @@ -70,8 +75,6 @@ // Assert Assert.AreEqual(lineData.Name, text); - - mocks.VerifyAll(); } [Test] @@ -87,8 +90,6 @@ // Assert TestHelper.AssertImagesAreEqual(Resources.LineIcon, image); - - mocks.VerifyAll(); } [Test] @@ -104,8 +105,6 @@ // Assert Assert.IsTrue(canDrag); - - mocks.VerifyAll(); } [Test] @@ -121,8 +120,6 @@ // Assert Assert.IsTrue(canCheck); - - mocks.VerifyAll(); } [TestCase(true)] @@ -141,8 +138,6 @@ // Assert Assert.AreEqual(isVisible, canCheck); - - mocks.VerifyAll(); } [TestCase(true)] @@ -161,18 +156,16 @@ // Assert Assert.AreEqual(!initialVisibleState, lineData.IsVisible); - - mocks.VerifyAll(); } [TestCase(true)] [TestCase(false)] public void OnNodeChecked_LineDataNodeWithObservableParent_SetsLineDataVisibilityAndNotifiesParentObservers(bool initialVisibleState) { // Setup - var observable = mocks.StrictMock(); var lineData = mocks.StrictMock(Enumerable.Empty(), "test data"); - + + var observable = mocks.StrictMock(); observable.Expect(o => o.NotifyObservers()); mocks.ReplayAll(); @@ -184,8 +177,6 @@ // Assert Assert.AreEqual(!initialVisibleState, lineData.IsVisible); - - mocks.VerifyAll(); } } } \ No newline at end of file Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartPointDataTreeNodeInfoTest.cs =================================================================== diff -u -r8ca6a4ce40d75a96784c6ce8839e06e0b11052da -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartPointDataTreeNodeInfoTest.cs (.../ChartPointDataTreeNodeInfoTest.cs) (revision 8ca6a4ce40d75a96784c6ce8839e06e0b11052da) +++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartPointDataTreeNodeInfoTest.cs (.../ChartPointDataTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -27,8 +27,8 @@ mocks = new MockRepository(); chartLegendView = new ChartLegendView(); - var treeViewControl = TypeUtils.GetField(chartLegendView, "treeViewControl"); - var treeNodeInfoLookup = TypeUtils.GetField>(treeViewControl, "tagTypeTreeNodeInfoLookup"); + TreeViewControl treeViewControl = TypeUtils.GetField(chartLegendView, "treeViewControl"); + Dictionary treeNodeInfoLookup = TypeUtils.GetField>(treeViewControl, "tagTypeTreeNodeInfoLookup"); info = treeNodeInfoLookup[typeof(ChartPointData)]; } @@ -37,11 +37,16 @@ public void TearDown() { chartLegendView.Dispose(); + + mocks.VerifyAll(); } [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(ChartPointData), info.TagType); Assert.IsNull(info.ForeColor); @@ -70,8 +75,6 @@ // Assert Assert.AreEqual(pointData.Name, text); - - mocks.VerifyAll(); } [Test] @@ -87,8 +90,6 @@ // Assert TestHelper.AssertImagesAreEqual(Resources.PointsIcon, image); - - mocks.VerifyAll(); } [Test] @@ -104,8 +105,6 @@ // Assert Assert.IsTrue(canDrag); - - mocks.VerifyAll(); } [Test] @@ -121,8 +120,6 @@ // Assert Assert.IsTrue(canCheck); - - mocks.VerifyAll(); } [TestCase(true)] @@ -141,8 +138,6 @@ // Assert Assert.AreEqual(isVisible, canCheck); - - mocks.VerifyAll(); } [TestCase(true)] @@ -161,18 +156,16 @@ // Assert Assert.AreEqual(!initialVisibleState, pointData.IsVisible); - - mocks.VerifyAll(); } [TestCase(true)] [TestCase(false)] public void OnNodeChecked_PointDataNodeWithObservableParent_SetsPointDataVisibilityAndNotifiesParentObservers(bool initialVisibleState) { // Setup - var observable = mocks.StrictMock(); var pointData = mocks.StrictMock(Enumerable.Empty(), "test data"); + var observable = mocks.StrictMock(); observable.Expect(o => o.NotifyObservers()); mocks.ReplayAll(); @@ -184,8 +177,6 @@ // Assert Assert.AreEqual(!initialVisibleState, pointData.IsVisible); - - mocks.VerifyAll(); } } } \ No newline at end of file Index: Core/Plugins/test/Core.Plugins.ProjectExplorer.Test/TreeNodeInfos/ProjectTreeNodeInfoTest.cs =================================================================== diff -u -r4e6c8ac0eb663ddfe4565745fb4829a8432019e2 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Core/Plugins/test/Core.Plugins.ProjectExplorer.Test/TreeNodeInfos/ProjectTreeNodeInfoTest.cs (.../ProjectTreeNodeInfoTest.cs) (revision 4e6c8ac0eb663ddfe4565745fb4829a8432019e2) +++ Core/Plugins/test/Core.Plugins.ProjectExplorer.Test/TreeNodeInfos/ProjectTreeNodeInfoTest.cs (.../ProjectTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -27,9 +27,20 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(Project)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + + mocks.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(Project), info.TagType); Assert.IsNull(info.ForeColor); @@ -62,8 +73,6 @@ // Assert Assert.AreEqual(testName, text); - - mocks.VerifyAll(); } [Test] @@ -79,8 +88,6 @@ // Assert TestHelper.AssertImagesAreEqual(Resources.ProjectIcon, image); - - mocks.VerifyAll(); } [Test] @@ -101,8 +108,6 @@ // Assert CollectionAssert.AreEqual(new [] { object1, object2 }, objects); - - mocks.VerifyAll(); } [Test] @@ -139,7 +144,7 @@ info.ContextMenuStrip(null, null, treeViewControl); } // Assert - mocks.VerifyAll(); + // Assert expectancies are called in TearDown() } [Test] @@ -174,7 +179,6 @@ // Assert TestHelper.AssertContextMenuStripContainsItem(result, 0, Resources.AddItem, Resources.AddItem_ToolTip, Resources.PlusIcon); } - mocks.VerifyAll(); } } } \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsGuiPlugin.cs =================================================================== diff -u -r87fcb2097e3a58e611c0de6913cb48851006f7af -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsGuiPlugin.cs (.../GrassCoverErosionInwardsGuiPlugin.cs) (revision 87fcb2097e3a58e611c0de6913cb48851006f7af) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsGuiPlugin.cs (.../GrassCoverErosionInwardsGuiPlugin.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -139,7 +139,7 @@ yield return new TreeNodeInfo { - Text = context => "Scenarios", + Text = context => GrassCoverErosionInwardsPluginResources.GrassCoverErosionInwardsGuiPlugin_Scenarios_DisplayName, Image = context => GrassCoverErosionInwardsPluginResources.ScenariosIcon, ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl) .AddOpenItem() Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/Properties/Resources.Designer.cs =================================================================== diff -u -r8d33f259735b765767405b7691924bc8c0182d72 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 8d33f259735b765767405b7691924bc8c0182d72) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -108,6 +108,15 @@ } /// + /// Looks up a localized string similar to Scenarios. + /// + internal static string GrassCoverErosionInwardsGuiPlugin_Scenarios_DisplayName { + get { + return ResourceManager.GetString("GrassCoverErosionInwardsGuiPlugin_Scenarios_DisplayName", resourceCulture); + } + } + + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap ScenariosIcon { Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/Properties/Resources.resx =================================================================== diff -u -r8d33f259735b765767405b7691924bc8c0182d72 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/Properties/Resources.resx (.../Resources.resx) (revision 8d33f259735b765767405b7691924bc8c0182d72) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/Properties/Resources.resx (.../Resources.resx) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -136,4 +136,7 @@ ..\Resources\cards.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + Scenarios + \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj =================================================================== diff -u -r462a9f89d625ca85e6ce2e2ff628db3d83913b99 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj) (revision 462a9f89d625ca85e6ce2e2ff628db3d83913b99) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -85,7 +85,7 @@ - + Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/DikeProfileTreeNodeInfoTest.cs =================================================================== diff -u -r4ca4b2260f66713349c9aae32f5f4b82373c312b -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/DikeProfileTreeNodeInfoTest.cs (.../DikeProfileTreeNodeInfoTest.cs) (revision 4ca4b2260f66713349c9aae32f5f4b82373c312b) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/DikeProfileTreeNodeInfoTest.cs (.../DikeProfileTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -47,6 +47,12 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(DikeProfile)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/DikeProfilesContextTreeNodeInfoTest.cs =================================================================== diff -u -r4ca4b2260f66713349c9aae32f5f4b82373c312b -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/DikeProfilesContextTreeNodeInfoTest.cs (.../DikeProfilesContextTreeNodeInfoTest.cs) (revision 4ca4b2260f66713349c9aae32f5f4b82373c312b) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/DikeProfilesContextTreeNodeInfoTest.cs (.../DikeProfilesContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -50,6 +50,12 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(DikeProfilesContext)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/EmptyProbabilityAssessmentOutputTreeNodeInfoTest.cs =================================================================== diff -u -r4ca4b2260f66713349c9aae32f5f4b82373c312b -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/EmptyProbabilityAssessmentOutputTreeNodeInfoTest.cs (.../EmptyProbabilityAssessmentOutputTreeNodeInfoTest.cs) (revision 4ca4b2260f66713349c9aae32f5f4b82373c312b) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/EmptyProbabilityAssessmentOutputTreeNodeInfoTest.cs (.../EmptyProbabilityAssessmentOutputTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -47,6 +47,14 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(EmptyProbabilityAssessmentOutput)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + + mocksRepository.VerifyAll(); + } + [Test] public void ContextMenuStrip_Always_CallsContextMenuBuilderMethods() { @@ -70,7 +78,7 @@ info.ContextMenuStrip(null, null, treeViewControl); } // Assert - mocksRepository.VerifyAll(); + // Assert expectancies are called in TearDown() } } } \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/FailureMechanismSectionResultContextTreeNodeInfoTest.cs =================================================================== diff -u -r4ca4b2260f66713349c9aae32f5f4b82373c312b -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/FailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../FailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision 4ca4b2260f66713349c9aae32f5f4b82373c312b) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/FailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../FailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -48,9 +48,20 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + + mocks.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(FailureMechanismSectionResultContext), info.TagType); @@ -84,12 +95,14 @@ // Assert Assert.AreEqual("Resultaat", text); - mocks.VerifyAll(); } [Test] public void Image_Always_ReturnsGenericInputOutputIcon() { + // Setup + mocks.ReplayAll(); + // Call var image = info.Image(null); @@ -119,7 +132,7 @@ info.ContextMenuStrip(null, null, treeViewControl); } // Assert - mocks.VerifyAll(); + // Assert expectancies are called in TearDown() } } } \ No newline at end of file Fisheye: Tag c9396d0af18873fda14c7e486decbfca7d4e8b21 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassConverErosionInwardsScenariosContextTreeNodeInfosTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -rc73100fd8408a2865d6fb32bd17608502686b605 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs) (revision c73100fd8408a2865d6fb32bd17608502686b605) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -43,7 +43,6 @@ using Ringtoets.GrassCoverErosionInwards.Data; using Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects; using Ringtoets.GrassCoverErosionInwards.Plugin; -using Ringtoets.GrassCoverErosionInwards.Plugin.Properties; using Ringtoets.HydraRing.Data; using Ringtoets.Integration.Data; using GrassCoverErosionInwardsFormsResources = Ringtoets.GrassCoverErosionInwards.Forms.Properties.Resources; @@ -68,9 +67,20 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(GrassCoverErosionInwardsCalculationContext)); } + public override void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + + base.TearDown(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(GrassCoverErosionInwardsCalculationContext), info.TagType); Assert.IsNotNull(info.Text); @@ -95,6 +105,9 @@ [Test] public void Image_Always_ReturnsCalculationIcon() { + // Setup + mocks.ReplayAll(); + // Call var image = info.Image(null); @@ -128,8 +141,6 @@ var emptyOutput = children[2] as EmptyProbabilityAssessmentOutput; Assert.IsNotNull(emptyOutput); - - mocks.VerifyAll(); } [Test] @@ -161,8 +172,6 @@ var output = children[2] as ProbabilityAssessmentOutput; Assert.IsNotNull(output); - - mocks.VerifyAll(); } [Test] @@ -204,7 +213,7 @@ info.ContextMenuStrip(nodeData, null, treeViewControl); } // Assert - mocks.VerifyAll(); // Expect no calls on arguments + // Assert expectancies called in TearDown() } [Test] @@ -258,7 +267,6 @@ RingtoetsCommonFormsResources.ClearIcon, false); } - mocks.VerifyAll(); } [Test] @@ -290,7 +298,6 @@ RingtoetsCommonFormsResources.CalculateIcon, false); } - mocks.VerifyAll(); } [Test] @@ -327,7 +334,6 @@ RingtoetsCommonFormsResources.CalculateIcon, false); } - mocks.VerifyAll(); } [Test] @@ -367,7 +373,6 @@ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.CalculateIcon, contextMenuItem.Image); Assert.IsFalse(contextMenuItem.Enabled); } - mocks.VerifyAll(); } [Test] @@ -413,7 +418,6 @@ RingtoetsCommonFormsResources.Calculate_ToolTip, RingtoetsCommonFormsResources.CalculateIcon); } - mocks.VerifyAll(); } [Test] @@ -445,7 +449,6 @@ RingtoetsCommonFormsResources.ValidateIcon, false); } - mocks.VerifyAll(); } [Test] @@ -482,7 +485,6 @@ RingtoetsCommonFormsResources.ValidateIcon, false); } - mocks.VerifyAll(); } [Test] @@ -522,7 +524,6 @@ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.ValidateIcon, contextMenuItem.Image); Assert.IsFalse(contextMenuItem.Enabled); } - mocks.VerifyAll(); } [Test] @@ -568,7 +569,6 @@ RingtoetsCommonFormsResources.Validate_ToolTip, RingtoetsCommonFormsResources.ValidateIcon); } - mocks.VerifyAll(); } [Test] @@ -648,7 +648,6 @@ Assert.IsNull(calculation.Output); } - mocks.VerifyAll(); } [Test] @@ -715,7 +714,6 @@ StringAssert.StartsWith(String.Format("Validatie van '{0}' beëindigd om: ", calculation.Name), msgs[1]); }); } - mocks.VerifyAll(); } [Test] @@ -752,8 +750,6 @@ // Assert Assert.AreEqual(1, group.Children.Count); CollectionAssert.DoesNotContain(group.Children, elementToBeRemoved); - - mocks.VerifyAll(); } private const int contextMenuValidateIndex = 0; Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -rc73100fd8408a2865d6fb32bd17608502686b605 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationGroupContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsCalculationGroupContextTreeNodeInfoTest.cs) (revision c73100fd8408a2865d6fb32bd17608502686b605) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationGroupContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsCalculationGroupContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -73,9 +73,20 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(GrassCoverErosionInwardsCalculationGroupContext)); } + public override void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + + base.TearDown(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(GrassCoverErosionInwardsCalculationGroupContext), info.TagType); Assert.IsNotNull(info.Text); @@ -115,7 +126,6 @@ // Assert CollectionAssert.IsEmpty(children); - mocks.VerifyAll(); } [Test] @@ -152,7 +162,6 @@ var calculationContext = (GrassCoverErosionInwardsCalculationContext) children[2]; Assert.AreSame(childCalculation, calculationContext.WrappedData); Assert.AreSame(assessmentSectionMock, calculationContext.AssessmentSection); - mocks.VerifyAll(); } [Test] @@ -198,7 +207,7 @@ } // Assert - mocks.VerifyAll(); + // Assert expectancies called in TearDown() } [Test] @@ -248,7 +257,6 @@ RingtoetsFormsResources.ClearIcon, false); } - mocks.VerifyAll(); } [Test] @@ -295,7 +303,7 @@ info.ContextMenuStrip(groupContext, parentGroupContext, treeViewControl); } // Assert - mocks.VerifyAll(); + // Assert expectancies are called in TearDown() } [Test] @@ -350,7 +358,6 @@ RingtoetsFormsResources.ClearIcon, false); } - mocks.VerifyAll(); } [Test] @@ -395,7 +402,6 @@ RingtoetsFormsResources.CalculateAllIcon, false); } - mocks.VerifyAll(); } [Test] @@ -447,7 +453,6 @@ RingtoetsFormsResources.CalculateAllIcon, false); } - mocks.VerifyAll(); } [Test] @@ -500,7 +505,6 @@ TestHelper.AssertImagesAreEqual(RingtoetsFormsResources.CalculateAllIcon, contextMenuItem.Image); Assert.IsFalse(contextMenuItem.Enabled); } - mocks.VerifyAll(); } [Test] @@ -559,7 +563,6 @@ RingtoetsFormsResources.CalculationGroup_CalculateAll_ToolTip, RingtoetsFormsResources.CalculateIcon); } - mocks.VerifyAll(); } [Test] @@ -592,7 +595,6 @@ RingtoetsFormsResources.GenerateScenariosIcon, false); } - mocks.VerifyAll(); } [Test] @@ -625,7 +627,6 @@ GrassCoverErosionInwardsPluginResources.GrassCoverErosionInwardsGuiPlugin_CreateGenerateCalculationsItem_ToolTip, RingtoetsFormsResources.GenerateScenariosIcon); } - mocks.VerifyAll(); } [Test] @@ -694,7 +695,6 @@ StringAssert.StartsWith("Validatie van 'B' beëindigd om: ", messageList[3]); }); } - mocks.VerifyAll(); } [Test] @@ -778,7 +778,6 @@ Assert.AreEqual("Uitvoeren van 'B' is mislukt.", messageList[11]); }); } - mocks.VerifyAll(); } [Test] @@ -823,7 +822,6 @@ Assert.AreEqual("Nieuwe map (1)", newlyAddedItem.Name, "An item with the same name default name already exists, therefore '(1)' needs to be appended."); } - mocks.VerifyAll(); } [Test] @@ -868,7 +866,6 @@ Assert.AreEqual("Nieuwe berekening (1)", newlyAddedItem.Name, "An item with the same name default name already exists, therefore '(1)' needs to be appended."); } - mocks.VerifyAll(); } [Test] @@ -932,7 +929,6 @@ var grassCoverErosionInwardsCalculations = failureMechanism.Calculations.OfType().ToArray(); Assert.AreEqual(1, grassCoverErosionInwardsCalculations.Length); } - mocks.VerifyAll(); } [Test] @@ -995,7 +991,6 @@ // Then Assert.AreEqual(0, failureMechanism.Calculations.OfType().Count()); } - mocks.VerifyAll(); } [Test] @@ -1067,7 +1062,6 @@ Assert.AreEqual(2, grassCoverErosionInwardsCalculations.Length); Assert.AreEqual(expectedNewName, grassCoverErosionInwardsCalculations[1].Name); } - mocks.VerifyAll(); } [Test] @@ -1101,7 +1095,6 @@ // Assert CollectionAssert.DoesNotContain(parentGroup.Children, group); - mocks.VerifyAll(); } [Test] @@ -1137,7 +1130,6 @@ // Assert CollectionAssert.DoesNotContain(parentGroup.Children, group); - mocks.VerifyAll(); } private const int contextMenuGenerateCalculationsIndexRootGroup = 1; Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsFailureMechanismContextTreeNodeInfoTest.cs =================================================================== diff -u -r4ca4b2260f66713349c9aae32f5f4b82373c312b -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsFailureMechanismContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsFailureMechanismContextTreeNodeInfoTest.cs) (revision 4ca4b2260f66713349c9aae32f5f4b82373c312b) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsFailureMechanismContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsFailureMechanismContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -66,9 +66,20 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(GrassCoverErosionInwardsFailureMechanismContext)); } + public override void TearDown() + { + plugin.Dispose(); + mocksRepository.VerifyAll(); + + base.TearDown(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocksRepository.ReplayAll(); + // Assert Assert.AreEqual(typeof(GrassCoverErosionInwardsFailureMechanismContext), info.TagType); Assert.IsNotNull(info.Text); @@ -134,8 +145,6 @@ var failureMechanismResultsContext = (FailureMechanismSectionResultContext) outputsFolder.Contents[1]; Assert.AreSame(failureMechanism, failureMechanismResultsContext.FailureMechanism); Assert.AreSame(failureMechanism.SectionResults, failureMechanismResultsContext.WrappedData); - - mocksRepository.VerifyAll(); } [Test] @@ -158,8 +167,6 @@ Assert.AreEqual(1, children.Length); var commentContext = (CommentContext) children[0]; Assert.AreSame(failureMechanism, commentContext.WrappedData); - - mocksRepository.VerifyAll(); } [Test] @@ -201,7 +208,7 @@ info.ContextMenuStrip(failureMechanismContext, null, treeViewControl); } // Assert - mocksRepository.VerifyAll(); + // Assert expectancies are called in TearDown() } [Test] @@ -235,7 +242,7 @@ info.ContextMenuStrip(failureMechanismContext, null, treeViewControl); } // Assert - mocksRepository.VerifyAll(); + // Assert expectancies are called in TearDown() } [Test] @@ -286,8 +293,6 @@ RingtoetsCommonFormsResources.CalculationGroup_ClearOutput_No_calculation_with_output_to_clear, RingtoetsCommonFormsResources.ClearIcon, false); - - mocksRepository.VerifyAll(); } } @@ -324,8 +329,6 @@ RingtoetsCommonFormsResources.FailureMechanismContextMenuStrip_Is_relevant, RingtoetsCommonFormsResources.FailureMechanismContextMenuStrip_Is_relevant_Tooltip, RingtoetsCommonFormsResources.Checkbox_ticked); - - mocksRepository.VerifyAll(); } } @@ -357,7 +360,7 @@ contextMenu.Items[contextMenuRelevancyIndexWhenRelevant].PerformClick(); } // Assert - mocksRepository.VerifyAll(); + // Assert expectancies are called in TearDown() } [Test] @@ -387,7 +390,7 @@ contextMenu.Items[contextMenuRelevancyIndexWhenNotRelevant].PerformClick(); } // Assert - mocksRepository.VerifyAll(); + // Assert expectancies are called in TearDown() } [Test] @@ -421,7 +424,6 @@ RingtoetsFormsResources.CalculateIcon, false); } - mocksRepository.VerifyAll(); } [Test] @@ -459,7 +461,6 @@ RingtoetsFormsResources.CalculateAllIcon, false); } - mocksRepository.VerifyAll(); } [Test] @@ -499,7 +500,6 @@ TestHelper.AssertImagesAreEqual(RingtoetsFormsResources.CalculateAllIcon, contextMenuItem.Image); Assert.IsFalse(contextMenuItem.Enabled); } - mocksRepository.VerifyAll(); } [Test] @@ -545,7 +545,6 @@ RingtoetsFormsResources.Calculate_all_ToolTip, RingtoetsFormsResources.CalculateAllIcon); } - mocksRepository.VerifyAll(); } [Test] @@ -578,7 +577,6 @@ RingtoetsFormsResources.ValidateIcon, false); } - mocksRepository.VerifyAll(); } [Test] @@ -616,7 +614,6 @@ RingtoetsFormsResources.ValidateAllIcon, false); } - mocksRepository.VerifyAll(); } [Test] @@ -656,7 +653,6 @@ TestHelper.AssertImagesAreEqual(RingtoetsFormsResources.ValidateAllIcon, contextMenuItem.Image); Assert.IsFalse(contextMenuItem.Enabled); } - mocksRepository.VerifyAll(); } [Test] @@ -702,7 +698,6 @@ RingtoetsFormsResources.FailureMechanism_Validate_all_ToolTip, RingtoetsFormsResources.ValidateAllIcon); } - mocksRepository.VerifyAll(); } [Test] @@ -784,7 +779,6 @@ Assert.AreEqual("Uitvoeren van 'B' is mislukt.", messageList[11]); }); } - mocksRepository.VerifyAll(); } [Test] @@ -851,7 +845,6 @@ StringAssert.StartsWith("Validatie van 'B' beëindigd om: ", messageList[3]); }); } - mocksRepository.VerifyAll(); } private const int contextMenuRelevancyIndexWhenRelevant = 1; Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsInputContextTreeNodeInfoTest.cs =================================================================== diff -u -r4ca4b2260f66713349c9aae32f5f4b82373c312b -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsInputContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsInputContextTreeNodeInfoTest.cs) (revision 4ca4b2260f66713349c9aae32f5f4b82373c312b) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsInputContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsInputContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -50,9 +50,19 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(GrassCoverErosionInwardsInputContext)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocksRepository.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocksRepository.ReplayAll(); + // Assert Assert.AreEqual(typeof(GrassCoverErosionInwardsInputContext), info.TagType); Assert.IsNotNull(info.Text); @@ -92,7 +102,6 @@ // Assert Assert.AreEqual(GrassCoverErosionInwardsFormsResources.GrassCoverErosionInwardsInputContext_NodeDisplayName, text); - mocksRepository.VerifyAll(); } [Test] @@ -113,8 +122,6 @@ // Assert TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GenericInputOutputIcon, image); - - mocksRepository.VerifyAll(); } [Test] @@ -143,7 +150,7 @@ info.ContextMenuStrip(null, null, treeViewControl); } // Assert - mocksRepository.VerifyAll(); + // Assert expectancies are called in TearDown() } } } \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsScenariosContextTreeNodeInfoTest.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsScenariosContextTreeNodeInfoTest.cs (revision 0) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsScenariosContextTreeNodeInfoTest.cs (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -0,0 +1,138 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Drawing; +using System.Linq; + +using Core.Common.Controls.TreeView; +using Core.Common.Gui; +using Core.Common.Gui.ContextMenu; +using Core.Common.TestUtil; + +using NUnit.Framework; + +using Rhino.Mocks; + +using Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects; +using Ringtoets.GrassCoverErosionInwards.Plugin; +using Ringtoets.GrassCoverErosionInwards.Plugin.Properties; + +namespace Ringtoets.GrassCoverErosionInwards.Forms.Test.TreeNodeInfos +{ + [TestFixture] + public class GrassCoverErosionInwardsScenariosContextTreeNodeInfoTest + { + private GrassCoverErosionInwardsGuiPlugin plugin; + private TreeNodeInfo info; + + [SetUp] + public void SetUp() + { + plugin = new GrassCoverErosionInwardsGuiPlugin(); + info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(GrassCoverErosionInwardsScenariosContext)); + } + + [TearDown] + public void TearDown() + { + plugin.Dispose(); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.AreEqual(typeof(GrassCoverErosionInwardsScenariosContext), info.TagType); + Assert.IsNotNull(info.Text); + Assert.IsNotNull(info.Image); + Assert.IsNotNull(info.ContextMenuStrip); + Assert.IsNull(info.ForeColor); + Assert.IsNull(info.ChildNodeObjects); + Assert.IsNull(info.EnsureVisibleOnCreate); + Assert.IsNull(info.CanRename); + Assert.IsNull(info.OnNodeRenamed); + Assert.IsNull(info.CanRemove); + Assert.IsNull(info.OnNodeRemoved); + Assert.IsNull(info.CanCheck); + Assert.IsNull(info.IsChecked); + 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_ReturnScenarios() + { + // Setup + var context = new GrassCoverErosionInwardsScenariosContext(); + + // Call + string text = info.Text(context); + + // Assert + Assert.AreEqual("Scenarios", text); + } + + [Test] + public void Image_Always_ReturnExpectedImage() + { + // Setup + var context = new GrassCoverErosionInwardsScenariosContext(); + + // Call + Image image = info.Image(context); + + // Assert + TestHelper.AssertImagesAreEqual(Resources.ScenariosIcon, image); + } + + [Test] + public void ContextMenuStrip_Always_CallsBuilder() + { + // Setup + using (var treeViewControl = new TreeViewControl()) + { + var context = new GrassCoverErosionInwardsScenariosContext(); + + var mocks = new MockRepository(); + + var menuBuilderMock = mocks.Stub(); + menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock); + menuBuilderMock.Expect(mb => mb.Build()).Return(null); + + var gui = mocks.Stub(); + gui.Expect(g => g.Get(context, treeViewControl)).Return(menuBuilderMock); + + mocks.ReplayAll(); + + plugin.Gui = gui; + + // Call + info.ContextMenuStrip(context, null, treeViewControl); + + // Assert + mocks.VerifyAll(); + } + } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/ProbabilityAssessmentOutputTreeNodeInfoTest.cs =================================================================== diff -u -r4e6c8ac0eb663ddfe4565745fb4829a8432019e2 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/ProbabilityAssessmentOutputTreeNodeInfoTest.cs (.../ProbabilityAssessmentOutputTreeNodeInfoTest.cs) (revision 4e6c8ac0eb663ddfe4565745fb4829a8432019e2) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/ProbabilityAssessmentOutputTreeNodeInfoTest.cs (.../ProbabilityAssessmentOutputTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -48,9 +48,19 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(ProbabilityAssessmentOutput)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocksRepository.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocksRepository.ReplayAll(); + // Assert Assert.AreEqual(typeof(ProbabilityAssessmentOutput), info.TagType); Assert.IsNotNull(info.Text); @@ -75,6 +85,9 @@ [Test] public void Text_Always_ReturnsFromResource() { + // Setup + mocksRepository.ReplayAll(); + // Call var text = info.Text(null); @@ -85,6 +98,9 @@ [Test] public void Image_Always_ReturnsGeneralOutputIcon() { + // Setup + mocksRepository.ReplayAll(); + // Call var image = info.Image(null); @@ -116,7 +132,7 @@ info.ContextMenuStrip(null, null, treeViewControl); } // Assert - mocksRepository.VerifyAll(); + // Assert expectancies called in TearDown() } } } \ No newline at end of file Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/EmptyProbabilityAssessmentOutputTreeNodeInfoTest.cs =================================================================== diff -u -r4e6c8ac0eb663ddfe4565745fb4829a8432019e2 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/EmptyProbabilityAssessmentOutputTreeNodeInfoTest.cs (.../EmptyProbabilityAssessmentOutputTreeNodeInfoTest.cs) (revision 4e6c8ac0eb663ddfe4565745fb4829a8432019e2) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/EmptyProbabilityAssessmentOutputTreeNodeInfoTest.cs (.../EmptyProbabilityAssessmentOutputTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -46,6 +46,13 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(EmptyProbabilityAssessmentOutput)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocksRepository.VerifyAll(); + } + [Test] public void ContextMenuStrip_Always_CallsContextMenuBuilderMethods() { @@ -58,7 +65,6 @@ menuBuilderMock.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilderMock); menuBuilderMock.Expect(mb => mb.Build()).Return(null); - using (var treeViewControl = new TreeViewControl()) { guiMock.Expect(cmp => cmp.Get(null, treeViewControl)).Return(menuBuilderMock); @@ -70,7 +76,7 @@ info.ContextMenuStrip(null, null, treeViewControl); } // Assert - mocksRepository.VerifyAll(); + // Assert expectancies are called in TearDown() } } } \ No newline at end of file Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/FailureMechanismResultContextTreeNodeInfoTest.cs =================================================================== diff -u -r4e6c8ac0eb663ddfe4565745fb4829a8432019e2 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/FailureMechanismResultContextTreeNodeInfoTest.cs (.../FailureMechanismResultContextTreeNodeInfoTest.cs) (revision 4e6c8ac0eb663ddfe4565745fb4829a8432019e2) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/FailureMechanismResultContextTreeNodeInfoTest.cs (.../FailureMechanismResultContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -50,9 +50,19 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(FailureMechanismSectionResultContext), info.TagType); Assert.IsNotNull(info.Text); @@ -77,6 +87,9 @@ [Test] public void Text_Always_ReturnsFailureMechanismSectionResultDisplayName() { + // Setup + mocks.ReplayAll(); + // Call var text = info.Text(null); @@ -87,6 +100,9 @@ [Test] public void Image_Always_ReturnsFailureMechanismSectionResultIcon() { + // Setup + mocks.ReplayAll(); + // Call var image = info.Image(null); @@ -119,7 +135,7 @@ info.ContextMenuStrip(nodeData, null, treeViewControl); } // Assert - mocks.VerifyAll(); // Expect no calls on arguments + // Assert expectancies are called in TearDown() } } } \ No newline at end of file Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -r4e6c8ac0eb663ddfe4565745fb4829a8432019e2 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationContextTreeNodeInfoTest.cs) (revision 4e6c8ac0eb663ddfe4565745fb4829a8432019e2) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -67,9 +67,20 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(HeightStructuresCalculationContext)); } + public override void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + + base.TearDown(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(HeightStructuresCalculationContext), info.TagType); Assert.IsNotNull(info.Text); @@ -94,6 +105,9 @@ [Test] public void Image_Always_ReturnsCalculationIcon() { + // Setup + mocks.ReplayAll(); + // Call var image = info.Image(null); @@ -127,8 +141,6 @@ var emptyOutput = children[2] as EmptyProbabilityAssessmentOutput; Assert.IsNotNull(emptyOutput); - - mocks.VerifyAll(); } [Test] @@ -161,8 +173,6 @@ var output = children[2] as ProbabilityAssessmentOutput; Assert.IsNotNull(output); - - mocks.VerifyAll(); } [Test] @@ -203,7 +213,7 @@ info.ContextMenuStrip(nodeData, null, treeViewControl); } // Assert - mocks.VerifyAll(); // Expect no calls on arguments + // Assert expectancies are called in TearDown() } [Test] @@ -243,7 +253,6 @@ RingtoetsCommonFormsResources.ClearIcon, false); } - mocks.VerifyAll(); } [Test] @@ -275,7 +284,6 @@ RingtoetsCommonFormsResources.CalculateIcon, false); } - mocks.VerifyAll(); } [Test] @@ -314,7 +322,6 @@ RingtoetsCommonFormsResources.CalculateIcon, false); } - mocks.VerifyAll(); } [Test] @@ -354,7 +361,6 @@ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.CalculateIcon, contextMenuItem.Image); Assert.IsFalse(contextMenuItem.Enabled); } - mocks.VerifyAll(); } [Test] @@ -400,7 +406,6 @@ RingtoetsCommonFormsResources.Calculate_ToolTip, RingtoetsCommonFormsResources.CalculateIcon); } - mocks.VerifyAll(); } [Test] @@ -480,7 +485,6 @@ Assert.IsNull(calculation.Output); } - mocks.VerifyAll(); } [Test] @@ -518,7 +522,6 @@ Assert.AreEqual(1, group.Children.Count); CollectionAssert.DoesNotContain(group.Children, elementToBeRemoved); - mocks.VerifyAll(); } private const int contextMenuCalculateIndex = 0; Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -r4e6c8ac0eb663ddfe4565745fb4829a8432019e2 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs) (revision 4e6c8ac0eb663ddfe4565745fb4829a8432019e2) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -70,9 +70,20 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(HeightStructuresCalculationGroupContext)); } + public override void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + + base.TearDown(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(HeightStructuresCalculationGroupContext), info.TagType); Assert.IsNotNull(info.Text); @@ -112,7 +123,6 @@ // Assert CollectionAssert.IsEmpty(children); - mocks.VerifyAll(); } [Test] @@ -149,7 +159,6 @@ var calculationContext = (HeightStructuresCalculationContext) children[2]; Assert.AreSame(childCalculation, calculationContext.WrappedData); Assert.AreSame(assessmentSectionMock, calculationContext.AssessmentSection); - mocks.VerifyAll(); } [Test] @@ -191,7 +200,7 @@ info.ContextMenuStrip(groupContext, null, treeViewControl); } // Assert - mocks.VerifyAll(); + // Assert expectancies called in TearDown() } [Test] @@ -238,7 +247,6 @@ RingtoetsFormsResources.ClearIcon, false); } - mocks.VerifyAll(); } [Test] @@ -285,7 +293,7 @@ info.ContextMenuStrip(groupContext, parentGroupContext, treeViewControl); } // Assert - mocks.VerifyAll(); + // Assert expectancies called in TearDown() } [Test] @@ -336,7 +344,6 @@ RingtoetsFormsResources.ClearIcon, false); } - mocks.VerifyAll(); } [Test] @@ -381,7 +388,6 @@ RingtoetsFormsResources.CalculateAllIcon, false); } - mocks.VerifyAll(); } [Test] @@ -433,7 +439,6 @@ RingtoetsFormsResources.CalculateAllIcon, false); } - mocks.VerifyAll(); } [Test] @@ -486,7 +491,6 @@ TestHelper.AssertImagesAreEqual(RingtoetsFormsResources.CalculateAllIcon, contextMenuItem.Image); Assert.IsFalse(contextMenuItem.Enabled); } - mocks.VerifyAll(); } [Test] @@ -545,7 +549,6 @@ RingtoetsFormsResources.CalculationGroup_CalculateAll_ToolTip, RingtoetsFormsResources.CalculateIcon); } - mocks.VerifyAll(); } [Test] @@ -627,7 +630,6 @@ Assert.AreEqual("Uitvoeren van 'B' is mislukt.", messageList[11]); }); } - mocks.VerifyAll(); } [Test] @@ -673,7 +675,6 @@ Assert.AreEqual("Nieuwe map (1)", newlyAddedItem.Name, "An item with the same name default name already exists, therefore '(1)' needs to be appended."); } - mocks.VerifyAll(); } [Test] @@ -718,7 +719,6 @@ Assert.AreEqual("Nieuwe berekening (1)", newlyAddedItem.Name, "An item with the same name default name already exists, therefore '(1)' needs to be appended."); } - mocks.VerifyAll(); } [Test] @@ -752,7 +752,6 @@ // Assert CollectionAssert.DoesNotContain(parentGroup.Children, group); - mocks.VerifyAll(); } [Test] @@ -788,7 +787,6 @@ // Assert CollectionAssert.DoesNotContain(parentGroup.Children, group); - mocks.VerifyAll(); } private const int contextMenuAddCalculationGroupIndexRootGroup = 1; Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresFailureMechanismContextTreeNodeInfoTest.cs =================================================================== diff -u -r4ca4b2260f66713349c9aae32f5f4b82373c312b -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresFailureMechanismContextTreeNodeInfoTest.cs (.../HeightStructuresFailureMechanismContextTreeNodeInfoTest.cs) (revision 4ca4b2260f66713349c9aae32f5f4b82373c312b) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresFailureMechanismContextTreeNodeInfoTest.cs (.../HeightStructuresFailureMechanismContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -66,9 +66,20 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(HeightStructuresFailureMechanismContext)); } + public override void TearDown() + { + plugin.Dispose(); + mocksRepository.VerifyAll(); + + base.TearDown(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocksRepository.ReplayAll(); + // Assert Assert.AreEqual(typeof(HeightStructuresFailureMechanismContext), info.TagType); Assert.IsNotNull(info.Text); @@ -127,8 +138,6 @@ var failureMechanismResultsContext = (FailureMechanismSectionResultContext) outputsFolder.Contents[0]; Assert.AreSame(failureMechanism, failureMechanismResultsContext.FailureMechanism); Assert.AreSame(failureMechanism.SectionResults, failureMechanismResultsContext.WrappedData); - - mocksRepository.VerifyAll(); } [Test] @@ -151,8 +160,6 @@ Assert.AreEqual(1, children.Length); var commentContext = (CommentContext) children[0]; Assert.AreSame(failureMechanism, commentContext.WrappedData); - - mocksRepository.VerifyAll(); } [Test] @@ -193,7 +200,7 @@ info.ContextMenuStrip(failureMechanismContext, null, treeViewControl); } // Assert - mocksRepository.VerifyAll(); + // Assert expectancies are called in TearDown() } [Test] @@ -227,7 +234,7 @@ info.ContextMenuStrip(failureMechanismContext, null, treeViewControl); } // Assert - mocksRepository.VerifyAll(); + // Assert expectancies are called in TearDown() } [Test] @@ -272,8 +279,6 @@ RingtoetsCommonFormsResources.CalculationGroup_ClearOutput_No_calculation_with_output_to_clear, RingtoetsCommonFormsResources.ClearIcon, false); - - mocksRepository.VerifyAll(); } } @@ -310,8 +315,6 @@ RingtoetsCommonFormsResources.FailureMechanismContextMenuStrip_Is_relevant, RingtoetsCommonFormsResources.FailureMechanismContextMenuStrip_Is_relevant_Tooltip, RingtoetsCommonFormsResources.Checkbox_ticked); - - mocksRepository.VerifyAll(); } } @@ -343,7 +346,7 @@ contextMenu.Items[contextMenuRelevancyIndexWhenRelevant].PerformClick(); } // Assert - mocksRepository.VerifyAll(); + // Assert expectancies are called in TearDown() } [Test] @@ -373,7 +376,7 @@ contextMenu.Items[contextMenuRelevancyIndexWhenNotRelevant].PerformClick(); } // Assert - mocksRepository.VerifyAll(); + // Assert expectancies are called in TearDown() } [Test] @@ -407,7 +410,6 @@ RingtoetsFormsResources.CalculateIcon, false); } - mocksRepository.VerifyAll(); } [Test] @@ -446,7 +448,6 @@ RingtoetsFormsResources.CalculateAllIcon, false); } - mocksRepository.VerifyAll(); } [Test] @@ -486,7 +487,6 @@ TestHelper.AssertImagesAreEqual(RingtoetsFormsResources.CalculateAllIcon, contextMenuItem.Image); Assert.IsFalse(contextMenuItem.Enabled); } - mocksRepository.VerifyAll(); } [Test] @@ -532,7 +532,6 @@ RingtoetsFormsResources.Calculate_all_ToolTip, RingtoetsFormsResources.CalculateAllIcon); } - mocksRepository.VerifyAll(); } [Test] @@ -612,7 +611,6 @@ Assert.AreEqual("Uitvoeren van 'B' is mislukt.", messageList[11]); }); } - mocksRepository.VerifyAll(); } private const int contextMenuRelevancyIndexWhenRelevant = 1; Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresInputContextTreeNodeInfoTest.cs =================================================================== diff -u -r4e6c8ac0eb663ddfe4565745fb4829a8432019e2 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresInputContextTreeNodeInfoTest.cs (.../HeightStructuresInputContextTreeNodeInfoTest.cs) (revision 4e6c8ac0eb663ddfe4565745fb4829a8432019e2) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresInputContextTreeNodeInfoTest.cs (.../HeightStructuresInputContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -50,9 +50,19 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(HeightStructuresInputContext)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocksRepository.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocksRepository.ReplayAll(); + // Assert Assert.AreEqual(typeof(HeightStructuresInputContext), info.TagType); Assert.IsNotNull(info.Text); @@ -92,7 +102,6 @@ // Assert Assert.AreEqual(HeightStructuresFormsResources.HeightStructuresInputContext_NodeDisplayName, text); - mocksRepository.VerifyAll(); } [Test] @@ -114,8 +123,6 @@ // Assert TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GenericInputOutputIcon, image); - mocksRepository.VerifyAll(); - } [Test] @@ -142,7 +149,7 @@ info.ContextMenuStrip(null, null, treeViewControl); } // Assert - mocksRepository.VerifyAll(); + // Assert expectancies are called in TearDown() } } } \ No newline at end of file Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/ProbabilisticOutputTreeNodeInfoTest.cs =================================================================== diff -u -r4e6c8ac0eb663ddfe4565745fb4829a8432019e2 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/ProbabilisticOutputTreeNodeInfoTest.cs (.../ProbabilisticOutputTreeNodeInfoTest.cs) (revision 4e6c8ac0eb663ddfe4565745fb4829a8432019e2) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/ProbabilisticOutputTreeNodeInfoTest.cs (.../ProbabilisticOutputTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -47,9 +47,19 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(ProbabilityAssessmentOutput)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocksRepository.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocksRepository.ReplayAll(); + // Assert Assert.AreEqual(typeof(ProbabilityAssessmentOutput), info.TagType); Assert.IsNotNull(info.Text); @@ -74,6 +84,9 @@ [Test] public void Text_Always_ReturnsFromResource() { + // Setup + mocksRepository.ReplayAll(); + // Call var text = info.Text(null); @@ -84,6 +97,9 @@ [Test] public void Image_Always_ReturnsGeneralOutputIcon() { + // Setup + mocksRepository.ReplayAll(); + // Call var image = info.Image(null); @@ -114,7 +130,7 @@ info.ContextMenuStrip(null, null, treeViewControl); } // Assert - mocksRepository.VerifyAll(); + // Assert expectancies are called in TearDown() } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/AssessmentSectionTreeNodeInfoTest.cs =================================================================== diff -u -r4e6c8ac0eb663ddfe4565745fb4829a8432019e2 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/AssessmentSectionTreeNodeInfoTest.cs (.../AssessmentSectionTreeNodeInfoTest.cs) (revision 4e6c8ac0eb663ddfe4565745fb4829a8432019e2) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/AssessmentSectionTreeNodeInfoTest.cs (.../AssessmentSectionTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -61,6 +61,8 @@ public void Initialized_Always_ExpectedPropertiesSet() { // Setup + mocks.ReplayAll(); + using (var plugin = new RingtoetsGuiPlugin()) { var info = GetInfo(plugin); @@ -76,6 +78,7 @@ Assert.IsNull(info.CanInsert); Assert.IsNull(info.OnDrop); } + mocks.VerifyAll(); } [Test] @@ -127,6 +130,8 @@ public void EnsureVisibleOnCreate_Always_ReturnsTrue() { // Setup + mocks.ReplayAll(); + using (var plugin = new RingtoetsGuiPlugin()) { var info = GetInfo(plugin); @@ -137,6 +142,7 @@ // Assert Assert.IsTrue(result); } + mocks.VerifyAll(); } [Test] @@ -301,6 +307,8 @@ public void CanRename_Always_ReturnsTrue() { // Setup + mocks.ReplayAll(); + using (var plugin = new RingtoetsGuiPlugin()) { var info = GetInfo(plugin); @@ -311,6 +319,7 @@ // Assert Assert.IsTrue(canRename); } + mocks.VerifyAll(); } [Test] @@ -339,6 +348,8 @@ public void CanRemove_Always_ReturnsTrue() { // Setup + mocks.ReplayAll(); + using (var plugin = new RingtoetsGuiPlugin()) { var info = GetInfo(plugin); @@ -348,6 +359,7 @@ // Assert Assert.IsTrue(canRemove); } + mocks.VerifyAll(); } [Test] Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/CategoryTreeFolderTreeNodeInfoTest.cs =================================================================== diff -u -r4e6c8ac0eb663ddfe4565745fb4829a8432019e2 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/CategoryTreeFolderTreeNodeInfoTest.cs (.../CategoryTreeFolderTreeNodeInfoTest.cs) (revision 4e6c8ac0eb663ddfe4565745fb4829a8432019e2) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/CategoryTreeFolderTreeNodeInfoTest.cs (.../CategoryTreeFolderTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -47,6 +47,8 @@ public void Initialized_Always_ExpectedPropertiesSet() { // Setup + mocks.ReplayAll(); + using (var plugin = new RingtoetsGuiPlugin()) { var info = GetInfo(plugin); @@ -66,12 +68,15 @@ Assert.IsNull(info.CanInsert); Assert.IsNull(info.OnDrop); } + mocks.VerifyAll(); } [Test] public void Text_Always_ReturnsName() { // Setup + mocks.ReplayAll(); + var testname = "testName"; var categoryTreeFolder = new CategoryTreeFolder(testname, new object[0]); @@ -85,12 +90,15 @@ // Assert Assert.AreEqual(testname, text); } + mocks.VerifyAll(); } [Test] public void Image_TreeFolderOfCategoryGeneral_ReturnsGeneralFolderIcon() { // Setup + mocks.ReplayAll(); + var categoryTreeFolder = new CategoryTreeFolder("", new object[0]); using (var plugin = new RingtoetsGuiPlugin()) @@ -103,12 +111,15 @@ // Assert TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GeneralFolderIcon, image); } + mocks.VerifyAll(); } [Test] public void Image_TreeFolderOfCategoryInput_ReturnsInputFolderIcon() { // Setup + mocks.ReplayAll(); + var categoryTreeFolder = new CategoryTreeFolder("", new object[0], TreeFolderCategory.Input); using (var plugin = new RingtoetsGuiPlugin()) @@ -121,12 +132,15 @@ // Assert TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.InputFolderIcon, image); } + mocks.VerifyAll(); } [Test] public void Image_TreeFolderOfCategoryOutput_ReturnsOutputFolderIcon() { // Setup + mocks.ReplayAll(); + var categoryTreeFolder = new CategoryTreeFolder("", new object[0], TreeFolderCategory.Output); using (var plugin = new RingtoetsGuiPlugin()) @@ -139,12 +153,15 @@ // Assert TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.OutputFolderIcon, image); } + mocks.VerifyAll(); } [Test] public void ChildNodeObjects_Always_ReturnsChildsOnData() { // Setup + mocks.ReplayAll(); + var object1 = new object(); var object2 = new object(); var categoryTreeFolder = new CategoryTreeFolder("", new[] { object1, object2 }); Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/ClosingStructureFailureMechanismSectionResultContextTreeNodeInfoTest.cs =================================================================== diff -u -r4ca4b2260f66713349c9aae32f5f4b82373c312b -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/ClosingStructureFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../ClosingStructureFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision 4ca4b2260f66713349c9aae32f5f4b82373c312b) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/ClosingStructureFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../ClosingStructureFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -49,9 +49,19 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(FailureMechanismSectionResultContext), info.TagType); @@ -85,12 +95,14 @@ // Assert Assert.AreEqual("Resultaat", text); - mocks.VerifyAll(); } [Test] public void Image_Always_ReturnsGenericInputOutputIcon() { + // Setup + mocks.ReplayAll(); + // Call var image = info.Image(null); @@ -102,13 +114,14 @@ public void ContextMenuStrip_Always_CallsBuilder() { // Setup - var gui = mocks.StrictMultiMock(); + var gui = mocks.Stub(); var menuBuilderMock = mocks.StrictMock(); using (var treeViewControl = new TreeViewControl()) { gui.Expect(g => g.Get(null, treeViewControl)).Return(menuBuilderMock); gui.Expect(g => g.ProjectOpened += null).IgnoreArguments(); + gui.Expect(g => g.ProjectOpened -= null).IgnoreArguments(); menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock); menuBuilderMock.Expect(mb => mb.Build()).Return(null); @@ -121,7 +134,7 @@ info.ContextMenuStrip(null, null, treeViewControl); } // Assert - mocks.VerifyAll(); + // Assert expectancies are called in TearDown() } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/CommentContextTreeNodeInfoTest.cs =================================================================== diff -u -r4ca4b2260f66713349c9aae32f5f4b82373c312b -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/CommentContextTreeNodeInfoTest.cs (.../CommentContextTreeNodeInfoTest.cs) (revision 4ca4b2260f66713349c9aae32f5f4b82373c312b) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/CommentContextTreeNodeInfoTest.cs (.../CommentContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -48,28 +48,31 @@ public void Initialized_Always_ExpectedPropertiesSet() { // Setup + mocks.ReplayAll(); + using (var plugin = new RingtoetsGuiPlugin()) { var info = GetInfo(plugin); - // Assert - Assert.AreEqual(typeof(CommentContext), info.TagType); - Assert.IsNull(info.EnsureVisibleOnCreate); - 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.IsChecked); - Assert.IsNull(info.OnNodeChecked); - Assert.IsNull(info.CanDrag); - Assert.IsNull(info.CanDrop); - Assert.IsNull(info.CanInsert); - Assert.IsNull(info.OnDrop); - Assert.IsNull(info.ForeColor); + // Assert + Assert.AreEqual(typeof(CommentContext), info.TagType); + Assert.IsNull(info.EnsureVisibleOnCreate); + 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.IsChecked); + Assert.IsNull(info.OnNodeChecked); + Assert.IsNull(info.CanDrag); + Assert.IsNull(info.CanDrop); + Assert.IsNull(info.CanInsert); + Assert.IsNull(info.OnDrop); + Assert.IsNull(info.ForeColor); + } + mocks.VerifyAll(); } -} [Test] public void Text_Always_ReturnsName() Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/DuneErosionFailureMechanismSectionResultContextTreeNodeInfoTest.cs =================================================================== diff -u -r4ca4b2260f66713349c9aae32f5f4b82373c312b -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/DuneErosionFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../DuneErosionFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision 4ca4b2260f66713349c9aae32f5f4b82373c312b) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/DuneErosionFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../DuneErosionFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -49,9 +49,19 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(FailureMechanismSectionResultContext), info.TagType); @@ -85,12 +95,14 @@ // Assert Assert.AreEqual("Resultaat", text); - mocks.VerifyAll(); } [Test] public void Image_Always_ReturnsGenericInputOutputIcon() { + // Setup + mocks.ReplayAll(); + // Call var image = info.Image(null); @@ -109,6 +121,7 @@ gui.Expect(g => g.Get(null, treeViewControl)).Return(menuBuilderMock); gui.Expect(g => g.ProjectOpened += null).IgnoreArguments(); + gui.Expect(g => g.ProjectOpened -= null).IgnoreArguments(); menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock); menuBuilderMock.Expect(mb => mb.Build()).Return(null); @@ -121,7 +134,7 @@ info.ContextMenuStrip(null, null, treeViewControl); } // Assert - mocks.VerifyAll(); + // Assert expectations are called in TearDown() } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/FailureMechanismContextTreeNodeInfoTest.cs =================================================================== diff -u -r4ca4b2260f66713349c9aae32f5f4b82373c312b -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/FailureMechanismContextTreeNodeInfoTest.cs (.../FailureMechanismContextTreeNodeInfoTest.cs) (revision 4ca4b2260f66713349c9aae32f5f4b82373c312b) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/FailureMechanismContextTreeNodeInfoTest.cs (.../FailureMechanismContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -62,6 +62,8 @@ public void Initialized_Always_ExpectedPropertiesSet() { // Setup + mocks.ReplayAll(); + using (var plugin = new RingtoetsGuiPlugin()) { var info = GetInfo(plugin); @@ -81,6 +83,7 @@ Assert.IsNull(info.CanInsert); Assert.IsNull(info.OnDrop); } + mocks.VerifyAll(); } [Test] @@ -110,6 +113,8 @@ public void Image_Always_ReturnsSetImage() { // Setup + mocks.ReplayAll(); + using (var plugin = new RingtoetsGuiPlugin()) { var info = GetInfo(plugin); @@ -120,6 +125,7 @@ // Assert TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.FailureMechanismIcon, image); } + mocks.VerifyAll(); } [Test] @@ -251,6 +257,7 @@ Assert.AreSame(failureMechanism, failureMechanismResultsContext.FailureMechanism); Assert.AreSame(failureMechanism.SectionResults, failureMechanismResultsContext.WrappedData); } + mocks.VerifyAll(); } [Test] Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/FailureMechanismContributionContextTreeNodeInfoTest.cs =================================================================== diff -u -r4e6c8ac0eb663ddfe4565745fb4829a8432019e2 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/FailureMechanismContributionContextTreeNodeInfoTest.cs (.../FailureMechanismContributionContextTreeNodeInfoTest.cs) (revision 4e6c8ac0eb663ddfe4565745fb4829a8432019e2) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/FailureMechanismContributionContextTreeNodeInfoTest.cs (.../FailureMechanismContributionContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -52,6 +52,8 @@ public void Initialized_Always_ExpectedPropertiesSet() { // Setup + mocks.ReplayAll(); + using (var plugin = new RingtoetsGuiPlugin()) { var info = GetInfo(plugin); @@ -73,12 +75,15 @@ Assert.IsNull(info.CanInsert); Assert.IsNull(info.OnDrop); } + mocks.VerifyAll(); } [Test] public void Text_Always_ReturnsTextFromResource() { // Setup + mocks.ReplayAll(); + using (var plugin = new RingtoetsGuiPlugin()) { var info = GetInfo(plugin); @@ -89,12 +94,15 @@ // Assert Assert.AreEqual(RingtoetsIntegrationDataResources.FailureMechanismContribution_DisplayName, text); } + mocks.VerifyAll(); } [Test] public void Image_Always_ReturnsSetImage() { // Setup + mocks.ReplayAll(); + using (var plugin = new RingtoetsGuiPlugin()) { var info = GetInfo(plugin); @@ -105,6 +113,7 @@ // Assert TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.FailureMechanismContributionIcon, image); } + mocks.VerifyAll(); } [Test] Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/FailureMechanismSectionsContextTreeNodeInfoTest.cs =================================================================== diff -u -r4e6c8ac0eb663ddfe4565745fb4829a8432019e2 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/FailureMechanismSectionsContextTreeNodeInfoTest.cs (.../FailureMechanismSectionsContextTreeNodeInfoTest.cs) (revision 4e6c8ac0eb663ddfe4565745fb4829a8432019e2) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/FailureMechanismSectionsContextTreeNodeInfoTest.cs (.../FailureMechanismSectionsContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -56,6 +56,8 @@ public void Initialized_Always_ExpectedPropertiesSet() { // Setup + mocks.ReplayAll(); + using (var plugin = new RingtoetsGuiPlugin()) { var info = GetInfo(plugin); @@ -76,12 +78,15 @@ Assert.IsNull(info.CanInsert); Assert.IsNull(info.OnDrop); } + mocks.VerifyAll(); } [Test] public void Text_Always_ReturnsName() { // Setup + mocks.ReplayAll(); + using (var plugin = new RingtoetsGuiPlugin()) { var info = GetInfo(plugin); @@ -92,12 +97,15 @@ // Assert Assert.AreEqual("Vakindeling", text); } + mocks.VerifyAll(); } [Test] public void Image_Always_ReturnSectionsIcon() { // Setup + mocks.ReplayAll(); + using (var plugin = new RingtoetsGuiPlugin()) { var info = GetInfo(plugin); @@ -108,13 +116,13 @@ // Assert TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.Sections, image); } + mocks.VerifyAll(); } [Test] public void ContextMenuStrip_Always_CallsContextMenuBuilderMethods() { // Setup - var menuBuilderMock = mocks.StrictMock(); menuBuilderMock.Expect(mb => mb.AddImportItem()).Return(menuBuilderMock); menuBuilderMock.Expect(mb => mb.Build()).Return(null); Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/GrassCoverErosionOutwardsFailureMechanismSectionResultContextTreeNodeInfoTest.cs =================================================================== diff -u -r4ca4b2260f66713349c9aae32f5f4b82373c312b -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/GrassCoverErosionOutwardsFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../GrassCoverErosionOutwardsFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision 4ca4b2260f66713349c9aae32f5f4b82373c312b) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/GrassCoverErosionOutwardsFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../GrassCoverErosionOutwardsFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -49,9 +49,19 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(FailureMechanismSectionResultContext), info.TagType); @@ -85,12 +95,14 @@ // Assert Assert.AreEqual("Resultaat", text); - mocks.VerifyAll(); } [Test] public void Image_Always_ReturnsGenericInputOutputIcon() { + // Setup + mocks.ReplayAll(); + // Call var image = info.Image(null); @@ -109,6 +121,7 @@ { gui.Expect(g => g.Get(null, treeViewControl)).Return(menuBuilderMock); gui.Expect(g => g.ProjectOpened += null).IgnoreArguments(); + gui.Expect(g => g.ProjectOpened -= null).IgnoreArguments(); menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock); menuBuilderMock.Expect(mb => mb.Build()).Return(null); @@ -121,7 +134,7 @@ info.ContextMenuStrip(null, null, treeViewControl); } // Assert - mocks.VerifyAll(); + // Assert expectancies are called in TearDown() } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/GrassCoverSlipOffInwardsFailureMechanismSectionResultContextTreeNodeInfoTest.cs =================================================================== diff -u -r4ca4b2260f66713349c9aae32f5f4b82373c312b -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/GrassCoverSlipOffInwardsFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../GrassCoverSlipOffInwardsFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision 4ca4b2260f66713349c9aae32f5f4b82373c312b) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/GrassCoverSlipOffInwardsFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../GrassCoverSlipOffInwardsFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -49,9 +49,19 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(FailureMechanismSectionResultContext), info.TagType); @@ -85,12 +95,14 @@ // Assert Assert.AreEqual("Resultaat", text); - mocks.VerifyAll(); } [Test] public void Image_Always_ReturnsGenericInputOutputIcon() { + // Setup + mocks.ReplayAll(); + // Call var image = info.Image(null); @@ -109,6 +121,7 @@ { gui.Expect(g => g.Get(null, treeViewControl)).Return(menuBuilderMock); gui.Expect(g => g.ProjectOpened += null).IgnoreArguments(); + gui.Expect(g => g.ProjectOpened -= null).IgnoreArguments(); menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock); menuBuilderMock.Expect(mb => mb.Build()).Return(null); @@ -121,7 +134,7 @@ info.ContextMenuStrip(null, null, treeViewControl); } // Assert - mocks.VerifyAll(); + // Assert expectancies are called in TearDown() } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/GrassCoverSlipOffOutwardsFailureMechanismSectionResultContextTreeNodeInfoTest.cs =================================================================== diff -u -r4ca4b2260f66713349c9aae32f5f4b82373c312b -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/GrassCoverSlipOffOutwardsFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../GrassCoverSlipOffOutwardsFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision 4ca4b2260f66713349c9aae32f5f4b82373c312b) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/GrassCoverSlipOffOutwardsFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../GrassCoverSlipOffOutwardsFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -49,9 +49,19 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(FailureMechanismSectionResultContext), info.TagType); @@ -85,12 +95,14 @@ // Assert Assert.AreEqual("Resultaat", text); - mocks.VerifyAll(); } [Test] public void Image_Always_ReturnsGenericInputOutputIcon() { + // Setup + mocks.ReplayAll(); + // Call var image = info.Image(null); @@ -109,6 +121,7 @@ { gui.Expect(g => g.Get(null, treeViewControl)).Return(menuBuilderMock); gui.Expect(g => g.ProjectOpened += null).IgnoreArguments(); + gui.Expect(g => g.ProjectOpened -= null).IgnoreArguments(); menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock); menuBuilderMock.Expect(mb => mb.Build()).Return(null); @@ -121,7 +134,7 @@ info.ContextMenuStrip(null, null, treeViewControl); } // Assert - mocks.VerifyAll(); + // Assert expectancies are called in TearDown() } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs =================================================================== diff -u -r4e6c8ac0eb663ddfe4565745fb4829a8432019e2 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs (.../HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs) (revision 4e6c8ac0eb663ddfe4565745fb4829a8432019e2) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs (.../HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -56,6 +56,8 @@ public void Initialized_Always_ExpectedPropertiesSet() { // Setup + mocks.ReplayAll(); + using (var plugin = new RingtoetsGuiPlugin()) { var info = GetInfo(plugin); @@ -70,6 +72,7 @@ Assert.IsNull(info.CanInsert); Assert.IsNull(info.OnDrop); } + mocks.VerifyAll(); } [Test] @@ -100,6 +103,8 @@ public void Image_Always_ReturnsGenericIcon() { // Setup + mocks.ReplayAll(); + using (var plugin = new RingtoetsGuiPlugin()) { var info = GetInfo(plugin); @@ -110,12 +115,15 @@ // Assert TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GenericInputOutputIcon, image); } + mocks.VerifyAll(); } [Test] public void CanRenameNode_Always_ReturnsFalse() { // Setup + mocks.ReplayAll(); + using (var plugin = new RingtoetsGuiPlugin()) { var info = GetInfo(plugin); @@ -126,6 +134,7 @@ // Assert Assert.IsFalse(renameAllowed); } + mocks.VerifyAll(); } [Test] Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/MacrostabilityInwardsFailureMechanismSectionResultContextTreeNodeInfoTest.cs =================================================================== diff -u -r4ca4b2260f66713349c9aae32f5f4b82373c312b -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/MacrostabilityInwardsFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../MacrostabilityInwardsFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision 4ca4b2260f66713349c9aae32f5f4b82373c312b) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/MacrostabilityInwardsFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../MacrostabilityInwardsFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -49,9 +49,19 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(FailureMechanismSectionResultContext), info.TagType); @@ -85,12 +95,14 @@ // Assert Assert.AreEqual("Resultaat", text); - mocks.VerifyAll(); } [Test] public void Image_Always_ReturnsGenericInputOutputIcon() { + // Setup + mocks.ReplayAll(); + // Call var image = info.Image(null); @@ -109,6 +121,7 @@ { gui.Expect(g => g.Get(null, treeViewControl)).Return(menuBuilderMock); gui.Expect(g => g.ProjectOpened += null).IgnoreArguments(); + gui.Expect(g => g.ProjectOpened -= null).IgnoreArguments(); menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock); menuBuilderMock.Expect(mb => mb.Build()).Return(null); @@ -121,7 +134,7 @@ info.ContextMenuStrip(null, null, treeViewControl); } // Assert - mocks.VerifyAll(); + // Assert expectancies are called in TearDown() } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/MacrostabilityOutwardsFailureMechanismSectionResultContextTreeNodeInfoTest.cs =================================================================== diff -u -r4ca4b2260f66713349c9aae32f5f4b82373c312b -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/MacrostabilityOutwardsFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../MacrostabilityOutwardsFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision 4ca4b2260f66713349c9aae32f5f4b82373c312b) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/MacrostabilityOutwardsFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../MacrostabilityOutwardsFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -49,9 +49,19 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(FailureMechanismSectionResultContext), info.TagType); @@ -85,12 +95,14 @@ // Assert Assert.AreEqual("Resultaat", text); - mocks.VerifyAll(); } [Test] public void Image_Always_ReturnsGenericInputOutputIcon() { + // Setup + mocks.ReplayAll(); + // Call var image = info.Image(null); @@ -109,6 +121,7 @@ { gui.Expect(g => g.Get(null, treeViewControl)).Return(menuBuilderMock); gui.Expect(g => g.ProjectOpened += null).IgnoreArguments(); + gui.Expect(g => g.ProjectOpened -= null).IgnoreArguments(); menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock); menuBuilderMock.Expect(mb => mb.Build()).Return(null); @@ -121,7 +134,7 @@ info.ContextMenuStrip(null, null, treeViewControl); } // Assert - mocks.VerifyAll(); + // Assert expectancies are called in TearDown() } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/MicrostabilityFailureMechanismSectionResultContextTreeNodeInfoTest.cs =================================================================== diff -u -r4ca4b2260f66713349c9aae32f5f4b82373c312b -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/MicrostabilityFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../MicrostabilityFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision 4ca4b2260f66713349c9aae32f5f4b82373c312b) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/MicrostabilityFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../MicrostabilityFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -49,9 +49,19 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(FailureMechanismSectionResultContext), info.TagType); @@ -85,12 +95,14 @@ // Assert Assert.AreEqual("Resultaat", text); - mocks.VerifyAll(); } [Test] public void Image_Always_ReturnsGenericInputOutputIcon() { + // Setup + mocks.ReplayAll(); + // Call var image = info.Image(null); @@ -109,6 +121,7 @@ { gui.Expect(g => g.Get(null, treeViewControl)).Return(menuBuilderMock); gui.Expect(g => g.ProjectOpened += null).IgnoreArguments(); + gui.Expect(g => g.ProjectOpened -= null).IgnoreArguments(); menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock); menuBuilderMock.Expect(mb => mb.Build()).Return(null); @@ -121,7 +134,7 @@ info.ContextMenuStrip(null, null, treeViewControl); } // Assert - mocks.VerifyAll(); + // Assert expectancies are called in TearDown() } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/PipingStructureFailureMechanismSectionResultContextTreeNodeInfoTest.cs =================================================================== diff -u -r4ca4b2260f66713349c9aae32f5f4b82373c312b -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/PipingStructureFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../PipingStructureFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision 4ca4b2260f66713349c9aae32f5f4b82373c312b) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/PipingStructureFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../PipingStructureFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -49,9 +49,19 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(FailureMechanismSectionResultContext), info.TagType); @@ -85,12 +95,14 @@ // Assert Assert.AreEqual("Resultaat", text); - mocks.VerifyAll(); } [Test] public void Image_Always_ReturnsGenericInputOutputIcon() { + // Setup + mocks.ReplayAll(); + // Call var image = info.Image(null); @@ -109,6 +121,7 @@ { gui.Expect(g => g.Get(null, treeViewControl)).Return(menuBuilderMock); gui.Expect(g => g.ProjectOpened += null).IgnoreArguments(); + gui.Expect(g => g.ProjectOpened -= null).IgnoreArguments(); menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock); menuBuilderMock.Expect(mb => mb.Build()).Return(null); @@ -121,7 +134,7 @@ info.ContextMenuStrip(null, null, treeViewControl); } // Assert - mocks.VerifyAll(); + // Assert expectancies are called in TearDown() } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/ReferenceLineContextTreeNodeInfoTest.cs =================================================================== diff -u -r4e6c8ac0eb663ddfe4565745fb4829a8432019e2 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/ReferenceLineContextTreeNodeInfoTest.cs (.../ReferenceLineContextTreeNodeInfoTest.cs) (revision 4e6c8ac0eb663ddfe4565745fb4829a8432019e2) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/ReferenceLineContextTreeNodeInfoTest.cs (.../ReferenceLineContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -54,6 +54,8 @@ public void Initialized_Always_ExpectedPropertiesSet() { // Setup + mocks.ReplayAll(); + using (var plugin = new RingtoetsGuiPlugin()) { var info = GetInfo(plugin); @@ -74,6 +76,7 @@ Assert.IsNull(info.CanInsert); Assert.IsNull(info.OnDrop); } + mocks.VerifyAll(); } [Test] Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/StabilityStoneCoverFailureMechanismSectionResultContextTreeNodeInfoTest.cs =================================================================== diff -u -r4ca4b2260f66713349c9aae32f5f4b82373c312b -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/StabilityStoneCoverFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../StabilityStoneCoverFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision 4ca4b2260f66713349c9aae32f5f4b82373c312b) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/StabilityStoneCoverFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../StabilityStoneCoverFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -49,9 +49,19 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(FailureMechanismSectionResultContext), info.TagType); @@ -85,12 +95,14 @@ // Assert Assert.AreEqual("Resultaat", text); - mocks.VerifyAll(); } [Test] public void Image_Always_ReturnsGenericInputOutputIcon() { + // Setup + mocks.ReplayAll(); + // Call var image = info.Image(null); @@ -102,17 +114,17 @@ public void ContextMenuStrip_Always_CallsBuilder() { // Setup - var gui = mocks.StrictMultiMock(); var menuBuilderMock = mocks.StrictMock(); + menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock); + menuBuilderMock.Expect(mb => mb.Build()).Return(null); using (var treeViewControl = new TreeViewControl()) { + var gui = mocks.StrictMultiMock(); gui.Expect(g => g.Get(null, treeViewControl)).Return(menuBuilderMock); gui.Expect(g => g.ProjectOpened += null).IgnoreArguments(); + gui.Expect(g => g.ProjectOpened -= null).IgnoreArguments(); - menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock); - menuBuilderMock.Expect(mb => mb.Build()).Return(null); - mocks.ReplayAll(); plugin.Gui = gui; @@ -121,7 +133,7 @@ info.ContextMenuStrip(null, null, treeViewControl); } // Assert - mocks.VerifyAll(); + // Assert expectancies are called in TearDown() } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultContextTreeNodeInfoTest.cs =================================================================== diff -u -r4ca4b2260f66713349c9aae32f5f4b82373c312b -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision 4ca4b2260f66713349c9aae32f5f4b82373c312b) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -49,9 +49,19 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(FailureMechanismSectionResultContext), info.TagType); @@ -85,12 +95,14 @@ // Assert Assert.AreEqual("Resultaat", text); - mocks.VerifyAll(); } [Test] public void Image_Always_ReturnsGenericInputOutputIcon() { + // Setup + mocks.ReplayAll(); + // Call var image = info.Image(null); @@ -102,17 +114,17 @@ public void ContextMenuStrip_Always_CallsBuilder() { // Setup - var gui = mocks.StrictMultiMock(); var menuBuilderMock = mocks.StrictMock(); + menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock); + menuBuilderMock.Expect(mb => mb.Build()).Return(null); using (var treeViewControl = new TreeViewControl()) { + var gui = mocks.StrictMultiMock(); gui.Expect(g => g.Get(null, treeViewControl)).Return(menuBuilderMock); gui.Expect(g => g.ProjectOpened += null).IgnoreArguments(); + gui.Expect(g => g.ProjectOpened -= null).IgnoreArguments(); - menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock); - menuBuilderMock.Expect(mb => mb.Build()).Return(null); - mocks.ReplayAll(); plugin.Gui = gui; @@ -121,7 +133,7 @@ info.ContextMenuStrip(null, null, treeViewControl); } // Assert - mocks.VerifyAll(); + // Assert expectancies are called in TearDown() } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/StrengthStabilityPointwiseConstructionFailureMechanismSectionResultContextTreeNodeInfoTest.cs =================================================================== diff -u -r4ca4b2260f66713349c9aae32f5f4b82373c312b -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/StrengthStabilityPointwiseConstructionFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../StrengthStabilityPointwiseConstructionFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision 4ca4b2260f66713349c9aae32f5f4b82373c312b) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/StrengthStabilityPointwiseConstructionFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../StrengthStabilityPointwiseConstructionFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -49,9 +49,19 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(FailureMechanismSectionResultContext), info.TagType); @@ -85,12 +95,14 @@ // Assert Assert.AreEqual("Resultaat", text); - mocks.VerifyAll(); } [Test] public void Image_Always_ReturnsGenericInputOutputIcon() { + // Setup + mocks.ReplayAll(); + // Call var image = info.Image(null); @@ -102,17 +114,17 @@ public void ContextMenuStrip_Always_CallsBuilder() { // Setup - var gui = mocks.StrictMultiMock(); var menuBuilderMock = mocks.StrictMock(); + menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock); + menuBuilderMock.Expect(mb => mb.Build()).Return(null); using (var treeViewControl = new TreeViewControl()) { + var gui = mocks.StrictMultiMock(); gui.Expect(g => g.Get(null, treeViewControl)).Return(menuBuilderMock); gui.Expect(g => g.ProjectOpened += null).IgnoreArguments(); + gui.Expect(g => g.ProjectOpened -= null).IgnoreArguments(); - menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock); - menuBuilderMock.Expect(mb => mb.Build()).Return(null); - mocks.ReplayAll(); plugin.Gui = gui; @@ -121,7 +133,7 @@ info.ContextMenuStrip(null, null, treeViewControl); } // Assert - mocks.VerifyAll(); + // Assert expectancies are called in TearDown() } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/TechnicalInnovationFailureMechanismSectionResultContextTreeNodeInfoTest.cs =================================================================== diff -u -r4ca4b2260f66713349c9aae32f5f4b82373c312b -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/TechnicalInnovationFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../TechnicalInnovationFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision 4ca4b2260f66713349c9aae32f5f4b82373c312b) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/TechnicalInnovationFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../TechnicalInnovationFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -49,9 +49,19 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(FailureMechanismSectionResultContext), info.TagType); @@ -85,12 +95,14 @@ // Assert Assert.AreEqual("Resultaat", text); - mocks.VerifyAll(); } [Test] public void Image_Always_ReturnsGenericInputOutputIcon() { + // Setup + mocks.ReplayAll(); + // Call var image = info.Image(null); @@ -102,17 +114,17 @@ public void ContextMenuStrip_Always_CallsBuilder() { // Setup - var gui = mocks.StrictMultiMock(); var menuBuilderMock = mocks.StrictMock(); + menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock); + menuBuilderMock.Expect(mb => mb.Build()).Return(null); using (var treeViewControl = new TreeViewControl()) { + var gui = mocks.StrictMultiMock(); gui.Expect(g => g.Get(null, treeViewControl)).Return(menuBuilderMock); gui.Expect(g => g.ProjectOpened += null).IgnoreArguments(); + gui.Expect(g => g.ProjectOpened -= null).IgnoreArguments(); - menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock); - menuBuilderMock.Expect(mb => mb.Build()).Return(null); - mocks.ReplayAll(); plugin.Gui = gui; @@ -121,7 +133,7 @@ info.ContextMenuStrip(null, null, treeViewControl); } // Assert - mocks.VerifyAll(); + // Assert expectancies are called in TearDown() } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/WaterPressureAsphaltCoverFailureMechanismSectionResultContextTreeNodeInfoTest.cs =================================================================== diff -u -r4ca4b2260f66713349c9aae32f5f4b82373c312b -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/WaterPressureAsphaltCoverFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../WaterPressureAsphaltCoverFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision 4ca4b2260f66713349c9aae32f5f4b82373c312b) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/WaterPressureAsphaltCoverFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../WaterPressureAsphaltCoverFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -49,9 +49,19 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(FailureMechanismSectionResultContext), info.TagType); @@ -85,12 +95,14 @@ // Assert Assert.AreEqual("Resultaat", text); - mocks.VerifyAll(); } [Test] public void Image_Always_ReturnsGenericInputOutputIcon() { + // Setup + mocks.ReplayAll(); + // Call var image = info.Image(null); @@ -102,17 +114,17 @@ public void ContextMenuStrip_Always_CallsBuilder() { // Setup - var gui = mocks.StrictMultiMock(); var menuBuilderMock = mocks.StrictMock(); - + menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock); + menuBuilderMock.Expect(mb => mb.Build()).Return(null); + using (var treeViewControl = new TreeViewControl()) { + var gui = mocks.StrictMultiMock(); gui.Expect(g => g.Get(null, treeViewControl)).Return(menuBuilderMock); gui.Expect(g => g.ProjectOpened += null).IgnoreArguments(); + gui.Expect(g => g.ProjectOpened -= null).IgnoreArguments(); - menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock); - menuBuilderMock.Expect(mb => mb.Build()).Return(null); - mocks.ReplayAll(); plugin.Gui = gui; @@ -121,7 +133,7 @@ info.ContextMenuStrip(null, null, treeViewControl); } // Assert - mocks.VerifyAll(); + // Assert expectancies are called in TearDown() } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/WaveImpactAsphaltCoverFailureMechanismSectionResultContextTreeNodeInfoTest.cs =================================================================== diff -u -r4ca4b2260f66713349c9aae32f5f4b82373c312b -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/WaveImpactAsphaltCoverFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../WaveImpactAsphaltCoverFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision 4ca4b2260f66713349c9aae32f5f4b82373c312b) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/WaveImpactAsphaltCoverFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../WaveImpactAsphaltCoverFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -49,9 +49,19 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(FailureMechanismSectionResultContext), info.TagType); @@ -91,6 +101,9 @@ [Test] public void Image_Always_ReturnsGenericInputOutputIcon() { + // Setup + mocks.ReplayAll(); + // Call var image = info.Image(null); @@ -102,17 +115,17 @@ public void ContextMenuStrip_Always_CallsBuilder() { // Setup - var gui = mocks.StrictMultiMock(); var menuBuilderMock = mocks.StrictMock(); - + menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock); + menuBuilderMock.Expect(mb => mb.Build()).Return(null); + using (var treeViewControl = new TreeViewControl()) { + var gui = mocks.StrictMock(); gui.Expect(g => g.Get(null, treeViewControl)).Return(menuBuilderMock); - gui.Expect(g => g.ProjectOpened += null).IgnoreArguments(); + gui.Stub(g => g.ProjectOpened += null).IgnoreArguments(); + gui.Stub(g => g.ProjectOpened -= null).IgnoreArguments(); - menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock); - menuBuilderMock.Expect(mb => mb.Build()).Return(null); - mocks.ReplayAll(); plugin.Gui = gui; @@ -121,7 +134,7 @@ info.ContextMenuStrip(null, null, treeViewControl); } // Assert - mocks.VerifyAll(); + // Expectancies will be tested in TearDown() } } } \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/EmptyPipingOutputTreeNodeInfoTest.cs =================================================================== diff -u -r4e6c8ac0eb663ddfe4565745fb4829a8432019e2 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/EmptyPipingOutputTreeNodeInfoTest.cs (.../EmptyPipingOutputTreeNodeInfoTest.cs) (revision 4e6c8ac0eb663ddfe4565745fb4829a8432019e2) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/EmptyPipingOutputTreeNodeInfoTest.cs (.../EmptyPipingOutputTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -28,9 +28,19 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(EmptyPipingOutput)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(EmptyPipingOutput), info.TagType); Assert.IsNull(info.EnsureVisibleOnCreate); @@ -51,6 +61,9 @@ [Test] public void Text_Always_ReturnsFromResource() { + // Setup + mocks.ReplayAll(); + // Call var text = info.Text(null); @@ -61,6 +74,9 @@ [Test] public void Image_Always_ReturnsGeneralOutputIcon() { + // Setup + mocks.ReplayAll(); + // Call var image = info.Image(null); @@ -71,6 +87,9 @@ [Test] public void ForeColor_Always_ReturnsGrayText() { + // Setup + mocks.ReplayAll(); + // Call var textColor = info.ForeColor(null); @@ -82,16 +101,15 @@ public void ContextMenuStrip_Always_CallsContextMenuBuilderMethods() { // Setup - var gui = mocks.StrictMock(); var menuBuilderMock = mocks.StrictMock(); - menuBuilderMock.Expect(mb => mb.AddExportItem()).Return(menuBuilderMock); menuBuilderMock.Expect(mb => mb.AddSeparator()).Return(menuBuilderMock); menuBuilderMock.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilderMock); menuBuilderMock.Expect(mb => mb.Build()).Return(null); using (var treeViewControl = new TreeViewControl()) { + var gui = mocks.StrictMock(); gui.Expect(cmp => cmp.Get(null, treeViewControl)).Return(menuBuilderMock); mocks.ReplayAll(); @@ -101,7 +119,7 @@ info.ContextMenuStrip(null, null, treeViewControl); } // Assert - mocks.VerifyAll(); + // Assert expectacies are called in TearDown() } } } \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/FailureMechanismSectionResultContextTreeNodeInfoTest.cs =================================================================== diff -u -r4e6c8ac0eb663ddfe4565745fb4829a8432019e2 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/FailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../FailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision 4e6c8ac0eb663ddfe4565745fb4829a8432019e2) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/FailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../FailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -48,9 +48,19 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(FailureMechanismSectionResultContext), info.TagType); @@ -84,12 +94,14 @@ // Assert Assert.AreEqual("Resultaat", text); - mocks.VerifyAll(); } [Test] public void Image_Always_ReturnsGenericInputOutputIcon() { + // Setup + mocks.ReplayAll(); + // Call var image = info.Image(null); @@ -101,14 +113,13 @@ public void ContextMenuStrip_Always_CallsBuilder() { // Setup - var gui = mocks.StrictMultiMock(); var menuBuilderMock = mocks.StrictMock(); - menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock); menuBuilderMock.Expect(mb => mb.Build()).Return(null); using (var treeViewControl = new TreeViewControl()) { + var gui = mocks.StrictMultiMock(); gui.Expect(g => g.Get(null, treeViewControl)).Return(menuBuilderMock); mocks.ReplayAll(); @@ -119,7 +130,7 @@ info.ContextMenuStrip(null, null, treeViewControl); } // Assert - mocks.VerifyAll(); + // Assert expectancies are called in TearDown() } } } \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -r4e6c8ac0eb663ddfe4565745fb4829a8432019e2 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs (.../PipingCalculationGroupContextTreeNodeInfoTest.cs) (revision 4e6c8ac0eb663ddfe4565745fb4829a8432019e2) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs (.../PipingCalculationGroupContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -71,9 +71,20 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(PipingCalculationGroupContext)); } + public override void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + + base.TearDown(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(PipingCalculationGroupContext), info.TagType); Assert.IsNull(info.ForeColor); @@ -102,7 +113,6 @@ // Assert CollectionAssert.IsEmpty(children); - mocks.VerifyAll(); } [Test] @@ -144,7 +154,6 @@ Assert.AreSame(childGroup, returnedCalculationGroupContext.WrappedData); Assert.AreSame(pipingFailureMechanism, returnedCalculationGroupContext.FailureMechanism); Assert.AreSame(assessmentSectionMock, returnedCalculationGroupContext.AssessmentSection); - mocks.VerifyAll(); } [Test] @@ -267,8 +276,6 @@ menu.Items[12], menu.Items[15] }, typeof(ToolStripSeparator)); - - mocks.VerifyAll(); } [Test] @@ -374,7 +381,6 @@ menu.Items[16] }, typeof(ToolStripSeparator)); } - mocks.VerifyAll(); } [Test] @@ -416,7 +422,6 @@ RingtoetsCommonFormsResources.GenerateScenariosIcon, false); } - mocks.VerifyAll(); } [Test] @@ -458,7 +463,6 @@ RingtoetsCommonFormsResources.GenerateScenariosIcon, false); } - mocks.VerifyAll(); } [Test] @@ -502,7 +506,6 @@ PipingFormsResources.PipingCalculationGroup_Generate_PipingCalculations_ToolTip, RingtoetsCommonFormsResources.GenerateScenariosIcon); } - mocks.VerifyAll(); } [Test] @@ -547,7 +550,6 @@ Assert.AreEqual(RingtoetsCommonFormsResources.FailureMechanism_CreateCalculateAllItem_No_calculations_to_run, calculateItem.ToolTipText); Assert.AreEqual(RingtoetsCommonFormsResources.FailureMechanism_CreateValidateAllItem_No_calculations_to_validate, validateItem.ToolTipText); } - mocks.VerifyAll(); // Expect no calls on arguments } [Test] @@ -605,7 +607,6 @@ Assert.AreEqual("Nieuwe map (1)", newlyAddedItem.Name, "An item with the same name default name already exists, therefore '(1)' needs to be appended."); } - mocks.VerifyAll(); } [Test] @@ -663,7 +664,6 @@ Assert.AreEqual("Nieuwe berekening (1)", newlyAddedItem.Name, "An item with the same name default name already exists, therefore '(1)' needs to be appended."); } - mocks.VerifyAll(); } [Test] @@ -729,7 +729,6 @@ StringAssert.StartsWith(String.Format("Validatie van '{0}' beëindigd om: ", invalidCalculation.Name), msgs[8]); }); } - mocks.VerifyAll(); } [Test] @@ -799,7 +798,6 @@ contextMenu.Items[contextMenuCalculateAllIndex].PerformClick(); } // Assert - mocks.VerifyAll(); } [Test] @@ -890,7 +888,6 @@ Assert.AreEqual("Bevestigen", messageBoxTitle); Assert.AreEqual("Weet u zeker dat u alle uitvoer wilt wissen?", messageBoxText); } - mocks.VerifyAll(); } [Test] @@ -955,7 +952,6 @@ Assert.NotNull(grid); Assert.AreEqual(2, rowCount); } - mocks.VerifyAll(); } [Test] @@ -1065,7 +1061,6 @@ CollectionAssert.IsEmpty(failureMechanismSectionResult2.GetCalculationScenarios(pipingCalculationScenarios)); } - mocks.VerifyAll(); } [Test] @@ -1175,7 +1170,6 @@ CollectionAssert.IsEmpty(failureMechanismSectionResult.GetCalculationScenarios(pipingFailureMechanism.Calculations.OfType())); } } - mocks.VerifyAll(); } [Test] @@ -1212,7 +1206,6 @@ // Assert CollectionAssert.DoesNotContain(parentGroup.Children, group); - mocks.VerifyAll(); } [Test] @@ -1264,7 +1257,6 @@ // Assert CollectionAssert.DoesNotContain(parentGroup.Children, group); CollectionAssert.DoesNotContain(sectionResults[0].GetCalculationScenarios(pipingFailureMechanism.Calculations.OfType()), calculation); - mocks.VerifyAll(); } private const int contextMenuAddGenerateCalculationsIndex = 1; Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationScenarioContextTreeNodeInfoTest.cs =================================================================== diff -u -rd08c15413bbb6009c6da8ee05833a4c3531b358c -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationScenarioContextTreeNodeInfoTest.cs (.../PipingCalculationScenarioContextTreeNodeInfoTest.cs) (revision d08c15413bbb6009c6da8ee05833a4c3531b358c) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationScenarioContextTreeNodeInfoTest.cs (.../PipingCalculationScenarioContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -70,9 +70,20 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(PipingCalculationScenarioContext)); } + public override void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + + base.TearDown(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(PipingCalculationScenarioContext), info.TagType); Assert.IsNull(info.ForeColor); @@ -87,6 +98,9 @@ [Test] public void Image_Always_ReturnsPipingIcon() { + // Setup + mocks.ReplayAll(); + // Call var image = info.Image(null); @@ -204,7 +218,6 @@ TestHelper.AssertContextMenuStripContainsItem(contextMenu, 1, RingtoetsCommonFormsResources.Calculate, RingtoetsCommonFormsResources.Calculate_ToolTip, RingtoetsCommonFormsResources.CalculateIcon); TestHelper.AssertContextMenuStripContainsItem(contextMenu, 2, RingtoetsCommonFormsResources.Clear_output, RingtoetsCommonFormsResources.ClearOutput_No_output_to_clear, RingtoetsCommonFormsResources.ClearIcon, false); } - mocks.VerifyAll(); // Expect no calls on arguments } [Test] @@ -245,7 +258,6 @@ TestHelper.AssertContextMenuStripContainsItem(contextMenu, 1, RingtoetsCommonFormsResources.Calculate, RingtoetsCommonFormsResources.Calculate_ToolTip, RingtoetsCommonFormsResources.CalculateIcon); TestHelper.AssertContextMenuStripContainsItem(contextMenu, 2, RingtoetsCommonFormsResources.Clear_output, RingtoetsCommonFormsResources.Clear_output_ToolTip, RingtoetsCommonFormsResources.ClearIcon); } - mocks.VerifyAll(); // Expect no calls on arguments } [Test] @@ -291,7 +303,7 @@ } // Assert - mocks.VerifyAll(); // Expect no calls on arguments + // Assert expectancies are called in TearDown() } [Test] @@ -335,8 +347,6 @@ // Assert Assert.AreEqual(1, group.Children.Count); CollectionAssert.DoesNotContain(group.Children, elementToBeRemoved); - - mocks.VerifyAll(); } [Test] @@ -392,8 +402,6 @@ Assert.AreEqual(1, group.Children.Count); CollectionAssert.DoesNotContain(group.Children, elementToBeRemoved); CollectionAssert.DoesNotContain(sectionResults[0].GetCalculationScenarios(pipingFailureMechanism.Calculations.OfType()), elementToBeRemoved); - - mocks.VerifyAll(); } [Test] @@ -460,7 +468,6 @@ }); Assert.IsNull(calculation.Output); } - mocks.VerifyAll(); } [Test] @@ -503,7 +510,6 @@ var expectedLogMessageCount = expectedValidationMessageCount + expectedStatusMessageCount; TestHelper.AssertLogMessagesCount(action, expectedLogMessageCount); } - mocks.VerifyAll(); } [Test] @@ -569,7 +575,6 @@ }); Assert.IsNotNull(calculation.Output); } - mocks.VerifyAll(); } [Test] @@ -633,7 +638,6 @@ 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/PipingFailureMechanismContextTreeNodeInfoTest.cs =================================================================== diff -u -r4e6c8ac0eb663ddfe4565745fb4829a8432019e2 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingFailureMechanismContextTreeNodeInfoTest.cs (.../PipingFailureMechanismContextTreeNodeInfoTest.cs) (revision 4e6c8ac0eb663ddfe4565745fb4829a8432019e2) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingFailureMechanismContextTreeNodeInfoTest.cs (.../PipingFailureMechanismContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -72,9 +72,20 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(PipingFailureMechanismContext)); } + public override void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + + base.TearDown(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(PipingFailureMechanismContext), info.TagType); Assert.IsNotNull(info.ForeColor); @@ -107,12 +118,14 @@ // Assert Assert.AreEqual("Dijken en dammen - Piping", text); - mocks.VerifyAll(); } [Test] public void Image_Always_ReturnsPipingIcon() { + // Setup + mocks.ReplayAll(); + // Call var image = info.Image(null); @@ -173,7 +186,6 @@ var failureMechanismResultsContext = (FailureMechanismSectionResultContext)outputsFolder.Contents[0]; Assert.AreSame(pipingFailureMechanism, failureMechanismResultsContext.FailureMechanism); Assert.AreSame(pipingFailureMechanism.SectionResults, failureMechanismResultsContext.WrappedData); - mocks.VerifyAll(); } [Test] @@ -200,7 +212,6 @@ Assert.AreEqual(1, children.Length); var commentContext = (CommentContext)children[0]; Assert.AreSame(pipingFailureMechanism, commentContext.WrappedData); - mocks.VerifyAll(); } [Test] @@ -281,7 +292,6 @@ Assert.AreEqual("Bevestigen", messageBoxTitle); Assert.AreEqual("Weet u zeker dat u alle uitvoer wilt wissen?", messageBoxText); } - mocks.VerifyAll(); } [Test] @@ -348,7 +358,6 @@ menu.Items[13] }, typeof(ToolStripSeparator)); } - mocks.VerifyAll(); } [Test] @@ -380,7 +389,6 @@ Assert.IsFalse(clearOutputItem.Enabled); Assert.AreEqual("Er zijn geen berekeningen met uitvoer om te wissen.", clearOutputItem.ToolTipText); } - mocks.VerifyAll(); // Expect no calls on arguments } [Test] @@ -419,7 +427,6 @@ Assert.IsTrue(clearOutputItem.Enabled); Assert.AreEqual(RingtoetsCommonFormsResources.Clear_all_output_ToolTip, clearOutputItem.ToolTipText); } - mocks.VerifyAll(); // Expect no calls on arguments } [Test] @@ -455,7 +462,6 @@ Assert.AreEqual(RingtoetsCommonFormsResources.FailureMechanism_CreateCalculateAllItem_No_calculations_to_run, calculateItem.ToolTipText); Assert.AreEqual(RingtoetsCommonFormsResources.FailureMechanism_CreateValidateAllItem_No_calculations_to_validate, validateItem.ToolTipText); } - mocks.VerifyAll(); // Expect no calls on arguments } [Test] @@ -498,7 +504,7 @@ } // Assert - mocks.VerifyAll(); + // Assert expectancies are called in TearDown() } [Test] @@ -533,7 +539,7 @@ } // Assert - mocks.VerifyAll(); + // Assert expectancies are called in TearDown() } [Test] @@ -583,7 +589,6 @@ StringAssert.StartsWith(String.Format("Validatie van '{0}' beëindigd om: ", invalidCalculation.Name), msgs[8]); }); } - mocks.VerifyAll(); } [Test] @@ -634,7 +639,7 @@ } // Assert - mocks.VerifyAll(); + // Assert expectancies are called in TearDown() } [Test] @@ -676,7 +681,6 @@ // Assert Assert.IsFalse(failureMechanism.IsRelevant); } - mocks.VerifyAll(); } [Test] @@ -714,7 +718,6 @@ // Assert Assert.IsTrue(failureMechanism.IsRelevant); } - mocks.VerifyAll(); } private const int contextMenuRelevancyIndexWhenRelevant = 1; Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingInputContextTreeNodeInfoTest.cs =================================================================== diff -u -r4e6c8ac0eb663ddfe4565745fb4829a8432019e2 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingInputContextTreeNodeInfoTest.cs (.../PipingInputContextTreeNodeInfoTest.cs) (revision 4e6c8ac0eb663ddfe4565745fb4829a8432019e2) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingInputContextTreeNodeInfoTest.cs (.../PipingInputContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -29,9 +29,19 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(PipingInputContext)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(PipingInputContext), info.TagType); Assert.IsNull(info.ForeColor); @@ -70,8 +80,6 @@ // Assert Assert.AreEqual(Resources.PipingInputContext_NodeDisplayName, text); - - mocks.VerifyAll(); } [Test] @@ -94,8 +102,6 @@ // Assert TestHelper.AssertImagesAreEqual(Resources.PipingInputIcon, image); - - mocks.VerifyAll(); } [Test] @@ -124,7 +130,7 @@ info.ContextMenuStrip(null, null, treeViewControl); } // Assert - mocks.VerifyAll(); + // Assert expectancies are called in TearDown() } } } \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingSemiProbabilisticOutputTreeNodeInfoTest.cs =================================================================== diff -u -r4e6c8ac0eb663ddfe4565745fb4829a8432019e2 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingSemiProbabilisticOutputTreeNodeInfoTest.cs (.../PipingSemiProbabilisticOutputTreeNodeInfoTest.cs) (revision 4e6c8ac0eb663ddfe4565745fb4829a8432019e2) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingSemiProbabilisticOutputTreeNodeInfoTest.cs (.../PipingSemiProbabilisticOutputTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -26,9 +26,19 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(PipingSemiProbabilisticOutput)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(PipingSemiProbabilisticOutput), info.TagType); Assert.IsNull(info.ForeColor); @@ -60,8 +70,6 @@ // Assert Assert.AreEqual(RingtoetsCommonFormsResources.CalculationOutput_DisplayName, text); - - mocks.VerifyAll(); } [Test] @@ -77,8 +85,6 @@ // Assert TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GeneralOutputIcon, image); - - mocks.VerifyAll(); } [Test] @@ -87,8 +93,6 @@ // Setup var gui = mocks.StrictMultiMock(); var menuBuilderMock = mocks.StrictMock(); - - menuBuilderMock.Expect(mb => mb.AddExportItem()).Return(menuBuilderMock); menuBuilderMock.Expect(mb => mb.AddSeparator()).Return(menuBuilderMock); menuBuilderMock.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilderMock); @@ -105,7 +109,7 @@ info.ContextMenuStrip(null, null, treeViewControl); } // Assert - mocks.VerifyAll(); + // Assert expectancies are called in TearDown() } } } \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/RingtoetsPipingSurfaceLineCollectionTreeNodeInfoTest.cs =================================================================== diff -u -r4e6c8ac0eb663ddfe4565745fb4829a8432019e2 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/RingtoetsPipingSurfaceLineCollectionTreeNodeInfoTest.cs (.../RingtoetsPipingSurfaceLineCollectionTreeNodeInfoTest.cs) (revision 4e6c8ac0eb663ddfe4565745fb4829a8432019e2) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/RingtoetsPipingSurfaceLineCollectionTreeNodeInfoTest.cs (.../RingtoetsPipingSurfaceLineCollectionTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -31,9 +31,19 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(RingtoetsPipingSurfaceLinesContext)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(RingtoetsPipingSurfaceLinesContext), info.TagType); Assert.IsNull(info.EnsureVisibleOnCreate); @@ -65,8 +75,6 @@ // Assert Assert.AreEqual(Resources.PipingSurfaceLinesCollection_DisplayName, text); - - mocks.VerifyAll(); } [Test] @@ -84,8 +92,6 @@ // Assert TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GeneralFolderIcon, image); - - mocks.VerifyAll(); } [Test] @@ -103,8 +109,6 @@ // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), foreColor); - - mocks.VerifyAll(); } [Test] @@ -128,8 +132,6 @@ // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.ControlText), foreColor); - - mocks.VerifyAll(); } [Test] @@ -157,8 +159,6 @@ ringtoetsPipingSurfaceLine1, ringtoetsPipingSurfaceLine2 }, objects); - - mocks.VerifyAll(); } [Test] @@ -186,7 +186,7 @@ info.ContextMenuStrip(null, null, treeViewControl); } // Assert - mocks.VerifyAll(); + // Assert expectancies are called in TearDown() } } } \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/RingtoetsPipingSurfaceLineTreeNodeInfoTest.cs =================================================================== diff -u -r4e6c8ac0eb663ddfe4565745fb4829a8432019e2 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/RingtoetsPipingSurfaceLineTreeNodeInfoTest.cs (.../RingtoetsPipingSurfaceLineTreeNodeInfoTest.cs) (revision 4e6c8ac0eb663ddfe4565745fb4829a8432019e2) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/RingtoetsPipingSurfaceLineTreeNodeInfoTest.cs (.../RingtoetsPipingSurfaceLineTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -26,9 +26,19 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(RingtoetsPipingSurfaceLine)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(RingtoetsPipingSurfaceLine), info.TagType); Assert.IsNull(info.ForeColor); @@ -62,8 +72,6 @@ // Assert Assert.AreEqual(testName, text); - - mocks.VerifyAll(); } [Test] @@ -79,8 +87,6 @@ // Assert TestHelper.AssertImagesAreEqual(Resources.PipingSurfaceLineIcon, image); - - mocks.VerifyAll(); } [Test] @@ -104,7 +110,7 @@ info.ContextMenuStrip(null, null, treeViewControl); } // Assert - mocks.VerifyAll(); + // Assert expectancies are called in TearDown() } } } \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/StochasticSoilModelContextTreeNodeInfoTest.cs =================================================================== diff -u -r4e6c8ac0eb663ddfe4565745fb4829a8432019e2 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/StochasticSoilModelContextTreeNodeInfoTest.cs (.../StochasticSoilModelContextTreeNodeInfoTest.cs) (revision 4e6c8ac0eb663ddfe4565745fb4829a8432019e2) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/StochasticSoilModelContextTreeNodeInfoTest.cs (.../StochasticSoilModelContextTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -53,9 +53,19 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(StochasticSoilModelContext)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(StochasticSoilModelContext), info.TagType); Assert.IsNull(info.EnsureVisibleOnCreate); @@ -86,8 +96,6 @@ // Assert Assert.AreEqual(Resources.StochasticSoilProfileCollection_DisplayName, text); - - mocks.VerifyAll(); } [Test] @@ -104,8 +112,6 @@ // Assert TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GeneralFolderIcon, image); - - mocks.VerifyAll(); } [Test] @@ -122,8 +128,6 @@ // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), foreColor); - - mocks.VerifyAll(); } [Test] @@ -141,8 +145,6 @@ // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.ControlText), foreColor); - - mocks.VerifyAll(); } [Test] @@ -185,8 +187,6 @@ { stochasticSoilModel }, objects); - - mocks.VerifyAll(); } [Test] @@ -214,7 +214,7 @@ info.ContextMenuStrip(null, null, treeViewControl); } // Assert - mocks.VerifyAll(); + // Assert expectancies are called in TearDown() } } } \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/StochasticSoilProfileTreeNodeInfoTest.cs =================================================================== diff -u -r4e6c8ac0eb663ddfe4565745fb4829a8432019e2 -rc9396d0af18873fda14c7e486decbfca7d4e8b21 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/StochasticSoilProfileTreeNodeInfoTest.cs (.../StochasticSoilProfileTreeNodeInfoTest.cs) (revision 4e6c8ac0eb663ddfe4565745fb4829a8432019e2) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/StochasticSoilProfileTreeNodeInfoTest.cs (.../StochasticSoilProfileTreeNodeInfoTest.cs) (revision c9396d0af18873fda14c7e486decbfca7d4e8b21) @@ -27,9 +27,19 @@ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(StochasticSoilProfile)); } + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + } + [Test] public void Initialized_Always_ExpectedPropertiesSet() { + // Setup + mocks.ReplayAll(); + // Assert Assert.AreEqual(typeof(StochasticSoilProfile), info.TagType); Assert.IsNull(info.ForeColor); @@ -67,8 +77,6 @@ // Assert Assert.AreEqual(testName, text); - - mocks.VerifyAll(); } [Test] @@ -89,8 +97,6 @@ // Assert TestHelper.AssertImagesAreEqual(Resources.PipingSoilProfileIcon, image); - - mocks.VerifyAll(); } [Test] @@ -114,7 +120,7 @@ info.ContextMenuStrip(null, null, treeViewControl); } // Assert - mocks.VerifyAll(); + // Assert expectancies are called in TearDown() } } } \ No newline at end of file