Fisheye: Tag 135f8519cbb58efd19817d33acaa26241f6cfee1 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PresentationObjects/DikeProfileContext.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Ringtoets.GrassCoverErosionInwards.Forms.csproj =================================================================== diff -u -r2f9eaf6617033f3dd041197efdd372f2277bb5c2 -r135f8519cbb58efd19817d33acaa26241f6cfee1 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Ringtoets.GrassCoverErosionInwards.Forms.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.csproj) (revision 2f9eaf6617033f3dd041197efdd372f2277bb5c2) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Ringtoets.GrassCoverErosionInwards.Forms.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.csproj) (revision 135f8519cbb58efd19817d33acaa26241f6cfee1) @@ -41,7 +41,6 @@ Properties\GlobalAssembly.cs - Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsGuiPlugin.cs =================================================================== diff -u -r454c559173fa5069917f2aab1a4d65ddbb019b3a -r135f8519cbb58efd19817d33acaa26241f6cfee1 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsGuiPlugin.cs (.../GrassCoverErosionInwardsGuiPlugin.cs) (revision 454c559173fa5069917f2aab1a4d65ddbb019b3a) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsGuiPlugin.cs (.../GrassCoverErosionInwardsGuiPlugin.cs) (revision 135f8519cbb58efd19817d33acaa26241f6cfee1) @@ -19,7 +19,6 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using System; using System.Collections; using System.Collections.Generic; using System.Drawing; @@ -38,17 +37,12 @@ using Ringtoets.Common.Forms.Helpers; using Ringtoets.Common.Forms.PresentationObjects; using Ringtoets.Common.Forms.TreeNodeInfos; -using Ringtoets.Common.Service; using Ringtoets.GrassCoverErosionInwards.Data; using Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects; using Ringtoets.GrassCoverErosionInwards.Forms.PropertyClasses; using Ringtoets.GrassCoverErosionInwards.Forms.Views; using Ringtoets.GrassCoverErosionInwards.Plugin.Properties; using Ringtoets.GrassCoverErosionInwards.Service; -using Ringtoets.HydraRing.Calculation.Activities; -using Ringtoets.HydraRing.Calculation.Data; -using Ringtoets.HydraRing.Calculation.Data.Input.Overtopping; -using Ringtoets.HydraRing.Calculation.Data.Output; using Ringtoets.HydraRing.IO; using GrassCoverErosionInwardsDataResources = Ringtoets.GrassCoverErosionInwards.Data.Properties.Resources; @@ -101,7 +95,6 @@ Color.FromKnownColor(KnownColor.ControlText) : Color.FromKnownColor(KnownColor.GrayText), ChildNodeObjects = context => context.WrappedData - .Select(dp => new DikeProfileContext(dp, context.WrappedData)) .Cast() .ToArray(), ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl) @@ -112,9 +105,9 @@ .Build() }; - yield return new TreeNodeInfo + yield return new TreeNodeInfo { - Text = context => context.WrappedData.Name, + Text = dikeProfile => dikeProfile.Name, Image = context => Resources.DikeProfile, ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl) .AddPropertiesItem() Fisheye: Tag 135f8519cbb58efd19817d33acaa26241f6cfee1 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PresentationObjects/DikeProfileContextTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj =================================================================== diff -u -r0209ecd38a9cb1e7224ceabe8b13e0697346abb9 -r135f8519cbb58efd19817d33acaa26241f6cfee1 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj) (revision 0209ecd38a9cb1e7224ceabe8b13e0697346abb9) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj) (revision 135f8519cbb58efd19817d33acaa26241f6cfee1) @@ -58,7 +58,6 @@ - True @@ -76,7 +75,7 @@ - + Fisheye: Tag 135f8519cbb58efd19817d33acaa26241f6cfee1 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/DikeProfileContextTreeNodeInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/DikeProfileTreeNodeInfoTest.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/DikeProfileTreeNodeInfoTest.cs (revision 0) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/DikeProfileTreeNodeInfoTest.cs (revision 135f8519cbb58efd19817d33acaa26241f6cfee1) @@ -0,0 +1,126 @@ +// 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.Base.Geometry; +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.Data; +using Ringtoets.GrassCoverErosionInwards.Plugin; +using Ringtoets.GrassCoverErosionInwards.Plugin.Properties; + +namespace Ringtoets.GrassCoverErosionInwards.Forms.Test.TreeNodeInfos +{ + [TestFixture] + public class DikeProfileTreeNodeInfoTest + { + private GrassCoverErosionInwardsGuiPlugin plugin; + private TreeNodeInfo info; + + [SetUp] + public void SetUp() + { + plugin = new GrassCoverErosionInwardsGuiPlugin(); + info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(DikeProfile)); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.AreEqual(typeof(DikeProfile), 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_ReturnDikeProfileName() + { + // Setup + const string profileName = "Random profile name"; + var dikeProfile = new DikeProfile(new Point2D(0, 0)) + { + Name = profileName + }; + + // Call + string text = info.Text(dikeProfile); + + // Assert + Assert.AreEqual(profileName, text); + } + + [Test] + public void Image_Always_ReturnExpectedImage() + { + // Call + Image image = info.Image(null); + + // Assert + TestHelper.AssertImagesAreEqual(Resources.DikeProfile, image); + } + + [Test] + public void ContextMenuStrip_Always_CallsBuilder() + { + // Setup + var mocks = new MockRepository(); + var gui = mocks.StrictMultiMock(); + var treeViewControl = mocks.StrictMock(); + var menuBuilderMock = mocks.StrictMock(); + + gui.Expect(g => g.Get(null, treeViewControl)).Return(menuBuilderMock); + + menuBuilderMock.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilderMock); + menuBuilderMock.Expect(mb => mb.Build()).Return(null); + + mocks.ReplayAll(); + + plugin.Gui = gui; + + // Call + info.ContextMenuStrip(null, null, treeViewControl); + + // Assert + mocks.VerifyAll(); + } + } +} Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/DikeProfilesContextTreeNodeInfoTest.cs =================================================================== diff -u -r454c559173fa5069917f2aab1a4d65ddbb019b3a -r135f8519cbb58efd19817d33acaa26241f6cfee1 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/DikeProfilesContextTreeNodeInfoTest.cs (.../DikeProfilesContextTreeNodeInfoTest.cs) (revision 454c559173fa5069917f2aab1a4d65ddbb019b3a) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/DikeProfilesContextTreeNodeInfoTest.cs (.../DikeProfilesContextTreeNodeInfoTest.cs) (revision 135f8519cbb58efd19817d33acaa26241f6cfee1) @@ -165,7 +165,7 @@ } [Test] - public void ChildNodeObjects_Always_ReturnDikeProfileContexts() + public void ChildNodeObjects_Always_ReturnDikeProfiles() { // Setup var mocks = new MockRepository(); @@ -187,17 +187,8 @@ // Assert Assert.AreEqual(2, children.Length); - - var dikeProfileContext = children.ElementAt(0) as DikeProfileContext; - Assert.IsNotNull(dikeProfileContext); - Assert.AreSame(dikeProfile1, dikeProfileContext.WrappedData); - Assert.AreSame(dikeProfiles, dikeProfileContext.DikeProfilesList); - - dikeProfileContext = children.ElementAt(1) as DikeProfileContext; - Assert.IsNotNull(dikeProfileContext); - Assert.AreSame(dikeProfile2, dikeProfileContext.WrappedData); - Assert.AreSame(dikeProfiles, dikeProfileContext.DikeProfilesList); - + Assert.AreSame(dikeProfile1, children.ElementAt(0)); + Assert.AreSame(dikeProfile2, children.ElementAt(1)); mocks.ReplayAll(); } Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/GrassCoverErosionInwardsGuiPluginTest.cs =================================================================== diff -u -r0209ecd38a9cb1e7224ceabe8b13e0697346abb9 -r135f8519cbb58efd19817d33acaa26241f6cfee1 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/GrassCoverErosionInwardsGuiPluginTest.cs (.../GrassCoverErosionInwardsGuiPluginTest.cs) (revision 0209ecd38a9cb1e7224ceabe8b13e0697346abb9) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/GrassCoverErosionInwardsGuiPluginTest.cs (.../GrassCoverErosionInwardsGuiPluginTest.cs) (revision 135f8519cbb58efd19817d33acaa26241f6cfee1) @@ -105,7 +105,7 @@ Assert.AreEqual(9, treeNodeInfos.Length); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(GrassCoverErosionInwardsFailureMechanismContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(DikeProfilesContext))); - Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(DikeProfileContext))); + Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(DikeProfile))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(GrassCoverErosionInwardsCalculationGroupContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(GrassCoverErosionInwardsCalculationContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)));