Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Factories/RingtoetsGraphNodeFactory.cs =================================================================== diff -u -rd31087af5b9320ee36f3f8462cc71ed5f1e25e34 -r36d3f041dd6f35e62c53b3d1b95bcd4171aa38b1 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Factories/RingtoetsGraphNodeFactory.cs (.../RingtoetsGraphNodeFactory.cs) (revision d31087af5b9320ee36f3f8462cc71ed5f1e25e34) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Factories/RingtoetsGraphNodeFactory.cs (.../RingtoetsGraphNodeFactory.cs) (revision 36d3f041dd6f35e62c53b3d1b95bcd4171aa38b1) @@ -30,7 +30,7 @@ namespace Ringtoets.Common.Forms.Factories { /// - /// Factory for creating based on information used as input. + /// Factory for creating . /// public static class RingtoetsGraphNodeFactory { @@ -46,9 +46,19 @@ /// The title to set for this node. /// The content to set for this node. /// The created . + /// Thrown when any input parameter is null. public static GraphNode CreateEndGraphNode(string title, string content) { - return new GraphNode(GetGraphNodeContentXml(title, content), + if (title == null) + { + throw new ArgumentNullException(nameof(title)); + } + if (content == null) + { + throw new ArgumentNullException(nameof(content)); + } + + return new GraphNode(GetGraphNodeContentXml(content, title), new GraphNode[0], true, new GraphNodeStyle(GraphNodeShape.Rectangle, Color.SkyBlue, Color.Black, 1)); @@ -61,15 +71,23 @@ /// The content to set for this node. /// The child nodes of this node. /// The created . - /// Thrown when is - /// null. + /// Thrown when any input parameter is null. public static GraphNode CreateCompositeGraphNode(string title, string content, IEnumerable childNodes) { + if (title == null) + { + throw new ArgumentNullException(nameof(title)); + } + if (content == null) + { + throw new ArgumentNullException(nameof(content)); + } if (childNodes == null) { throw new ArgumentNullException(nameof(childNodes)); } - return new GraphNode(GetGraphNodeContentXml(title, content), + + return new GraphNode(GetGraphNodeContentXml(content, title), childNodes.ToArray(), true, new GraphNodeStyle(GraphNodeShape.Rectangle, Color.LightGray, Color.Black, 1)); @@ -81,50 +99,38 @@ /// The title to set for this node. /// The child nodes of this node. /// The created . - /// Thrown when is - /// null. + /// Thrown when any input parameter is null. public static GraphNode CreateConnectingGraphNode(string title, IEnumerable childNodes) { + if (title == null) + { + throw new ArgumentNullException(nameof(title)); + } if (childNodes == null) { throw new ArgumentNullException(nameof(childNodes)); } + return new GraphNode(GetGraphNodeContentXml(title), childNodes.ToArray(), false, new GraphNodeStyle(GraphNodeShape.None, Color.BlanchedAlmond, Color.Black, 1)); } - private static string GetGraphNodeContentXml(string content) + private static string GetGraphNodeContentXml(string content, string title = null) { var builder = new StringBuilder(); using (XmlWriter writer = XmlWriter.Create(builder, xmlWriterSettings)) { writer.WriteStartDocument(); writer.WriteStartElement(GraphNodeContentXmlDefinitions.RootElement); - writer.WriteString(content); + if (title != null) + { + writer.WriteElementString(GraphNodeContentXmlDefinitions.BoldElement, title); - writer.WriteEndElement(); - writer.WriteEndDocument(); - - writer.Flush(); - writer.Close(); - } - - return builder.ToString(); - } - - private static string GetGraphNodeContentXml(string title, string content) - { - var builder = new StringBuilder(); - using (XmlWriter writer = XmlWriter.Create(builder, xmlWriterSettings)) - { - writer.WriteStartDocument(); - writer.WriteStartElement(GraphNodeContentXmlDefinitions.RootElement); - - writer.WriteElementString(GraphNodeContentXmlDefinitions.BoldElement, title); - writer.WriteString(Environment.NewLine); + writer.WriteString(Environment.NewLine); + } writer.WriteString(content); writer.WriteEndElement(); Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/IllustrationPointNodeContext.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/IllustrationPointNodeContext.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/IllustrationPointNodeContext.cs (revision 36d3f041dd6f35e62c53b3d1b95bcd4171aa38b1) @@ -0,0 +1,76 @@ +// 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 Ringtoets.Common.Data.IllustrationPoints; + +namespace Ringtoets.Common.Forms.PresentationObjects +{ + /// + /// This class is a presentation object for an . + /// + public class IllustrationPointNodeContext + { + /// + /// Creates a new instance of . + /// + /// The illustration point node. + /// The name of the wind direction. + /// The closing situation of the illustration point. + /// Thrown when any of the input parameters is null. + public IllustrationPointNodeContext(IllustrationPointNode illustrationPointNode, + string windDirectionName, + string closingSituation) + { + if (illustrationPointNode == null) + { + throw new ArgumentNullException(nameof(illustrationPointNode)); + } + if (windDirectionName == null) + { + throw new ArgumentNullException(nameof(windDirectionName)); + } + if (closingSituation == null) + { + throw new ArgumentNullException(nameof(closingSituation)); + } + + IllustrationPointNode = illustrationPointNode; + WindDirectionName = windDirectionName; + ClosingSituation = closingSituation; + } + + /// + /// Gets the illustration point node. + /// + public IllustrationPointNode IllustrationPointNode { get; } + + /// + /// Gets the wind direction name. + /// + public string WindDirectionName { get; } + + /// + /// Gets the closing situation. + /// + public string ClosingSituation { get; } + } +} \ No newline at end of file Fisheye: Tag 36d3f041dd6f35e62c53b3d1b95bcd4171aa38b1 refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/IllustrationPointNodeFaultTreeContext.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 36d3f041dd6f35e62c53b3d1b95bcd4171aa38b1 refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/IllustrationPointNodeSubMechanismContext.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj =================================================================== diff -u -r1f42c50a516ae7e3504982c15df0ceb0f80bbc7d -r36d3f041dd6f35e62c53b3d1b95bcd4171aa38b1 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 1f42c50a516ae7e3504982c15df0ceb0f80bbc7d) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 36d3f041dd6f35e62c53b3d1b95bcd4171aa38b1) @@ -78,8 +78,7 @@ - - + Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/GeneralResultFaultTreeIllustrationPointView.cs =================================================================== diff -u -r279475cece701c9d6e3b83c08b11a8b75e10665c -r36d3f041dd6f35e62c53b3d1b95bcd4171aa38b1 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/GeneralResultFaultTreeIllustrationPointView.cs (.../GeneralResultFaultTreeIllustrationPointView.cs) (revision 279475cece701c9d6e3b83c08b11a8b75e10665c) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/GeneralResultFaultTreeIllustrationPointView.cs (.../GeneralResultFaultTreeIllustrationPointView.cs) (revision 36d3f041dd6f35e62c53b3d1b95bcd4171aa38b1) @@ -128,18 +128,9 @@ if (selection != null && topLevelFaultTreeIllustrationPoint != null) { - if (selection.Data is FaultTreeIllustrationPoint) - { - Selection = new IllustrationPointNodeFaultTreeContext(selection, - topLevelFaultTreeIllustrationPoint.WindDirection.Name, - topLevelFaultTreeIllustrationPoint.ClosingSituation); - } - if (selection.Data is SubMechanismIllustrationPoint) - { - Selection = new IllustrationPointNodeSubMechanismContext(selection, - topLevelFaultTreeIllustrationPoint.WindDirection.Name, - topLevelFaultTreeIllustrationPoint.ClosingSituation); - } + Selection = new IllustrationPointNodeContext(selection, + topLevelFaultTreeIllustrationPoint.WindDirection.Name, + topLevelFaultTreeIllustrationPoint.ClosingSituation); } else { Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Factories/RingtoetsGraphNodeFactoryTest.cs =================================================================== diff -u -rd31087af5b9320ee36f3f8462cc71ed5f1e25e34 -r36d3f041dd6f35e62c53b3d1b95bcd4171aa38b1 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Factories/RingtoetsGraphNodeFactoryTest.cs (.../RingtoetsGraphNodeFactoryTest.cs) (revision d31087af5b9320ee36f3f8462cc71ed5f1e25e34) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Factories/RingtoetsGraphNodeFactoryTest.cs (.../RingtoetsGraphNodeFactoryTest.cs) (revision 36d3f041dd6f35e62c53b3d1b95bcd4171aa38b1) @@ -53,6 +53,28 @@ } [Test] + public void CreateEndGraphNode_TitleNull_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => RingtoetsGraphNodeFactory.CreateEndGraphNode(null, "content"); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("title", exception.ParamName); + } + + [Test] + public void CreateEndGraphNode_ContentNull_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => RingtoetsGraphNodeFactory.CreateEndGraphNode("title", null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("content", exception.ParamName); + } + + [Test] public void CreateCompositeGraphNode_ValidInput_ReturnsGraphNodeWithExpectedStyling() { // Setup @@ -80,6 +102,38 @@ } [Test] + public void CreateCompositeGraphNode_TitleNull_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => RingtoetsGraphNodeFactory.CreateCompositeGraphNode(null, + "content", + new[] + { + new TestGraphNode() + }); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("title", exception.ParamName); + } + + [Test] + public void CreateCompositeGraphNode_ContentNull_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => RingtoetsGraphNodeFactory.CreateCompositeGraphNode("title", + null, + new[] + { + new TestGraphNode() + }); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("content", exception.ParamName); + } + + [Test] public void CreateCompositeGraphNode_ChildNodesNull_ThrowsArgumentNullException() { // Call @@ -118,6 +172,21 @@ } [Test] + public void CreateConnectingGraphNode_TitleNull_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => RingtoetsGraphNodeFactory.CreateConnectingGraphNode(null, + new[] + { + new TestGraphNode() + }); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("title", exception.ParamName); + } + + [Test] public void CreateConnectingGraphNode_ChildNodesNull_ThrowsArgumentNullException() { // Call Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/IllustrationPointNodeContextTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/IllustrationPointNodeContextTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/IllustrationPointNodeContextTest.cs (revision 36d3f041dd6f35e62c53b3d1b95bcd4171aa38b1) @@ -0,0 +1,89 @@ +// 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 NUnit.Framework; +using Ringtoets.Common.Data.IllustrationPoints; +using Ringtoets.Common.Data.TestUtil.IllustrationPoints; +using Ringtoets.Common.Forms.PresentationObjects; + +namespace Ringtoets.Common.Forms.Test.PresentationObjects +{ + [TestFixture] + public class IllustrationPointNodeContextTest + { + [Test] + public void Constructor_IllustrationPointNodeNull_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new IllustrationPointNodeContext(null, "", ""); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("illustrationPointNode", exception.ParamName); + } + + [Test] + public void Constructor_WindDirectionNameNull_ThrowsArgumentNullException() + { + // Setup + var node = new IllustrationPointNode(new TestFaultTreeIllustrationPoint()); + + // Call + TestDelegate test = () => new IllustrationPointNodeContext(node, null, ""); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("windDirectionName", exception.ParamName); + } + + [Test] + public void Constructor_ClosingSituationNull_ThrowsArgumentNullException() + { + // Setup + var node = new IllustrationPointNode(new TestFaultTreeIllustrationPoint()); + + // Call + TestDelegate test = () => new IllustrationPointNodeContext(node, "", null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("closingSituation", exception.ParamName); + } + + [Test] + public void Constructor_ValidParameters_ExpectedProperties() + { + // Setup + var node = new IllustrationPointNode(new TestFaultTreeIllustrationPoint()); + const string windDirectionName = "wdn"; + const string closingSituation = "cs"; + + // Call + var context = new IllustrationPointNodeContext(node, windDirectionName, closingSituation); + + // Assert + Assert.AreSame(node, context.IllustrationPointNode); + Assert.AreEqual(windDirectionName, context.WindDirectionName); + Assert.AreEqual(closingSituation, context.ClosingSituation); + } + } +} \ No newline at end of file Fisheye: Tag 36d3f041dd6f35e62c53b3d1b95bcd4171aa38b1 refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/IllustrationPointNodeFaultTreeContextTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 36d3f041dd6f35e62c53b3d1b95bcd4171aa38b1 refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/IllustrationPointNodeSubMechanismContextTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj =================================================================== diff -u -r1f42c50a516ae7e3504982c15df0ceb0f80bbc7d -r36d3f041dd6f35e62c53b3d1b95bcd4171aa38b1 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 1f42c50a516ae7e3504982c15df0ceb0f80bbc7d) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 36d3f041dd6f35e62c53b3d1b95bcd4171aa38b1) @@ -94,8 +94,7 @@ - - + Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/GeneralResultFaultTreeIllustrationPointViewTest.cs =================================================================== diff -u -r69d6acd84acd14d6739e70fad44ef155fe1e0f08 -r36d3f041dd6f35e62c53b3d1b95bcd4171aa38b1 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/GeneralResultFaultTreeIllustrationPointViewTest.cs (.../GeneralResultFaultTreeIllustrationPointViewTest.cs) (revision 69d6acd84acd14d6739e70fad44ef155fe1e0f08) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/GeneralResultFaultTreeIllustrationPointViewTest.cs (.../GeneralResultFaultTreeIllustrationPointViewTest.cs) (revision 36d3f041dd6f35e62c53b3d1b95bcd4171aa38b1) @@ -418,7 +418,7 @@ TopLevelFaultTreeIllustrationPoint topLevel = generalResultFunc.TopLevelIllustrationPoints.First(); IllustrationPointNode expectedSelectedNode = topLevel.FaultTreeNodeRoot; - var selectedFaultTreeContext = view.Selection as IllustrationPointNodeFaultTreeContext; + var selectedFaultTreeContext = view.Selection as IllustrationPointNodeContext; Assert.IsNotNull(selectedFaultTreeContext); Assert.AreSame(expectedSelectedNode, selectedFaultTreeContext.IllustrationPointNode); Assert.AreEqual(topLevel.ClosingSituation, selectedFaultTreeContext.ClosingSituation); @@ -460,7 +460,7 @@ TopLevelFaultTreeIllustrationPoint topLevel = generalResultFunc.TopLevelIllustrationPoints.ElementAt(0); IllustrationPointNode expectedSelectedNode = topLevel.FaultTreeNodeRoot.Children.First(); - var selectedSubMechanismContext = view.Selection as IllustrationPointNodeSubMechanismContext; + var selectedSubMechanismContext = view.Selection as IllustrationPointNodeContext; Assert.IsNotNull(selectedSubMechanismContext); Assert.AreSame(expectedSelectedNode, selectedSubMechanismContext.IllustrationPointNode); Assert.AreEqual(topLevel.ClosingSituation, selectedSubMechanismContext.ClosingSituation); Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs =================================================================== diff -u -r7a5ceebeff73be32ba3058a1dc88a075b83db187 -r36d3f041dd6f35e62c53b3d1b95bcd4171aa38b1 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 7a5ceebeff73be32ba3058a1dc88a075b83db187) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 36d3f041dd6f35e62c53b3d1b95bcd4171aa38b1) @@ -48,6 +48,7 @@ using Ringtoets.Common.Data.DikeProfiles; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Data.IllustrationPoints; using Ringtoets.Common.Data.Structures; using Ringtoets.Common.Forms.ChangeHandlers; using Ringtoets.Common.Forms.GuiServices; @@ -334,18 +335,30 @@ CreateInstance = point => new TopLevelFaultTreeIllustrationPointProperties(point.TopLevelFaultTreeIllustrationPoint, point.ClosingSituations) }; - yield return new PropertyInfo + yield return new PropertyInfo { - CreateInstance = context => new FaultTreeIllustrationPointProperties(context.IllustrationPointNode, - context.WindDirectionName, - context.ClosingSituation) + CreateInstance = context => + { + IllustrationPointNode illustrationPointNode = context.IllustrationPointNode; + + if (illustrationPointNode.Data is FaultTreeIllustrationPoint) + { + return new FaultTreeIllustrationPointProperties(illustrationPointNode, + context.WindDirectionName, + context.ClosingSituation); + } + if (illustrationPointNode.Data is SubMechanismIllustrationPoint) + { + return new SubMechanismIllustrationPointProperties(illustrationPointNode, + context.WindDirectionName, + context.ClosingSituation); + } + + return new IllustrationPointProperties(illustrationPointNode, + context.WindDirectionName, + context.ClosingSituation); + } }; - yield return new PropertyInfo - { - CreateInstance = context => new SubMechanismIllustrationPointProperties(context.IllustrationPointNode, - context.WindDirectionName, - context.ClosingSituation) - }; } /// Fisheye: Tag 36d3f041dd6f35e62c53b3d1b95bcd4171aa38b1 refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/IllustrationPointNodeFaultTreeContextPropertyInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/IllustrationPointNodeSubMechanismContextPropertyInfoTest.cs =================================================================== diff -u -r7a5ceebeff73be32ba3058a1dc88a075b83db187 -r36d3f041dd6f35e62c53b3d1b95bcd4171aa38b1 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/IllustrationPointNodeSubMechanismContextPropertyInfoTest.cs (.../IllustrationPointNodeSubMechanismContextPropertyInfoTest.cs) (revision 7a5ceebeff73be32ba3058a1dc88a075b83db187) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/IllustrationPointNodeSubMechanismContextPropertyInfoTest.cs (.../IllustrationPointNodeSubMechanismContextPropertyInfoTest.cs) (revision 36d3f041dd6f35e62c53b3d1b95bcd4171aa38b1) @@ -40,7 +40,7 @@ public void SetUp() { plugin = new RingtoetsPlugin(); - info = plugin.GetPropertyInfos().First(tni => tni.PropertyObjectType == typeof(SubMechanismIllustrationPointProperties)); + info = plugin.GetPropertyInfos().First(tni => tni.PropertyObjectType == typeof(IllustrationPointProperties)); } [TearDown] @@ -53,16 +53,32 @@ public void Initialized_Always_ExpectedPropertiesSet() { // Assert - Assert.AreEqual(typeof(IllustrationPointNodeSubMechanismContext), info.DataType); - Assert.AreEqual(typeof(SubMechanismIllustrationPointProperties), info.PropertyObjectType); + Assert.AreEqual(typeof(IllustrationPointNodeContext), info.DataType); + Assert.AreEqual(typeof(IllustrationPointProperties), info.PropertyObjectType); } [Test] - public void CreateInstance_ValidArguments_ReturnFaultTreeIllustrationPointBaseProperties() + public void CreateInstance_WithIllustrationPointNotSubMechanismOrFaultTree_ReturnIllustrationPointProperties() { // Setup + var illustrationPointNode = new IllustrationPointNode(new TestIllustrationPoint()); + var context = new IllustrationPointNodeContext( + illustrationPointNode, "Wind direction", "Closing situation"); + + // Call + IObjectProperties objectProperties = info.CreateInstance(context); + + // Assert + Assert.IsInstanceOf(objectProperties); + Assert.AreSame(illustrationPointNode, objectProperties.Data); + } + + [Test] + public void CreateInstance_WithSubMechanismIllustrationPoint_ReturnSubMechanismIllustrationPointProperties() + { + // Setup var illustrationPointNode = new IllustrationPointNode(new TestSubMechanismIllustrationPoint()); - var context = new IllustrationPointNodeSubMechanismContext( + var context = new IllustrationPointNodeContext( illustrationPointNode, "Wind direction", "Closing situation"); // Call @@ -72,5 +88,21 @@ Assert.IsInstanceOf(objectProperties); Assert.AreSame(illustrationPointNode, objectProperties.Data); } + + [Test] + public void CreateInstance_WithFaultTreeIllustrationPoint_ReturnFaultTreeIllustrationPointProperties() + { + // Setup + var illustrationPointNode = new IllustrationPointNode(new TestFaultTreeIllustrationPoint()); + var context = new IllustrationPointNodeContext( + illustrationPointNode, "Wind direction", "Closing situation"); + + // Call + IObjectProperties objectProperties = info.CreateInstance(context); + + // Assert + Assert.IsInstanceOf(objectProperties); + Assert.AreSame(illustrationPointNode, objectProperties.Data); + } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj =================================================================== diff -u -r7a5ceebeff73be32ba3058a1dc88a075b83db187 -r36d3f041dd6f35e62c53b3d1b95bcd4171aa38b1 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision 7a5ceebeff73be32ba3058a1dc88a075b83db187) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision 36d3f041dd6f35e62c53b3d1b95bcd4171aa38b1) @@ -85,7 +85,6 @@ - Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs =================================================================== diff -u -r7a5ceebeff73be32ba3058a1dc88a075b83db187 -r36d3f041dd6f35e62c53b3d1b95bcd4171aa38b1 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision 7a5ceebeff73be32ba3058a1dc88a075b83db187) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision 36d3f041dd6f35e62c53b3d1b95bcd4171aa38b1) @@ -204,7 +204,7 @@ PropertyInfo[] propertyInfos = plugin.GetPropertyInfos().ToArray(); // Assert - Assert.AreEqual(19, propertyInfos.Length); + Assert.AreEqual(18, propertyInfos.Length); PluginTestHelper.AssertPropertyInfoDefined( propertyInfos, @@ -293,13 +293,8 @@ PluginTestHelper.AssertPropertyInfoDefined( propertyInfos, - typeof(IllustrationPointNodeFaultTreeContext), - typeof(FaultTreeIllustrationPointProperties)); - - PluginTestHelper.AssertPropertyInfoDefined( - propertyInfos, - typeof(IllustrationPointNodeSubMechanismContext), - typeof(SubMechanismIllustrationPointProperties)); + typeof(IllustrationPointNodeContext), + typeof(IllustrationPointProperties)); } }