Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionInwardsOutputContextTreeNodeInfoTest.cs =================================================================== diff -u -r4e8b7f9361b06dbfe875188995c7b8cf94ed762d -re276a4bb5db220193c780feaef43bb1900082b8b --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionInwardsOutputContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsOutputContextTreeNodeInfoTest.cs) (revision 4e8b7f9361b06dbfe875188995c7b8cf94ed762d) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionInwardsOutputContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsOutputContextTreeNodeInfoTest.cs) (revision e276a4bb5db220193c780feaef43bb1900082b8b) @@ -22,6 +22,8 @@ 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; @@ -30,21 +32,21 @@ using Ringtoets.GrassCoverErosionInwards.Data; using Ringtoets.GrassCoverErosionInwards.Data.TestUtil; using Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects; -using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; +using Ringtoets.GrassCoverErosionInwards.Plugin.Properties; namespace Ringtoets.GrassCoverErosionInwards.Plugin.Test.TreeNodeInfos { [TestFixture] public class GrassCoverErosionInwardsOutputContextTreeNodeInfoTest { - private MockRepository mocksRepository; + private MockRepository mocks; private GrassCoverErosionInwardsPlugin plugin; private TreeNodeInfo info; [SetUp] public void SetUp() { - mocksRepository = new MockRepository(); + mocks = new MockRepository(); plugin = new GrassCoverErosionInwardsPlugin(); info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(GrassCoverErosionInwardsOutputContext)); } @@ -53,20 +55,20 @@ public void TearDown() { plugin.Dispose(); - mocksRepository.VerifyAll(); + mocks.VerifyAll(); } [Test] public void Initialized_Always_ExpectedPropertiesSet() { // Setup - mocksRepository.ReplayAll(); + mocks.ReplayAll(); // Assert Assert.IsNotNull(info.Text); Assert.IsNull(info.ForeColor); Assert.IsNotNull(info.Image); - Assert.IsNull(info.ContextMenuStrip); + Assert.IsNotNull(info.ContextMenuStrip); Assert.IsNull(info.EnsureVisibleOnCreate); Assert.IsNull(info.ExpandOnCreate); Assert.IsNotNull(info.ChildNodeObjects); @@ -87,7 +89,7 @@ public void Text_Always_ReturnsFromResource() { // Setup - mocksRepository.ReplayAll(); + mocks.ReplayAll(); // Call string text = info.Text(null); @@ -100,21 +102,21 @@ public void Image_Always_ReturnsGeneralOutputIcon() { // Setup - mocksRepository.ReplayAll(); + mocks.ReplayAll(); // Call Image image = info.Image(null); // Assert - TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GeneralOutputIcon, image); + TestHelper.AssertImagesAreEqual(Resources.OutputIcon, image); } [Test] public void ChildNodeObjects_EverythingCalculated_ReturnCollectionWithOutputObject() { // Setup - var assessmentSection = mocksRepository.Stub(); - mocksRepository.ReplayAll(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); var output = new GrassCoverErosionInwardsOutput(new GrassCoverErosionInwardsOvertoppingOutput( 0, true, new ProbabilityAssessmentOutput(0, 0, 0, 0, 0)), @@ -143,8 +145,8 @@ public void ChildNodeObjects_DikeHeightAndOvertoppingRateNotCalculated_ReturnCollectionWithEmptyOutputObjects() { // Setup - var assessmentSection = mocksRepository.Stub(); - mocksRepository.ReplayAll(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); var output = new GrassCoverErosionInwardsOutput(new GrassCoverErosionInwardsOvertoppingOutput( 0, true, new ProbabilityAssessmentOutput(0, 0, 0, 0, 0)), @@ -165,5 +167,31 @@ Assert.IsInstanceOf(children[1]); Assert.IsInstanceOf(children[2]); } + + [Test] + public void ContextMenuStrip_Always_CallsContextMenuBuilderMethods() + { + // Setup + var menuBuilderMock = mocks.StrictMock(); + using (mocks.Ordered()) + { + menuBuilderMock.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilderMock); + menuBuilderMock.Expect(mb => mb.Build()).Return(null); + } + + using (var treeViewControl = new TreeViewControl()) + { + var gui = mocks.Stub(); + gui.Stub(cmp => cmp.Get(null, treeViewControl)).Return(menuBuilderMock); + mocks.ReplayAll(); + + plugin.Gui = gui; + + // Call + info.ContextMenuStrip(null, null, treeViewControl); + } + // Assert + // Assert expectancies called in TearDown() + } } } \ No newline at end of file