Index: Riskeer/Common/src/Riskeer.Common.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r00a56244b50c5a359475c5135cccc004aa9d3689 -r28eb5cbe63e6fe992d25a4856fbd1564ca657236 --- Riskeer/Common/src/Riskeer.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 00a56244b50c5a359475c5135cccc004aa9d3689) +++ Riskeer/Common/src/Riskeer.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 28eb5cbe63e6fe992d25a4856fbd1564ca657236) @@ -2686,6 +2686,15 @@ } /// + /// Looks up a localized string similar to Normklassen. + /// + public static string NormClasses_DisplayName { + get { + return ResourceManager.GetString("NormClasses_DisplayName", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Normen. /// public static string Norms_DisplayName { Index: Riskeer/Common/src/Riskeer.Common.Forms/Properties/Resources.resx =================================================================== diff -u -r00a56244b50c5a359475c5135cccc004aa9d3689 -r28eb5cbe63e6fe992d25a4856fbd1564ca657236 --- Riskeer/Common/src/Riskeer.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 00a56244b50c5a359475c5135cccc004aa9d3689) +++ Riskeer/Common/src/Riskeer.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 28eb5cbe63e6fe992d25a4856fbd1564ca657236) @@ -1421,6 +1421,9 @@ Toetsoordeel toets op maat + + Normklassen + Gecombineerd toetsoordeel Index: Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs =================================================================== diff -u -rbac21c8c37a2685b531f0dff891b282e34e06b24 -r28eb5cbe63e6fe992d25a4856fbd1564ca657236 --- Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs (.../RiskeerPlugin.cs) (revision bac21c8c37a2685b531f0dff891b282e34e06b24) +++ Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs (.../RiskeerPlugin.cs) (revision 28eb5cbe63e6fe992d25a4856fbd1564ca657236) @@ -1001,6 +1001,17 @@ .Build() }; + yield return new TreeNodeInfo + { + Text = context => RiskeerCommonFormsResources.NormClasses_DisplayName, + Image = context => RiskeerCommonFormsResources.NormsIcon, + ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl) + .AddOpenItem() + .AddSeparator() + .AddPropertiesItem() + .Build() + }; + yield return new TreeNodeInfo { Text = context => RiskeerCommonFormsResources.CombinedAssembly_DisplayName, Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/RiskeerPluginTest.cs =================================================================== diff -u -ra3ecf99ea72cb40630c422be2f420507318d27c8 -r28eb5cbe63e6fe992d25a4856fbd1564ca657236 --- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/RiskeerPluginTest.cs (.../RiskeerPluginTest.cs) (revision a3ecf99ea72cb40630c422be2f420507318d27c8) +++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/RiskeerPluginTest.cs (.../RiskeerPluginTest.cs) (revision 28eb5cbe63e6fe992d25a4856fbd1564ca657236) @@ -543,7 +543,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(AssessmentSectionStateRootContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(HydraulicLoadsStateRootContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(CalculationsStateRootContext))); @@ -575,6 +575,7 @@ Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(WaterPressureAsphaltCoverFailureMechanismSectionResultContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(Comment))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(StructuresOutputContext))); + Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(NormClassesContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(AssemblyResultTotalContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(AssemblyResultPerSectionContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(AssemblyResultsContext))); Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/AssemblyResultsContextTreeNodeInfoTest.cs =================================================================== diff -u -rc8df40c654d3cc268ed5e7347943d81637e83b52 -r28eb5cbe63e6fe992d25a4856fbd1564ca657236 --- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/AssemblyResultsContextTreeNodeInfoTest.cs (.../AssemblyResultsContextTreeNodeInfoTest.cs) (revision c8df40c654d3cc268ed5e7347943d81637e83b52) +++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/AssemblyResultsContextTreeNodeInfoTest.cs (.../AssemblyResultsContextTreeNodeInfoTest.cs) (revision 28eb5cbe63e6fe992d25a4856fbd1564ca657236) @@ -174,15 +174,18 @@ object[] objects = info.ChildNodeObjects(context).ToArray(); // Assert - Assert.AreEqual(3, objects.Length); + Assert.AreEqual(4, objects.Length); - var assemblyResultTotalContext = (AssemblyResultTotalContext) objects[0]; + var normClassesContext = (NormClassesContext) objects[0]; + Assert.AreSame(assessmentSection, normClassesContext.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); - var assemblyResultPerSectionMapContext = (AssemblyResultPerSectionMapContext) objects[2]; + var assemblyResultPerSectionMapContext = (AssemblyResultPerSectionMapContext) objects[3]; Assert.AreSame(assessmentSection, assemblyResultPerSectionMapContext.WrappedData); } } Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/NormClassesContextTreeNodeInfoTest.cs =================================================================== diff -u --- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/NormClassesContextTreeNodeInfoTest.cs (revision 0) +++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/NormClassesContextTreeNodeInfoTest.cs (revision 28eb5cbe63e6fe992d25a4856fbd1564ca657236) @@ -0,0 +1,149 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer 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.TestUtil; +using Core.Gui; +using Core.Gui.ContextMenu; +using NUnit.Framework; +using Rhino.Mocks; +using Riskeer.Common.Data.AssessmentSection; +using Riskeer.Common.Forms.Properties; +using Riskeer.Common.Plugin.TestUtil; +using Riskeer.Integration.Data; +using Riskeer.Integration.Forms.PresentationObjects; + +namespace Riskeer.Integration.Plugin.Test.TreeNodeInfos +{ + [TestFixture] + public class NormClassesContextTreeNodeInfoTest + { + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Setup + using (var plugin = new RiskeerPlugin()) + { + 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.CheckedState); + 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 RiskeerPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + // Call + string text = info.Text(null); + + // Assert + Assert.AreEqual("Normklassen", text); + } + } + + [Test] + public void Image_Always_ReturnsSetImage() + { + // Setup + using (var plugin = new RiskeerPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + // Call + Image image = info.Image(null); + + // Assert + TestHelper.AssertImagesAreEqual(Resources.NormsIcon, image); + } + } + + [Test] + public void ContextMenuStrip_Always_CallsContextMenuBuilderMethods() + { + // Setup + var random = new Random(21); + var assessmentSection = new AssessmentSection(random.NextEnumValue()); + var context = new NormClassesContext(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()) + { + IGui gui = StubFactory.CreateGuiStub(mocks); + gui.Stub(cmp => cmp.Get(context, treeViewControl)).Return(menuBuilder); + mocks.ReplayAll(); + + using (var plugin = new RiskeerPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + plugin.Gui = gui; + + // Call + info.ContextMenuStrip(context, null, treeViewControl); + } + } + + // Assert + mocks.VerifyAll(); + } + + private static TreeNodeInfo GetInfo(RiskeerPlugin plugin) + { + return plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(NormClassesContext)); + } + } +} \ No newline at end of file