Index: Core/Components/src/Core.Components.Charting/Core.Components.Charting.csproj =================================================================== diff -u -r23d1e296e2da4364fbfe346e68d582dfcf966bb0 -r88f6d73b4d5d1e7e6a2f75d700e552c3cb7719ae --- Core/Components/src/Core.Components.Charting/Core.Components.Charting.csproj (.../Core.Components.Charting.csproj) (revision 23d1e296e2da4364fbfe346e68d582dfcf966bb0) +++ Core/Components/src/Core.Components.Charting/Core.Components.Charting.csproj (.../Core.Components.Charting.csproj) (revision 88f6d73b4d5d1e7e6a2f75d700e552c3cb7719ae) @@ -43,6 +43,7 @@ + Index: Core/Components/src/Core.Components.Charting/Data/ChartMultipleLineData.cs =================================================================== diff -u --- Core/Components/src/Core.Components.Charting/Data/ChartMultipleLineData.cs (revision 0) +++ Core/Components/src/Core.Components.Charting/Data/ChartMultipleLineData.cs (revision 88f6d73b4d5d1e7e6a2f75d700e552c3cb7719ae) @@ -0,0 +1,82 @@ +// 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 Lesser 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 Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser 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 Core.Common.Base.Geometry; +using Core.Components.Charting.Styles; + +namespace Core.Components.Charting.Data +{ + /// + /// This class represents data in 2D space which forms multiple lines. + /// + public class ChartMultipleLineData : ItemBasedChartData + { + private IEnumerable lines; + + /// + /// Creates a new instance of . + /// + /// The name of the . + /// Thrown when is + /// null or only whitespace. + public ChartMultipleLineData(string name) : base(name) + { + Lines = new List(); + } + + /// + /// Gets or sets the lines that are described by the . + /// + /// Thrown when + /// is null. + /// Thrown when contains + /// any null value. + public IEnumerable Lines + { + get + { + return lines; + } + set + { + if (value == null) + { + throw new ArgumentNullException(nameof(value), @"The collection of point arrays cannot be null."); + } + + if (value.Any(array => array == null)) + { + throw new ArgumentException(@"The collection of point arrays cannot contain null values.", nameof(value)); + } + + lines = value; + } + } + + /// + /// Gets or sets the style of the . + /// + public ChartLineStyle Style { get; set; } + } +} Index: Core/Components/test/Core.Components.Charting.Test/Core.Components.Charting.Test.csproj =================================================================== diff -u -r6a5d7b40b7ba4dcb73e393075338352d194e97c2 -r88f6d73b4d5d1e7e6a2f75d700e552c3cb7719ae --- Core/Components/test/Core.Components.Charting.Test/Core.Components.Charting.Test.csproj (.../Core.Components.Charting.Test.csproj) (revision 6a5d7b40b7ba4dcb73e393075338352d194e97c2) +++ Core/Components/test/Core.Components.Charting.Test/Core.Components.Charting.Test.csproj (.../Core.Components.Charting.Test.csproj) (revision 88f6d73b4d5d1e7e6a2f75d700e552c3cb7719ae) @@ -57,6 +57,7 @@ + Index: Core/Components/test/Core.Components.Charting.Test/Data/ChartMultipleLineDataTest.cs =================================================================== diff -u --- Core/Components/test/Core.Components.Charting.Test/Data/ChartMultipleLineDataTest.cs (revision 0) +++ Core/Components/test/Core.Components.Charting.Test/Data/ChartMultipleLineDataTest.cs (revision 88f6d73b4d5d1e7e6a2f75d700e552c3cb7719ae) @@ -0,0 +1,91 @@ +// 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 Lesser 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 Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser 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.Base.Geometry; +using Core.Common.TestUtil; +using Core.Components.Charting.Data; +using NUnit.Framework; + +namespace Core.Components.Charting.Test.Data +{ + [TestFixture] + public class ChartMultipleLineDataTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var data = new ChartMultipleLineData("test data"); + + // Assert + Assert.IsInstanceOf(data); + CollectionAssert.IsEmpty(data.Lines); + Assert.IsNull(data.Style); + } + + [Test] + public void Lines_SetValidNewValue_GetsNewValue() + { + // Setup + var data = new ChartMultipleLineData("test data"); + var lines = new List(); + + // Call + data.Lines = lines; + + // Assert + Assert.AreSame(lines, data.Lines); + } + + [Test] + public void Lines_SetNullValue_ThrowsArgumentNullException() + { + // Setup + var data = new ChartMultipleLineData("test data"); + + // Call + TestDelegate test = () => data.Lines = null; + + // Assert + const string expectedMessage = "The collection of point arrays cannot be null."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); + } + + [Test] + public void Lines_SetValueContainingNullValue_ThrowsArgumentException() + { + // Setup + var data = new ChartMultipleLineData("test data"); + + // Call + TestDelegate test = () => data.Lines = new List + { + null + }; + + // Assert + const string expectedMessage = "The collection of point arrays cannot contain null values."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); + } + } +} \ No newline at end of file