Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/PresentationObjects/HeightStructuresContext.cs
===================================================================
diff -u -rdd72cf407b7d0e9284d101bb2e2854e569b1a29a -rc7cb9812ba255ba88d28b65f1a146dcf7454f63d
--- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/PresentationObjects/HeightStructuresContext.cs (.../HeightStructuresContext.cs) (revision dd72cf407b7d0e9284d101bb2e2854e569b1a29a)
+++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/PresentationObjects/HeightStructuresContext.cs (.../HeightStructuresContext.cs) (revision c7cb9812ba255ba88d28b65f1a146dcf7454f63d)
@@ -28,7 +28,7 @@
namespace Ringtoets.HeightStructures.Forms.PresentationObjects
{
///
- /// The presentation object for an of .
+ /// The presentation object for an containing .
///
public class HeightStructuresContext : ObservableWrappedObjectContextBase>
{
Fisheye: Tag c7cb9812ba255ba88d28b65f1a146dcf7454f63d refers to a dead (removed) revision in file `Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/PresentationObjects/StabilityPointStructureContext.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 7a0eb8b2709b5c13d4711701213826b9cbd5aafe refers to a dead (removed) revision in file `Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/PresentationObjects/StabilityPointStructuresContext.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Ringtoets.StabilityPointStructures.Forms.csproj
===================================================================
diff -u -r7a0eb8b2709b5c13d4711701213826b9cbd5aafe -rc7cb9812ba255ba88d28b65f1a146dcf7454f63d
--- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Ringtoets.StabilityPointStructures.Forms.csproj (.../Ringtoets.StabilityPointStructures.Forms.csproj) (revision 7a0eb8b2709b5c13d4711701213826b9cbd5aafe)
+++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Ringtoets.StabilityPointStructures.Forms.csproj (.../Ringtoets.StabilityPointStructures.Forms.csproj) (revision c7cb9812ba255ba88d28b65f1a146dcf7454f63d)
@@ -40,7 +40,7 @@
Properties\GlobalAssembly.cs
-
+
Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Plugin/StabilityPointStructuresPlugin.cs
===================================================================
diff -u -r5883d15ec29f0c599a5df6ed77b1f3102897e35d -rc7cb9812ba255ba88d28b65f1a146dcf7454f63d
--- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Plugin/StabilityPointStructuresPlugin.cs (.../StabilityPointStructuresPlugin.cs) (revision 5883d15ec29f0c599a5df6ed77b1f3102897e35d)
+++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Plugin/StabilityPointStructuresPlugin.cs (.../StabilityPointStructuresPlugin.cs) (revision c7cb9812ba255ba88d28b65f1a146dcf7454f63d)
@@ -84,7 +84,7 @@
.Build()
};
- yield return new TreeNodeInfo
+ yield return new TreeNodeInfo
{
Text = context => RingtoetsCommonFormsResources.StructuresCollection_DisplayName,
Image = context => RingtoetsCommonFormsResources.GeneralFolderIcon,
@@ -208,7 +208,7 @@
return new object[]
{
new FailureMechanismSectionsContext(failureMechanism, assessmentSection),
- new StabilityPointStructureContext(failureMechanism.StabilityPointStructures, assessmentSection),
+ new StabilityPointStructuresContext(failureMechanism.StabilityPointStructures, assessmentSection),
new CommentContext(failureMechanism)
};
}
Fisheye: Tag c7cb9812ba255ba88d28b65f1a146dcf7454f63d refers to a dead (removed) revision in file `Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/PresentationObjects/StabilityPointStructureContextTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 7a0eb8b2709b5c13d4711701213826b9cbd5aafe refers to a dead (removed) revision in file `Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/PresentationObjects/StabilityPointStructuresContextTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Ringtoets.StabilityPointStructures.Forms.Test.csproj
===================================================================
diff -u -r7a0eb8b2709b5c13d4711701213826b9cbd5aafe -rc7cb9812ba255ba88d28b65f1a146dcf7454f63d
--- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Ringtoets.StabilityPointStructures.Forms.Test.csproj (.../Ringtoets.StabilityPointStructures.Forms.Test.csproj) (revision 7a0eb8b2709b5c13d4711701213826b9cbd5aafe)
+++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Ringtoets.StabilityPointStructures.Forms.Test.csproj (.../Ringtoets.StabilityPointStructures.Forms.Test.csproj) (revision c7cb9812ba255ba88d28b65f1a146dcf7454f63d)
@@ -57,14 +57,14 @@
Properties\GlobalAssembly.cs
-
+
-
+
Fisheye: Tag c7cb9812ba255ba88d28b65f1a146dcf7454f63d refers to a dead (removed) revision in file `Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/TreeNodeInfos/StabilityPointStructureContextTreeNodeInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/TreeNodeInfos/StabilityPointStructuresContextTreeNodeInfoTest.cs
===================================================================
diff -u
--- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/TreeNodeInfos/StabilityPointStructuresContextTreeNodeInfoTest.cs (revision 0)
+++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/TreeNodeInfos/StabilityPointStructuresContextTreeNodeInfoTest.cs (revision c7cb9812ba255ba88d28b65f1a146dcf7454f63d)
@@ -0,0 +1,250 @@
+// 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;
+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.Common.Data.AssessmentSection;
+using Ringtoets.StabilityPointStructures.Data;
+using Ringtoets.StabilityPointStructures.Forms.PresentationObjects;
+using Ringtoets.StabilityPointStructures.Plugin;
+using RingtoetsCommonFormsProperties = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.StabilityPointStructures.Forms.Test.TreeNodeInfos
+{
+ [TestFixture]
+ public class StabilityPointStructuresContextTreeNodeInfoTest
+ {
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Setup
+ using (var plugin = new StabilityPointStructuresPlugin())
+ {
+ var info = GetInfo(plugin);
+
+ // Assert
+ Assert.AreEqual(typeof(StabilityPointStructuresContext), info.TagType);
+ Assert.IsNull(info.CanCheck);
+ Assert.IsNull(info.CanDrag);
+ Assert.IsNull(info.CanDrop);
+ Assert.IsNull(info.CanInsert);
+ Assert.IsNull(info.CanRemove);
+ Assert.IsNull(info.CanRename);
+ Assert.IsNotNull(info.ChildNodeObjects);
+ Assert.IsNotNull(info.ContextMenuStrip);
+ Assert.IsNull(info.EnsureVisibleOnCreate);
+ Assert.IsNotNull(info.ForeColor);
+ Assert.IsNotNull(info.Image);
+ Assert.IsNull(info.IsChecked);
+ Assert.IsNull(info.OnDrop);
+ Assert.IsNull(info.OnNodeChecked);
+ Assert.IsNull(info.OnNodeRemoved);
+ Assert.IsNull(info.OnNodeRenamed);
+ Assert.IsNotNull(info.Text);
+ }
+ }
+
+ [Test]
+ public void Text_Always_ReturnExpectedText()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var context = new StabilityPointStructuresContext(new ObservableList(),
+ assessmentSection);
+
+ using (var plugin = new StabilityPointStructuresPlugin())
+ {
+ var info = GetInfo(plugin);
+
+ // Call
+ string text = info.Text(context);
+
+ // Assert
+ const string expectedText = "Kunstwerken";
+ Assert.AreEqual(expectedText, text);
+ }
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Image_Always_ReturnExpectedImage()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var context = new StabilityPointStructuresContext(new ObservableList(),
+ assessmentSection);
+
+ using (var plugin = new StabilityPointStructuresPlugin())
+ {
+ var info = GetInfo(plugin);
+
+ // Call
+ Image image = info.Image(context);
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsProperties.GeneralFolderIcon, image);
+ }
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void ForeColor_CollectionHasElements_ReturnControlText()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var structures = new ObservableList
+ {
+ CreateStabilityPointStructure()
+ };
+
+ // Precondition
+ CollectionAssert.IsNotEmpty(structures);
+
+ var context = new StabilityPointStructuresContext(structures, assessmentSection);
+ using (var plugin = new StabilityPointStructuresPlugin())
+ {
+ var info = GetInfo(plugin);
+
+ // Call
+ Color color = info.ForeColor(context);
+
+ // Assert
+ Assert.AreEqual(Color.FromKnownColor(KnownColor.ControlText), color);
+ }
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void ChildNodeObjects_Always_ReturnStabilityPointStructures()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ StabilityPointStructure structure1 = CreateStabilityPointStructure();
+ StabilityPointStructure structure2 = CreateStabilityPointStructure();
+ var closingStructures = new ObservableList
+ {
+ structure1,
+ structure2
+ };
+
+ var context = new StabilityPointStructuresContext(closingStructures, assessmentSection);
+ using (var plugin = new StabilityPointStructuresPlugin())
+ {
+ var info = GetInfo(plugin);
+
+ // Call
+ var children = info.ChildNodeObjects(context);
+
+ // Assert
+ Assert.AreEqual(2, children.Length);
+ Assert.AreSame(structure1, children.ElementAt(0));
+ Assert.AreSame(structure2, children.ElementAt(1));
+ }
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void ForeColor_CollectionIsEmpty_ReturnGrayText()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var closingStructures = new ObservableList();
+
+ // Precondition
+ CollectionAssert.IsEmpty(closingStructures);
+
+ var context = new StabilityPointStructuresContext(closingStructures, assessmentSection);
+ using (var plugin = new StabilityPointStructuresPlugin())
+ {
+ var info = GetInfo(plugin);
+
+ // Call
+ Color color = info.ForeColor(context);
+
+ // Assert
+ Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), color);
+ }
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void ContextMenuStrip_Always_CallsBuilder()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var menuBuilderMock = mocks.StrictMock();
+ menuBuilderMock.Expect(mb => mb.AddImportItem()).Return(menuBuilderMock);
+ menuBuilderMock.Expect(mb => mb.AddSeparator()).Return(menuBuilderMock);
+ menuBuilderMock.Expect(mb => mb.AddCollapseAllItem()).Return(menuBuilderMock);
+ menuBuilderMock.Expect(mb => mb.AddExpandAllItem()).Return(menuBuilderMock);
+ menuBuilderMock.Expect(mb => mb.Build()).Return(null);
+
+ using (var plugin = new StabilityPointStructuresPlugin())
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var gui = mocks.Stub();
+ gui.Stub(g => g.Get(null, treeViewControl)).Return(menuBuilderMock);
+ mocks.ReplayAll();
+
+ plugin.Gui = gui;
+ var info = GetInfo(plugin);
+
+ // Call
+ info.ContextMenuStrip(null, null, treeViewControl);
+ }
+ // Assert
+ mocks.VerifyAll();
+ }
+
+ private static TreeNodeInfo GetInfo(StabilityPointStructuresPlugin gui)
+ {
+ return gui.GetTreeNodeInfos().First(tni => tni.TagType == typeof(StabilityPointStructuresContext));
+ }
+
+ private static StabilityPointStructure CreateStabilityPointStructure()
+ {
+ return new StabilityPointStructure("Name", "Id", new Point2D(1, 2));
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/TreeNodeInfos/StabilityPointStructuresFailureMechanismContextTreeNodeInfoTest.cs
===================================================================
diff -u -r7f6141b5ce12a84bf7f8c7e66a2d5d5d36add158 -rc7cb9812ba255ba88d28b65f1a146dcf7454f63d
--- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/TreeNodeInfos/StabilityPointStructuresFailureMechanismContextTreeNodeInfoTest.cs (.../StabilityPointStructuresFailureMechanismContextTreeNodeInfoTest.cs) (revision 7f6141b5ce12a84bf7f8c7e66a2d5d5d36add158)
+++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/TreeNodeInfos/StabilityPointStructuresFailureMechanismContextTreeNodeInfoTest.cs (.../StabilityPointStructuresFailureMechanismContextTreeNodeInfoTest.cs) (revision c7cb9812ba255ba88d28b65f1a146dcf7454f63d)
@@ -115,9 +115,9 @@
Assert.AreSame(failureMechanism, failureMechanismSectionsContext.WrappedData);
Assert.AreSame(assessmentSectionMock, failureMechanismSectionsContext.ParentAssessmentSection);
- var structureContext = (StabilityPointStructureContext)inputsFolder.Contents[1];
- Assert.AreSame(failureMechanism.StabilityPointStructures, structureContext.WrappedData);
- Assert.AreSame(assessmentSectionMock, structureContext.AssessmentSection);
+ var stabilityPointStructuresContext = (StabilityPointStructuresContext) inputsFolder.Contents[1];
+ Assert.AreSame(failureMechanism.StabilityPointStructures, stabilityPointStructuresContext.WrappedData);
+ Assert.AreSame(assessmentSectionMock, stabilityPointStructuresContext.AssessmentSection);
var commentContext = (CommentContext) inputsFolder.Contents[2];
Assert.AreSame(failureMechanism, commentContext.WrappedData);
Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/StabilityPointStructuresPluginTest.cs
===================================================================
diff -u -r341ddc4bed3bbbae529c1c282d15cc9b593d1e6a -rc7cb9812ba255ba88d28b65f1a146dcf7454f63d
--- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/StabilityPointStructuresPluginTest.cs (.../StabilityPointStructuresPluginTest.cs) (revision 341ddc4bed3bbbae529c1c282d15cc9b593d1e6a)
+++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/StabilityPointStructuresPluginTest.cs (.../StabilityPointStructuresPluginTest.cs) (revision c7cb9812ba255ba88d28b65f1a146dcf7454f63d)
@@ -71,7 +71,7 @@
Assert.AreEqual(8, treeNodeInfos.Length);
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(StabilityPointStructuresFailureMechanismContext)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)));
- Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(StabilityPointStructureContext)));
+ Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(StabilityPointStructuresContext)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(StabilityPointStructure)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(StabilityPointStructuresCalculationGroupContext)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(StabilityPointStructuresCalculationContext)));