Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs
===================================================================
diff -u -r58553ea29ddb98c5be3b8ae3417e38135e3ed81c -r66ca75cc41304270ae2491118a74c2d97fcc0060
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 58553ea29ddb98c5be3b8ae3417e38135e3ed81c)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 66ca75cc41304270ae2491118a74c2d97fcc0060)
@@ -92,6 +92,15 @@
}
///
+ /// Looks up a localized string similar to Categoriegrenzen.
+ ///
+ public static string AssemblyCategories_DisplayName {
+ get {
+ return ResourceManager.GetString("AssemblyCategories_DisplayName", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to Kleur.
///
public static string AssemblyCategory_Color_DisplayName {
@@ -1464,15 +1473,6 @@
}
///
- /// Looks up a localized string similar to Categoriegrenzen.
- ///
- public static string FailureMechanismAssemblyCategories_DisplayName {
- get {
- return ResourceManager.GetString("FailureMechanismAssemblyCategories_DisplayName", resourceCulture);
- }
- }
-
- ///
/// Looks up a localized string similar to I&s relevant.
///
public static string FailureMechanismContextMenuStrip_Is_relevant {
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx
===================================================================
diff -u -r58553ea29ddb98c5be3b8ae3417e38135e3ed81c -r66ca75cc41304270ae2491118a74c2d97fcc0060
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 58553ea29ddb98c5be3b8ae3417e38135e3ed81c)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 66ca75cc41304270ae2491118a74c2d97fcc0060)
@@ -1389,7 +1389,7 @@
Toetsoordeel voor dit toetsspoor:
-
+
Categoriegrenzen
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DesignWaterLevelHydraulicBoundaryLocationProperties.cs
===================================================================
diff -u -re9602557466ba57cb9d288377cf0a3ab0fb0426c -r66ca75cc41304270ae2491118a74c2d97fcc0060
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DesignWaterLevelHydraulicBoundaryLocationProperties.cs (.../DesignWaterLevelHydraulicBoundaryLocationProperties.cs) (revision e9602557466ba57cb9d288377cf0a3ab0fb0426c)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DesignWaterLevelHydraulicBoundaryLocationProperties.cs (.../DesignWaterLevelHydraulicBoundaryLocationProperties.cs) (revision 66ca75cc41304270ae2491118a74c2d97fcc0060)
@@ -46,7 +46,7 @@
[PropertyOrder(4)]
[ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))]
- [ResourcesDisplayName(typeof(Resources), nameof(Resources.FailureMechanismAssemblyCategories_DisplayName))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.AssemblyCategories_DisplayName))]
[ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryLocationProperties_CategoryBoundaries_Description))]
[TypeConverter(typeof(ExpandableArrayConverter))]
public DesignWaterLevelCalculationCategoryBoundaryProperties[] CategoryBoundaries
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/WaveHeightHydraulicBoundaryLocationProperties.cs
===================================================================
diff -u -re9602557466ba57cb9d288377cf0a3ab0fb0426c -r66ca75cc41304270ae2491118a74c2d97fcc0060
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/WaveHeightHydraulicBoundaryLocationProperties.cs (.../WaveHeightHydraulicBoundaryLocationProperties.cs) (revision e9602557466ba57cb9d288377cf0a3ab0fb0426c)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/WaveHeightHydraulicBoundaryLocationProperties.cs (.../WaveHeightHydraulicBoundaryLocationProperties.cs) (revision 66ca75cc41304270ae2491118a74c2d97fcc0060)
@@ -46,7 +46,7 @@
[PropertyOrder(4)]
[ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))]
- [ResourcesDisplayName(typeof(Resources), nameof(Resources.FailureMechanismAssemblyCategories_DisplayName))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.AssemblyCategories_DisplayName))]
[ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryLocationProperties_CategoryBoundaries_Description))]
[TypeConverter(typeof(ExpandableArrayConverter))]
public WaveHeightCalculationCategoryBoundaryProperties[] CategoryBoundaries
Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs
===================================================================
diff -u -rab9e6a1f47225304b418f5fce8a3c321e7439886 -r66ca75cc41304270ae2491118a74c2d97fcc0060
--- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision ab9e6a1f47225304b418f5fce8a3c321e7439886)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 66ca75cc41304270ae2491118a74c2d97fcc0060)
@@ -619,7 +619,7 @@
yield return new ViewInfo
{
- GetViewName = (view, context) => RingtoetsCommonFormsResources.FailureMechanismAssemblyCategories_DisplayName,
+ GetViewName = (view, context) => RingtoetsCommonFormsResources.AssemblyCategories_DisplayName,
Image = RingtoetsCommonFormsResources.NormsIcon,
CloseForData = RingtoetsPluginHelper.ShouldCloseForFailureMechanismView,
CreateInstance = context => new FailureMechanismAssemblyCategoriesView(context.WrappedData,
@@ -630,7 +630,7 @@
yield return new ViewInfo
{
- GetViewName = (view, context) => RingtoetsCommonFormsResources.FailureMechanismAssemblyCategories_DisplayName,
+ GetViewName = (view, context) => RingtoetsCommonFormsResources.AssemblyCategories_DisplayName,
Image = RingtoetsCommonFormsResources.NormsIcon,
CloseForData = RingtoetsPluginHelper.ShouldCloseForFailureMechanismView,
CreateInstance = context => new MacroStabilityOutwardsAssemblyCategoriesView((MacroStabilityOutwardsFailureMechanism) context.WrappedData,
@@ -1085,7 +1085,7 @@
yield return new TreeNodeInfo
{
- Text = context => RingtoetsCommonFormsResources.FailureMechanismAssemblyCategories_DisplayName,
+ Text = context => RingtoetsCommonFormsResources.AssemblyCategories_DisplayName,
Image = context => RingtoetsCommonFormsResources.NormsIcon,
ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl)
.AddOpenItem()
@@ -1096,7 +1096,7 @@
yield return new TreeNodeInfo
{
- Text = context => RingtoetsCommonFormsResources.FailureMechanismAssemblyCategories_DisplayName,
+ Text = context => RingtoetsCommonFormsResources.AssemblyCategories_DisplayName,
Image = context => RingtoetsCommonFormsResources.NormsIcon,
ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl)
.AddOpenItem()
@@ -1117,6 +1117,17 @@
.AddExpandAllItem()
.Build()
};
+
+ yield return new TreeNodeInfo
+ {
+ Text = context => RingtoetsCommonFormsResources.AssemblyCategories_DisplayName,
+ Image = context => RingtoetsCommonFormsResources.NormsIcon,
+ ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl)
+ .AddOpenItem()
+ .AddSeparator()
+ .AddPropertiesItem()
+ .Build()
+ };
}
private static ViewInfo, IObservableEnumerable, TView> CreateFailureMechanismResultViewInfo<
@@ -2335,6 +2346,7 @@
AssessmentSection assessmentSection = context.WrappedData;
return new object[]
{
+ new AssemblyResultCategoriesContext(assessmentSection),
new AssemblyResultTotalContext(assessmentSection),
new AssemblyResultPerSectionContext(assessmentSection)
};
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj
===================================================================
diff -u -rab9e6a1f47225304b418f5fce8a3c321e7439886 -r66ca75cc41304270ae2491118a74c2d97fcc0060
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision ab9e6a1f47225304b418f5fce8a3c321e7439886)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision 66ca75cc41304270ae2491118a74c2d97fcc0060)
@@ -95,6 +95,7 @@
+
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs
===================================================================
diff -u -rab9e6a1f47225304b418f5fce8a3c321e7439886 -r66ca75cc41304270ae2491118a74c2d97fcc0060
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision ab9e6a1f47225304b418f5fce8a3c321e7439886)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision 66ca75cc41304270ae2491118a74c2d97fcc0060)
@@ -526,7 +526,7 @@
TreeNodeInfo[] treeNodeInfos = plugin.GetTreeNodeInfos().ToArray();
// Assert
- Assert.AreEqual(39, treeNodeInfos.Length);
+ Assert.AreEqual(40, 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)));
@@ -566,6 +566,7 @@
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(MacroStabilityOutwardsAssemblyCategoriesContext)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismAssemblyCategoriesContext)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(AssemblyResultsContext)));
+ Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(AssemblyResultCategoriesContext)));
}
}
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/AssemblyResultCategoriesContextTreeNodeInfoTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/AssemblyResultCategoriesContextTreeNodeInfoTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/AssemblyResultCategoriesContextTreeNodeInfoTest.cs (revision 66ca75cc41304270ae2491118a74c2d97fcc0060)
@@ -0,0 +1,150 @@
+// 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 AssemblyResultCategoriesContextTreeNodeInfoTest
+ {
+ [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.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_ReturnsSetName()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ TreeNodeInfo info = GetInfo(plugin);
+
+ // Call
+ string text = info.Text(null);
+
+ // Assert
+ Assert.AreEqual("Categoriegrenzen", 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.NormsIcon, image);
+ }
+ }
+
+ [Test]
+ public void ContextMenuStrip_Always_CallsContextMenuBuilderMethods()
+ {
+ // Setup
+ var random = new Random(21);
+ var assessmentSection = new AssessmentSection(random.NextEnumValue());
+ var context = new AssemblyResultCategoriesContext(assessmentSection);
+
+ var mocks = new MockRepository();
+ var menuBuilder = mocks.StrictMock();
+
+ using (mocks.Ordered())
+ {
+ menuBuilder.Expect(mb => mb.AddOpenItem()).Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.AddSeparator()).Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.AddPropertiesItem()).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();
+ }
+
+ private static TreeNodeInfo GetInfo(RingtoetsPlugin plugin)
+ {
+ return plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(AssemblyResultCategoriesContext));
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/AssemblyResultsContextTreeNodeInfoTest.cs
===================================================================
diff -u -rb7e8c83756a72d0fc5c321271fc3f474c1336274 -r66ca75cc41304270ae2491118a74c2d97fcc0060
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/AssemblyResultsContextTreeNodeInfoTest.cs (.../AssemblyResultsContextTreeNodeInfoTest.cs) (revision b7e8c83756a72d0fc5c321271fc3f474c1336274)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/AssemblyResultsContextTreeNodeInfoTest.cs (.../AssemblyResultsContextTreeNodeInfoTest.cs) (revision 66ca75cc41304270ae2491118a74c2d97fcc0060)
@@ -159,12 +159,15 @@
object[] objects = info.ChildNodeObjects(context).ToArray();
// Assert
- Assert.AreEqual(2, objects.Length);
+ Assert.AreEqual(3, objects.Length);
- var assemblyResultTotalContext = (AssemblyResultTotalContext) objects[0];
+ var assemblyResultCategoriesContext = (AssemblyResultCategoriesContext) objects[0];
+ Assert.AreSame(assessmentSection, assemblyResultCategoriesContext.WrappedData);
+
+ var assemblyResultTotalContext = (AssemblyResultTotalContext) objects[1];
Assert.AreSame(assessmentSection, assemblyResultTotalContext.WrappedData);
- var assemblyResultPerSectionContext = (AssemblyResultPerSectionContext) objects[1];
+ var assemblyResultPerSectionContext = (AssemblyResultPerSectionContext) objects[2];
Assert.AreSame(assessmentSection, assemblyResultPerSectionContext.WrappedData);
}
}