Index: Core/Components/src/Core.Components.GraphSharp/Core.Components.GraphSharp.csproj =================================================================== diff -u -r95433bcf41f452154959a6884129265c6de295b7 -r83a3d88b3df8452281d5f020060e8cfb2b6fb85e --- Core/Components/src/Core.Components.GraphSharp/Core.Components.GraphSharp.csproj (.../Core.Components.GraphSharp.csproj) (revision 95433bcf41f452154959a6884129265c6de295b7) +++ Core/Components/src/Core.Components.GraphSharp/Core.Components.GraphSharp.csproj (.../Core.Components.GraphSharp.csproj) (revision 83a3d88b3df8452281d5f020060e8cfb2b6fb85e) @@ -42,6 +42,7 @@ ..\..\..\..\packages\GraphSharp.1.1.0.0\lib\net40\GraphSharp.Controls.dll True + ..\..\..\..\packages\QuickGraph.3.6.61119.7\lib\net4\QuickGraph.dll True @@ -60,6 +61,7 @@ + ..\..\..\..\packages\WPFExtensions.1.0.0\lib\WPFExtensions.dll True Index: Core/Components/src/Core.Components.GraphSharp/Data/PointedTreeElementVertex.cs =================================================================== diff -u -r95433bcf41f452154959a6884129265c6de295b7 -r83a3d88b3df8452281d5f020060e8cfb2b6fb85e --- Core/Components/src/Core.Components.GraphSharp/Data/PointedTreeElementVertex.cs (.../PointedTreeElementVertex.cs) (revision 95433bcf41f452154959a6884129265c6de295b7) +++ Core/Components/src/Core.Components.GraphSharp/Data/PointedTreeElementVertex.cs (.../PointedTreeElementVertex.cs) (revision 83a3d88b3df8452281d5f020060e8cfb2b6fb85e) @@ -19,6 +19,8 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; +using System.Windows.Media; using GraphSharp.Controls; namespace Core.Components.GraphSharp.Data @@ -28,5 +30,72 @@ /// public class PointedTreeElementVertex { + /// + /// Creates a new instance of . + /// + /// The content of the vertex. + /// The fill color of the vertex. + /// The line color of the vertex. + /// The line width of the vertex. + /// The type of the vertex. + /// Indicator whether the vertex is selectable. + /// Thrown when + /// or is null. + public PointedTreeElementVertex(string content, Brush fillColor, Brush lineColor, int lineWidth, PointedTreeVertexType type, bool isSelectable) + { + if (content == null) + { + throw new ArgumentNullException(nameof(content)); + } + if (fillColor == null) + { + throw new ArgumentNullException(nameof(fillColor)); + } + if (lineColor == null) + { + throw new ArgumentNullException(nameof(lineColor)); + } + Content = content; + FillColor = fillColor; + LineColor = lineColor; + LineWidth = lineWidth; + Type = type; + IsSelectable = isSelectable; + } + + /// + /// Gets the content of the vertex. + /// + public string Content { get; } + + /// + /// Gets the fill color of the vertex. + /// + public Brush FillColor { get; } + + /// + /// Gets the line color of the vertex. + /// + public Brush LineColor { get; } + + /// + /// Gets the line widht of the vertex. + /// + public int LineWidth { get;} + + /// + /// Gets the type of the vertex. + /// + public PointedTreeVertexType Type { get; } + + /// + /// Gets whether the vertex is selectable. + /// + public bool IsSelectable { get; } + + /// + /// Gets whether the vertex is selected. + /// + public bool IsSelected { get; set; } } } \ No newline at end of file Index: Core/Components/test/Core.Components.GraphSharp.Test/Core.Components.GraphSharp.Test.csproj =================================================================== diff -u -r95433bcf41f452154959a6884129265c6de295b7 -r83a3d88b3df8452281d5f020060e8cfb2b6fb85e --- Core/Components/test/Core.Components.GraphSharp.Test/Core.Components.GraphSharp.Test.csproj (.../Core.Components.GraphSharp.Test.csproj) (revision 95433bcf41f452154959a6884129265c6de295b7) +++ Core/Components/test/Core.Components.GraphSharp.Test/Core.Components.GraphSharp.Test.csproj (.../Core.Components.GraphSharp.Test.csproj) (revision 83a3d88b3df8452281d5f020060e8cfb2b6fb85e) @@ -51,6 +51,7 @@ ..\..\..\..\packages\NUnit.3.6.0\lib\net40\nunit.framework.dll True + ..\..\..\..\packages\QuickGraph.3.6.61119.7\lib\net4\QuickGraph.dll True Index: Core/Components/test/Core.Components.GraphSharp.Test/Data/PointedTreeEdgeTest.cs =================================================================== diff -u -r95433bcf41f452154959a6884129265c6de295b7 -r83a3d88b3df8452281d5f020060e8cfb2b6fb85e --- Core/Components/test/Core.Components.GraphSharp.Test/Data/PointedTreeEdgeTest.cs (.../PointedTreeEdgeTest.cs) (revision 95433bcf41f452154959a6884129265c6de295b7) +++ Core/Components/test/Core.Components.GraphSharp.Test/Data/PointedTreeEdgeTest.cs (.../PointedTreeEdgeTest.cs) (revision 83a3d88b3df8452281d5f020060e8cfb2b6fb85e) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System.Windows.Media; using Core.Components.GraphSharp.Data; using NUnit.Framework; using QuickGraph; @@ -32,8 +33,8 @@ public void Constructor_ExpectedValues() { // Setup - var source = new PointedTreeElementVertex(); - var target = new PointedTreeElementVertex(); + var source = new TestVertex(); + var target = new TestVertex(); // Call var edge = new PointedTreeEdge(source, target); @@ -43,5 +44,12 @@ Assert.AreSame(source, edge.Source); Assert.AreSame(target, edge.Target); } + + private class TestVertex : PointedTreeElementVertex + { + public TestVertex() : base("test", new SolidColorBrush(Colors.Gray), + new SolidColorBrush(Colors.Black), 2, + PointedTreeVertexType.Rectangle, false) {} + } } } \ No newline at end of file Index: Core/Components/test/Core.Components.GraphSharp.Test/Data/PointedTreeElementVertexTest.cs =================================================================== diff -u -r95433bcf41f452154959a6884129265c6de295b7 -r83a3d88b3df8452281d5f020060e8cfb2b6fb85e --- Core/Components/test/Core.Components.GraphSharp.Test/Data/PointedTreeElementVertexTest.cs (.../PointedTreeElementVertexTest.cs) (revision 95433bcf41f452154959a6884129265c6de295b7) +++ Core/Components/test/Core.Components.GraphSharp.Test/Data/PointedTreeElementVertexTest.cs (.../PointedTreeElementVertexTest.cs) (revision 83a3d88b3df8452281d5f020060e8cfb2b6fb85e) @@ -19,13 +19,71 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; +using System.Windows.Media; +using Core.Components.GraphSharp.Data; using NUnit.Framework; namespace Core.Components.GraphSharp.Test.Data { [TestFixture] public class PointedTreeElementVertexTest { - + [Test] + public void Constructor_ContentNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new PointedTreeElementVertex(null, new SolidColorBrush(Colors.Gray), new SolidColorBrush(Colors.Gray), 3, PointedTreeVertexType.Diamond, false); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("content", exception.ParamName); + } + + [Test] + public void Constructor_FillColorNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new PointedTreeElementVertex("test", null, new SolidColorBrush(Colors.Gray), 3, PointedTreeVertexType.Diamond, false); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("fillColor", exception.ParamName); + } + + [Test] + public void Constructor_LineColorNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new PointedTreeElementVertex("test", new SolidColorBrush(Colors.Gray), null, 3, PointedTreeVertexType.Diamond, false); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("lineColor", exception.ParamName); + } + + [Test] + public void Constructor_ExpectedValues() + { + // Setup + const string content = "test"; + var fillColor = new SolidColorBrush(Colors.Blue); + var lineColor = new SolidColorBrush(Colors.Gray); + const int lineWidth = 3; + const PointedTreeVertexType type = PointedTreeVertexType.Diamond; + const bool isSelectable = false; + + // Call + var vertex = new PointedTreeElementVertex(content, fillColor, lineColor, lineWidth, type, isSelectable); + + // Assert + Assert.AreEqual(content, vertex.Content); + Assert.AreEqual(fillColor, vertex.FillColor); + Assert.AreEqual(lineColor, vertex.LineColor); + Assert.AreEqual(lineWidth, vertex.LineWidth); + Assert.AreEqual(type, vertex.Type); + Assert.AreEqual(isSelectable, vertex.IsSelectable); + Assert.IsFalse(vertex.IsSelected); + } } } \ No newline at end of file