Fisheye: Tag f95a6fe33de7536ebff9698dccdb74b492cbb7e7 refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Data/IllustrationPoints/FaultTreeIllustrationPointNode.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Common/src/Ringtoets.Common.Data/IllustrationPoints/IllustrationPointNode.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Data/IllustrationPoints/IllustrationPointNode.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/IllustrationPoints/IllustrationPointNode.cs (revision f95a6fe33de7536ebff9698dccdb74b492cbb7e7)
@@ -0,0 +1,88 @@
+// 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.Collections.Generic;
+using System.Linq;
+using Ringtoets.Common.Data.Properties;
+
+namespace Ringtoets.Common.Data.IllustrationPoints
+{
+ ///
+ /// A node with attached illustration point data that is part of a tree. Multiple
+ /// nodes form the tree structure describing how the illustration points are related.
+ ///
+ public class IllustrationPointNode
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The illustration point data that is attached
+ /// to this node.
+ /// Thrown when
+ /// is null.
+ public IllustrationPointNode(IllustrationPointBase data)
+ {
+ if (data == null)
+ {
+ throw new ArgumentNullException(nameof(data));
+ }
+
+ Data = data;
+ Children = Enumerable.Empty();
+ }
+
+ ///
+ /// Gets the attached illustration point data to this node.
+ ///
+ public IllustrationPointBase Data { get; }
+
+ ///
+ /// Gets the attached child nodes of this node.
+ ///
+ public IEnumerable Children { get; private set; }
+
+ ///
+ /// Sets the children to this node.
+ ///
+ /// The children that are attached to this node.
+ /// Thrown when
+ /// does not contain 0 or 2 elements.
+ public void SetChildren(IllustrationPointNode[] children)
+ {
+ if (children == null)
+ {
+ throw new ArgumentNullException(nameof(children));
+ }
+
+ int nrOfChildren = children.Length;
+ if (nrOfChildren == 0 || nrOfChildren == 2)
+ {
+ Children = children;
+ }
+ else
+ {
+ throw new ArgumentException(Resources.FaultTreeIllustrationPointNode_SetChildren_Node_must_have_zero_or_two_child_nodes,
+ nameof(children));
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Data/IllustrationPoints/TopLevelFaultTreeIllustrationPoint.cs
===================================================================
diff -u -r723e8357991d59d7784212cb433bb4571e0cdefb -rf95a6fe33de7536ebff9698dccdb74b492cbb7e7
--- Ringtoets/Common/src/Ringtoets.Common.Data/IllustrationPoints/TopLevelFaultTreeIllustrationPoint.cs (.../TopLevelFaultTreeIllustrationPoint.cs) (revision 723e8357991d59d7784212cb433bb4571e0cdefb)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/IllustrationPoints/TopLevelFaultTreeIllustrationPoint.cs (.../TopLevelFaultTreeIllustrationPoint.cs) (revision f95a6fe33de7536ebff9698dccdb74b492cbb7e7)
@@ -39,7 +39,7 @@
/// is null.
public TopLevelFaultTreeIllustrationPoint(WindDirection windDirection,
string closingSituation,
- FaultTreeIllustrationPointNode faultTreeNodeRoot)
+ IllustrationPointNode faultTreeNodeRoot)
: base(windDirection, closingSituation)
{
if (windDirection == null)
@@ -61,6 +61,6 @@
///
/// Gets the root of the illustration points of the fault tree.
///
- public FaultTreeIllustrationPointNode FaultTreeNodeRoot { get; }
+ public IllustrationPointNode FaultTreeNodeRoot { get; }
}
}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj
===================================================================
diff -u -ra3098aef2e340356b62d44d151a1d8a9787d0ab0 -rf95a6fe33de7536ebff9698dccdb74b492cbb7e7
--- Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj (.../Ringtoets.Common.Data.csproj) (revision a3098aef2e340356b62d44d151a1d8a9787d0ab0)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj (.../Ringtoets.Common.Data.csproj) (revision f95a6fe33de7536ebff9698dccdb74b492cbb7e7)
@@ -69,7 +69,7 @@
-
+
Fisheye: Tag f95a6fe33de7536ebff9698dccdb74b492cbb7e7 refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Data.Test/IllustrationPoints/FaultTreeIllustrationPointNodeTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/IllustrationPoints/IllustrationPointNodeTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Data.Test/IllustrationPoints/IllustrationPointNodeTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/IllustrationPoints/IllustrationPointNodeTest.cs (revision f95a6fe33de7536ebff9698dccdb74b492cbb7e7)
@@ -0,0 +1,128 @@
+// 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.Collections.Generic;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.IllustrationPoints;
+using Ringtoets.Common.Data.TestUtil.IllustrationPoints;
+
+namespace Ringtoets.Common.Data.Test.IllustrationPoints
+{
+ [TestFixture]
+ public class IllustrationPointNodeTest
+ {
+ [Test]
+ public void Constructor_DataNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new IllustrationPointNode(null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("data", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_ValidArguments_ReturnExpectedValues()
+ {
+ // Setup
+ var data = new TestIllustrationPoint();
+
+ // Call
+ var faultTreeNode = new IllustrationPointNode(data);
+
+ // Assert
+ Assert.AreSame(data, faultTreeNode.Data);
+ Assert.IsEmpty(faultTreeNode.Children);
+ }
+
+ [Test]
+ public void SetChildren_ChildrenNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var faultTreeNode = new IllustrationPointNode(new TestIllustrationPoint());
+
+ // Call
+ TestDelegate call = () => faultTreeNode.SetChildren(null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("children", exception.ParamName);
+ }
+
+ [Test]
+ [TestCase(1)]
+ [TestCase(3)]
+ public void SetChildren_InvalidNrOfChildren_ThrowsInvalidArgumentException(int nrOfChildren)
+ {
+ // Setup
+ var faultTreeNode = new IllustrationPointNode(new TestIllustrationPoint());
+
+ var childrenToBeAttached = new List();
+ for (var i = 0; i < nrOfChildren; i++)
+ {
+ childrenToBeAttached.Add(new IllustrationPointNode(new TestIllustrationPoint()));
+ }
+
+ // Call
+ TestDelegate call = () => faultTreeNode.SetChildren(childrenToBeAttached.ToArray());
+
+ // Assert
+ const string expectedMessage = "Een illustratiepunt node in de foutenboom moet 0 of 2 kind nodes hebben.";
+ var exception = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage);
+ Assert.AreEqual("children", exception.ParamName);
+ }
+
+ [Test]
+ public void SetChildren_NoChildren_ReturnsExpectedProperties()
+ {
+ // Setup
+ var faultTreeNode = new IllustrationPointNode(new TestIllustrationPoint());
+
+ // Call
+ faultTreeNode.SetChildren(new IllustrationPointNode[0]);
+
+ // Assert
+ CollectionAssert.IsEmpty(faultTreeNode.Children);
+ }
+
+ [Test]
+ public void SetChildren_TwoChildren_ReturnsExpectedProperties()
+ {
+ // Setup
+ var faultTreeNode = new IllustrationPointNode(new TestIllustrationPoint());
+
+ var childrenToBeAttached = new[]
+ {
+ new IllustrationPointNode(new TestIllustrationPoint()),
+ new IllustrationPointNode(new TestIllustrationPoint())
+ };
+
+ // Call
+ faultTreeNode.SetChildren(childrenToBeAttached);
+
+ // Assert
+ CollectionAssert.AreEqual(childrenToBeAttached, faultTreeNode.Children);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/IllustrationPoints/TopLevelFaultTreeIllustrationPointTest.cs
===================================================================
diff -u -ra3098aef2e340356b62d44d151a1d8a9787d0ab0 -rf95a6fe33de7536ebff9698dccdb74b492cbb7e7
--- Ringtoets/Common/test/Ringtoets.Common.Data.Test/IllustrationPoints/TopLevelFaultTreeIllustrationPointTest.cs (.../TopLevelFaultTreeIllustrationPointTest.cs) (revision a3098aef2e340356b62d44d151a1d8a9787d0ab0)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/IllustrationPoints/TopLevelFaultTreeIllustrationPointTest.cs (.../TopLevelFaultTreeIllustrationPointTest.cs) (revision f95a6fe33de7536ebff9698dccdb74b492cbb7e7)
@@ -12,7 +12,7 @@
public void Constructor_WindDirectionNull_ThrowsArgumentNullException()
{
// Setup
- var faultTreeNode = new FaultTreeIllustrationPointNode(new TestIllustrationPoint());
+ var faultTreeNode = new IllustrationPointNode(new TestIllustrationPoint());
// Call
TestDelegate call = () => new TopLevelFaultTreeIllustrationPoint(null,
@@ -29,7 +29,7 @@
{
// Setup
WindDirection windDirection = WindDirectionTestFactory.CreateTestWindDirection();
- var faultTreeNode = new FaultTreeIllustrationPointNode(new TestIllustrationPoint());
+ var faultTreeNode = new IllustrationPointNode(new TestIllustrationPoint());
// Call
TestDelegate call = () => new TopLevelFaultTreeIllustrationPoint(windDirection,
@@ -64,7 +64,7 @@
WindDirection windDirection = WindDirectionTestFactory.CreateTestWindDirection();
const string closingSituation = "closing situation";
- var faultTreeNode = new FaultTreeIllustrationPointNode(new TestIllustrationPoint());
+ var faultTreeNode = new IllustrationPointNode(new TestIllustrationPoint());
// Call
var illustrationPoint = new TopLevelFaultTreeIllustrationPoint(windDirection, closingSituation, faultTreeNode);
Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj
===================================================================
diff -u -ra3098aef2e340356b62d44d151a1d8a9787d0ab0 -rf95a6fe33de7536ebff9698dccdb74b492cbb7e7
--- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj (.../Ringtoets.Common.Data.Test.csproj) (revision a3098aef2e340356b62d44d151a1d8a9787d0ab0)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj (.../Ringtoets.Common.Data.Test.csproj) (revision f95a6fe33de7536ebff9698dccdb74b492cbb7e7)
@@ -79,7 +79,7 @@
-
+