Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs
===================================================================
diff -u -r25bf6e3f781ca5dec80f4fbf88ae640dbf40e2da -rba649bf26cd557bf4788a8b4fa19cf848b36fd87
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 25bf6e3f781ca5dec80f4fbf88ae640dbf40e2da)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision ba649bf26cd557bf4788a8b4fa19cf848b36fd87)
@@ -1,4 +1,4 @@
-// Copyright (C) Stichting Deltares 2017. All rights reserved.
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
//
// This file is part of Ringtoets.
//
@@ -101,15 +101,6 @@
}
///
- /// Looks up a localized string similar to Assemblage.
- ///
- public static string AssemblyResultCategoryTreeFolder_DisplayName {
- get {
- return ResourceManager.GetString("AssemblyResultCategoryTreeFolder_DisplayName", resourceCulture);
- }
- }
-
- ///
/// Looks up a localized string similar to Kilometrering* tot [km].
///
public static string AssemblyResultPerSectionView_GridColumn_SectionEnd {
@@ -137,6 +128,15 @@
}
///
+ /// Looks up a localized string similar to Assemblage.
+ ///
+ public static string AssemblyResults_DisplayName {
+ get {
+ return ResourceManager.GetString("AssemblyResults_DisplayName", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to Gecombineerd veiligheidsoordeel.
///
public static string AssemblyResultTotalView_AssemblyResultGroupBox_Text {
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx
===================================================================
diff -u -r25bf6e3f781ca5dec80f4fbf88ae640dbf40e2da -rba649bf26cd557bf4788a8b4fa19cf848b36fd87
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx (.../Resources.resx) (revision 25bf6e3f781ca5dec80f4fbf88ae640dbf40e2da)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx (.../Resources.resx) (revision ba649bf26cd557bf4788a8b4fa19cf848b36fd87)
@@ -309,7 +309,7 @@
Overig ({0})
-
+
Assemblage
Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs
===================================================================
diff -u -r433fc2ade8570da2d39f3e93ea7ae895cd88fa74 -rba649bf26cd557bf4788a8b4fa19cf848b36fd87
--- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 433fc2ade8570da2d39f3e93ea7ae895cd88fa74)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision ba649bf26cd557bf4788a8b4fa19cf848b36fd87)
@@ -1,4 +1,4 @@
-// Copyright (C) Stichting Deltares 2017. All rights reserved.
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
//
// This file is part of Ringtoets.
//
@@ -1081,6 +1081,19 @@
.AddPropertiesItem()
.Build()
};
+
+ yield return new TreeNodeInfo
+ {
+ Text = context => RingtoetsFormsResources.AssemblyResults_DisplayName,
+ Image = context => RingtoetsCommonFormsResources.GeneralFolderIcon,
+ ChildNodeObjects = AssemblyResultsContextChildNodeObjects,
+ ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl)
+ .AddExportItem()
+ .AddSeparator()
+ .AddCollapseAllItem()
+ .AddExpandAllItem()
+ .Build()
+ };
}
private static ViewInfo, IObservableEnumerable, TView> CreateFailureMechanismResultViewInfo<
@@ -1496,12 +1509,7 @@
};
childNodes.AddRange(WrapFailureMechanismsInContexts(nodeData));
- childNodes.Add(new CategoryTreeFolder(RingtoetsFormsResources.AssemblyResultCategoryTreeFolder_DisplayName,
- new object[]
- {
- new AssemblyResultTotalContext(nodeData),
- new AssemblyResultPerSectionContext(nodeData)
- }));
+ childNodes.Add(new AssemblyResultsContext(nodeData));
return childNodes.ToArray();
}
@@ -2322,8 +2330,22 @@
#endregion
+ #region AssemblyResults TreeNodeInfo
+
+ private static object[] AssemblyResultsContextChildNodeObjects(AssemblyResultsContext context)
+ {
+ AssessmentSection assessmentSection = context.WrappedData;
+ return new object[]
+ {
+ new AssemblyResultTotalContext(assessmentSection),
+ new AssemblyResultPerSectionContext(assessmentSection)
+ };
+ }
+
#endregion
+ #endregion
+
#region Foreshore Profile Update and ImportInfo
private static FileFilterGenerator CreateForeshoreProfileFileFilterGenerator
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj
===================================================================
diff -u -re3948ad61fcc36c71cb04793e2ed543c849609dd -rba649bf26cd557bf4788a8b4fa19cf848b36fd87
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision e3948ad61fcc36c71cb04793e2ed543c849609dd)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision ba649bf26cd557bf4788a8b4fa19cf848b36fd87)
@@ -1,4 +1,4 @@
-
+
{15E7B9D9-A177-42AE-8BC7-91B6DFBAB0EC}
@@ -94,6 +94,7 @@
+
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs
===================================================================
diff -u -rb70aa5e9027d1358a2dc38029c2eadae3d3eed4c -rba649bf26cd557bf4788a8b4fa19cf848b36fd87
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision b70aa5e9027d1358a2dc38029c2eadae3d3eed4c)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision ba649bf26cd557bf4788a8b4fa19cf848b36fd87)
@@ -513,7 +513,7 @@
TreeNodeInfo[] treeNodeInfos = plugin.GetTreeNodeInfos().ToArray();
// Assert
- Assert.AreEqual(38, treeNodeInfos.Length);
+ Assert.AreEqual(39, treeNodeInfos.Length);
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(AssessmentSection)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(BackgroundData)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(NormContext)));
@@ -552,6 +552,7 @@
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(AssemblyResultPerSectionContext)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(GeotechnicalFailureMechanismAssemblyCategoriesContext)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismAssemblyCategoriesContext)));
+ Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(AssemblyResultsContext)));
}
}
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/AssemblyResultsContextTreeNodeInfoTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/AssemblyResultsContextTreeNodeInfoTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/AssemblyResultsContextTreeNodeInfoTest.cs (revision ba649bf26cd557bf4788a8b4fa19cf848b36fd87)
@@ -0,0 +1,177 @@
+// Copyright (C) Stichting Deltares 2017. 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;
+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.Common.Data.AssessmentSection;
+using Ringtoets.Integration.Data;
+using Ringtoets.Integration.Forms.PresentationObjects;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.Integration.Plugin.Test.TreeNodeInfos
+{
+ [TestFixture]
+ public class AssemblyResultsContextTreeNodeInfoTest
+ {
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ TreeNodeInfo info = GetInfo(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.IsNotNull(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_ReturnsSetName()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ TreeNodeInfo info = GetInfo(plugin);
+
+ // Call
+ string text = info.Text(null);
+
+ // Assert
+ Assert.AreEqual("Assemblage", text);
+ }
+ }
+
+ [Test]
+ public void Image_Always_ReturnsSetImage()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ TreeNodeInfo info = GetInfo(plugin);
+
+ // Call
+ Image image = info.Image(null);
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GeneralFolderIcon, image);
+ }
+ }
+
+ [Test]
+ public void ContextMenuStrip_Always_CallsContextMenuBuilderMethods()
+ {
+ // Setup
+ var random = new Random(21);
+ var assessmentSection = new AssessmentSection(random.NextEnumValue());
+ var context = new AssemblyResultsContext(assessmentSection);
+
+ var mocks = new MockRepository();
+ var menuBuilder = mocks.StrictMock();
+
+ using (mocks.Ordered())
+ {
+ menuBuilder.Expect(mb => mb.AddExportItem()).Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.AddSeparator()).Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.AddCollapseAllItem()).Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.AddExpandAllItem()).Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.Build()).Return(null);
+ }
+
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var gui = mocks.Stub();
+ gui.Stub(g => g.ProjectOpened += null).IgnoreArguments();
+ gui.Stub(g => g.ProjectOpened -= null).IgnoreArguments();
+ gui.Stub(cmp => cmp.Get(context, treeViewControl)).Return(menuBuilder);
+ mocks.ReplayAll();
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ TreeNodeInfo info = GetInfo(plugin);
+
+ plugin.Gui = gui;
+
+ // Call
+ info.ContextMenuStrip(context, null, treeViewControl);
+ }
+ }
+
+ // Assert
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void ChildNodeObjects_Always_ReturnsChildrenOfData()
+ {
+ // Setup
+ var random = new Random(21);
+ var assessmentSection = new AssessmentSection(random.NextEnumValue());
+ var context = new AssemblyResultsContext(assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ TreeNodeInfo info = GetInfo(plugin);
+
+ // Call
+ object[] objects = info.ChildNodeObjects(context).ToArray();
+
+ // Assert
+ Assert.AreEqual(2, objects.Length);
+
+ var assemblyResultTotalContext = (AssemblyResultTotalContext) objects[0];
+ Assert.AreSame(assessmentSection, assemblyResultTotalContext.WrappedData);
+
+ var assemblyResultPerSectionContext = (AssemblyResultPerSectionContext) objects[1];
+ Assert.AreSame(assessmentSection, assemblyResultPerSectionContext.WrappedData);
+ }
+ }
+
+ private static TreeNodeInfo GetInfo(RingtoetsPlugin plugin)
+ {
+ return plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(AssemblyResultsContext));
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/AssessmentSectionTreeNodeInfoTest.cs
===================================================================
diff -u -rb70aa5e9027d1358a2dc38029c2eadae3d3eed4c -rba649bf26cd557bf4788a8b4fa19cf848b36fd87
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/AssessmentSectionTreeNodeInfoTest.cs (.../AssessmentSectionTreeNodeInfoTest.cs) (revision b70aa5e9027d1358a2dc38029c2eadae3d3eed4c)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/AssessmentSectionTreeNodeInfoTest.cs (.../AssessmentSectionTreeNodeInfoTest.cs) (revision ba649bf26cd557bf4788a8b4fa19cf848b36fd87)
@@ -313,16 +313,8 @@
Assert.AreSame(assessmentSection.TechnicalInnovation, technicalInnovationFailureMechanismContext.WrappedData);
Assert.AreSame(assessmentSection, technicalInnovationFailureMechanismContext.Parent);
- var assemblyResultCategoryTreeFolder = (CategoryTreeFolder) objects[24];
- Assert.AreEqual("Assemblage", assemblyResultCategoryTreeFolder.Name);
- Assert.AreEqual(TreeFolderCategory.General, assemblyResultCategoryTreeFolder.Category);
- Assert.AreEqual(2, assemblyResultCategoryTreeFolder.Contents.Count());
-
- var assemblyResultTotalContext = (AssemblyResultTotalContext) assemblyResultCategoryTreeFolder.Contents.ElementAt(0);
- Assert.AreSame(assessmentSection, assemblyResultTotalContext.WrappedData);
-
- var assemblyResultPerSectionContext = (AssemblyResultPerSectionContext) assemblyResultCategoryTreeFolder.Contents.ElementAt(1);
- Assert.AreSame(assessmentSection, assemblyResultPerSectionContext.WrappedData);
+ var assemblyResultsContext = (AssemblyResultsContext) objects[24];
+ Assert.AreSame(assessmentSection, assemblyResultsContext.WrappedData);
}
}