Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/WaterPressureAsphaltCoverFailureMechanismSectionResultContextTreeNodeInfoTest.cs =================================================================== diff -u -r26ee4ff0515942af0d34790c13a16ac78f67e891 -r364b5a86dfbcb8d554affb8061b9f2eace8af45d --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/WaterPressureAsphaltCoverFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../WaterPressureAsphaltCoverFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision 26ee4ff0515942af0d34790c13a16ac78f67e891) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/WaterPressureAsphaltCoverFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../WaterPressureAsphaltCoverFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision 364b5a86dfbcb8d554affb8061b9f2eace8af45d) @@ -27,7 +27,6 @@ using Core.Common.TestUtil; using NUnit.Framework; using Rhino.Mocks; -using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Forms.PresentationObjects; using Ringtoets.Integration.Data.StandAlone; using Ringtoets.Integration.Data.StandAlone.SectionResults; @@ -38,92 +37,85 @@ [TestFixture] public class WaterPressureAsphaltCoverFailureMechanismSectionResultContextTreeNodeInfoTest { - private MockRepository mocks; private RingtoetsPlugin plugin; private TreeNodeInfo info; [SetUp] public void SetUp() { - mocks = new MockRepository(); plugin = new RingtoetsPlugin(); - info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(ProbabilityFailureMechanismSectionResultContext)); + 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.IsNotNull(info.Text); - Assert.IsNull(info.ForeColor); - Assert.IsNotNull(info.Image); - Assert.IsNotNull(info.ContextMenuStrip); - Assert.IsNull(info.EnsureVisibleOnCreate); - Assert.IsNull(info.ExpandOnCreate); - Assert.IsNull(info.ChildNodeObjects); - Assert.IsNull(info.CanRename); - Assert.IsNull(info.OnNodeRenamed); - Assert.IsNull(info.CanRemove); - Assert.IsNull(info.OnNodeRemoved); - Assert.IsNull(info.CanCheck); - Assert.IsNull(info.IsChecked); - Assert.IsNull(info.OnNodeChecked); - Assert.IsNull(info.CanDrag); - Assert.IsNull(info.CanDrop); - Assert.IsNull(info.CanInsert); - Assert.IsNull(info.OnDrop); + using (plugin) + { + // Assert + Assert.IsNotNull(info.Text); + Assert.IsNull(info.ForeColor); + Assert.IsNotNull(info.Image); + Assert.IsNotNull(info.ContextMenuStrip); + Assert.IsNull(info.EnsureVisibleOnCreate); + Assert.IsNull(info.ExpandOnCreate); + Assert.IsNull(info.ChildNodeObjects); + Assert.IsNull(info.CanRename); + Assert.IsNull(info.OnNodeRenamed); + Assert.IsNull(info.CanRemove); + Assert.IsNull(info.OnNodeRemoved); + Assert.IsNull(info.CanCheck); + Assert.IsNull(info.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_ReturnsName() { // Setup - var assessmentSection = mocks.Stub(); - mocks.ReplayAll(); - var mechanism = new WaterPressureAsphaltCoverFailureMechanism(); - var context = new ProbabilityFailureMechanismSectionResultContext(mechanism.SectionResults, - mechanism, - assessmentSection); + var context = new FailureMechanismSectionResultContext(mechanism.SectionResults, + mechanism); + using (plugin) + { + // Call + string text = info.Text(context); - // Call - string text = info.Text(context); - - // Assert - Assert.AreEqual("Resultaat", text); + // Assert + Assert.AreEqual("Resultaat", text); + } } [Test] public void Image_Always_ReturnsGenericInputOutputIcon() { // Setup - mocks.ReplayAll(); + using (plugin) + { + // Call + Image image = info.Image(null); - // Call - Image image = info.Image(null); - - // Assert - TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.FailureMechanismSectionResultIcon, image); + // Assert + TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.FailureMechanismSectionResultIcon, image); + } } [Test] public void ContextMenuStrip_Always_CallsBuilder() { // Setup + var mocks = new MockRepository(); var menuBuilder = mocks.StrictMock(); menuBuilder.Expect(mb => mb.AddOpenItem()).Return(menuBuilder); menuBuilder.Expect(mb => mb.Build()).Return(null); + using (plugin) using (var treeViewControl = new TreeViewControl()) { var gui = mocks.Stub(); @@ -140,7 +132,7 @@ } // Assert - // Assert expectancies are called in TearDown() + mocks.VerifyAll(); } } } \ No newline at end of file