Index: Core/Components/src/Core.Components.Charting/Core.Components.Charting.csproj =================================================================== diff -u -r44055100aa3c3f382227becdaeae7d97c75d386c -r8aa11a9aa48733a5b5b72c58c71674472825b26c --- Core/Components/src/Core.Components.Charting/Core.Components.Charting.csproj (.../Core.Components.Charting.csproj) (revision 44055100aa3c3f382227becdaeae7d97c75d386c) +++ Core/Components/src/Core.Components.Charting/Core.Components.Charting.csproj (.../Core.Components.Charting.csproj) (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -37,11 +37,11 @@ Properties\GlobalAssembly.cs - + - - + + Fisheye: Tag 8aa11a9aa48733a5b5b72c58c71674472825b26c refers to a dead (removed) revision in file `Core/Components/src/Core.Components.Charting/Data/AreaData.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Components/src/Core.Components.Charting/Data/ChartAreaData.cs =================================================================== diff -u --- Core/Components/src/Core.Components.Charting/Data/ChartAreaData.cs (revision 0) +++ Core/Components/src/Core.Components.Charting/Data/ChartAreaData.cs (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -0,0 +1,41 @@ +// Copyright (C) Stichting Deltares 2016. 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; + +namespace Core.Components.Charting.Data +{ + /// + /// This class represents data in 2D space which forms a closed area. + /// + public class ChartAreaData : PointBasedChartData + { + /// + /// Creates a new instance of . + /// + /// A of as (X,Y) points. + /// The name of the . + /// Thrown when is null, + /// or when is null or only whitespace. + public ChartAreaData(IEnumerable> points, string name) : base(points, name) {} + } +} \ No newline at end of file Index: Core/Components/src/Core.Components.Charting/Data/ChartData.cs =================================================================== diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -r8aa11a9aa48733a5b5b72c58c71674472825b26c --- Core/Components/src/Core.Components.Charting/Data/ChartData.cs (.../ChartData.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71) +++ Core/Components/src/Core.Components.Charting/Data/ChartData.cs (.../ChartData.cs) (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -19,12 +19,46 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using Core.Common.Base; namespace Core.Components.Charting.Data { /// /// Abstract class for data with the purpose of becoming visible in charting components. /// - public abstract class ChartData : Observable { } + public abstract class ChartData : Observable + { + private string name; + + /// + /// Creates a new instance of . + /// + /// The name of the . + /// Thrown when is null or only whitespace. + protected ChartData(string name) + { + Name = name; + } + + /// + /// Gets or sets name of the . + /// + /// Thrown when is null or only whitespace. + public string Name + { + get + { + return name; + } + set + { + if (string.IsNullOrWhiteSpace(value)) + { + throw new ArgumentException("A name must be set to map data"); + } + name = value; + } + } + } } \ No newline at end of file Index: Core/Components/src/Core.Components.Charting/Data/ChartDataCollection.cs =================================================================== diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -r8aa11a9aa48733a5b5b72c58c71674472825b26c --- Core/Components/src/Core.Components.Charting/Data/ChartDataCollection.cs (.../ChartDataCollection.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71) +++ Core/Components/src/Core.Components.Charting/Data/ChartDataCollection.cs (.../ChartDataCollection.cs) (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -33,8 +33,10 @@ /// Creates a new instance of . /// /// A of . - /// Thrown when is null. - public ChartDataCollection(IList list) + /// The name of the . + /// Thrown when is null, + /// or when is null or only whitespace. + public ChartDataCollection(IList list, string name) : base(name) { if (list == null) { Index: Core/Components/src/Core.Components.Charting/Data/ChartLineData.cs =================================================================== diff -u --- Core/Components/src/Core.Components.Charting/Data/ChartLineData.cs (revision 0) +++ Core/Components/src/Core.Components.Charting/Data/ChartLineData.cs (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -0,0 +1,41 @@ +// Copyright (C) Stichting Deltares 2016. 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; + +namespace Core.Components.Charting.Data +{ + /// + /// This class represents data in 2D space which is visible as a line. + /// + public class ChartLineData : PointBasedChartData + { + /// + /// Creates a new instance of . + /// + /// A of as (X,Y) points. + /// The name of the . + /// Thrown when is null, + /// or when is null or only whitespace. + public ChartLineData(IEnumerable> points, string name) : base(points, name) {} + } +} \ No newline at end of file Index: Core/Components/src/Core.Components.Charting/Data/ChartPointData.cs =================================================================== diff -u --- Core/Components/src/Core.Components.Charting/Data/ChartPointData.cs (revision 0) +++ Core/Components/src/Core.Components.Charting/Data/ChartPointData.cs (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -0,0 +1,41 @@ +// Copyright (C) Stichting Deltares 2016. 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; + +namespace Core.Components.Charting.Data +{ + /// + /// This class represents data in 2D space which is visible as points. + /// + public class ChartPointData : PointBasedChartData + { + /// + /// Creates a new instance of . + /// + /// A of as (X,Y) points. + /// The name of the . + /// Thrown when is null, + /// or when is null or only whitespace. + public ChartPointData(IEnumerable> points, string name) : base(points, name) {} + } +} \ No newline at end of file Fisheye: Tag 8aa11a9aa48733a5b5b72c58c71674472825b26c refers to a dead (removed) revision in file `Core/Components/src/Core.Components.Charting/Data/LineData.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Components/src/Core.Components.Charting/Data/PointBasedChartData.cs =================================================================== diff -u -r0696ce6625da3aa9b4b2df7f062caa7570a7675c -r8aa11a9aa48733a5b5b72c58c71674472825b26c --- Core/Components/src/Core.Components.Charting/Data/PointBasedChartData.cs (.../PointBasedChartData.cs) (revision 0696ce6625da3aa9b4b2df7f062caa7570a7675c) +++ Core/Components/src/Core.Components.Charting/Data/PointBasedChartData.cs (.../PointBasedChartData.cs) (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -34,8 +34,10 @@ /// Creates a new instance of . /// /// A of as (X,Y) points. - /// Thrown when is null. - protected PointBasedChartData(IEnumerable> points) + /// The name of the . + /// Thrown when is null, + /// or when is null or only whitespace. + protected PointBasedChartData(IEnumerable> points, string name) : base(name) { if (points == null) { Fisheye: Tag 8aa11a9aa48733a5b5b72c58c71674472825b26c refers to a dead (removed) revision in file `Core/Components/src/Core.Components.Charting/Data/PointData.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Components/src/Core.Components.OxyPlot.Forms/ChartControl.cs =================================================================== diff -u -r30b12b82918d500fe834eafd9f6cd9b2c5dbe60f -r8aa11a9aa48733a5b5b72c58c71674472825b26c --- Core/Components/src/Core.Components.OxyPlot.Forms/ChartControl.cs (.../ChartControl.cs) (revision 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f) +++ Core/Components/src/Core.Components.OxyPlot.Forms/ChartControl.cs (.../ChartControl.cs) (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -35,7 +35,7 @@ /// public sealed class ChartControl : Control, IObserver, IChartControl { - private readonly SeriesFactory seriesFactory = new SeriesFactory(); + private readonly ChartSeriesFactory seriesFactory = new ChartSeriesFactory(); private ChartData data; Fisheye: Tag 8aa11a9aa48733a5b5b72c58c71674472825b26c refers to a dead (removed) revision in file `Core/Components/src/Core.Components.OxyPlot/Converter/AreaDataConverter.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Components/src/Core.Components.OxyPlot/Converter/ChartAreaDataConverter.cs =================================================================== diff -u --- Core/Components/src/Core.Components.OxyPlot/Converter/ChartAreaDataConverter.cs (revision 0) +++ Core/Components/src/Core.Components.OxyPlot/Converter/ChartAreaDataConverter.cs (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -0,0 +1,51 @@ +// Copyright (C) Stichting Deltares 2016. 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.Collections.Generic; +using Core.Components.Charting.Data; +using OxyPlot.Series; + +namespace Core.Components.OxyPlot.Converter +{ + /// + /// This class converts into . + /// + public class ChartAreaDataConverter : ChartDataConverter + { + protected override IList Convert(ChartAreaData data) + { + var series = new AreaSeries + { + IsVisible = data.IsVisible, + Tag = data + }; + foreach (var p in data.Points) + { + series.Points.Add(TupleToDataPoint(p)); + } + if (series.Points.Count > 0) + { + series.Points2.Add(series.Points[0]); + } + return new List { series }; + } + } +} \ No newline at end of file Index: Core/Components/src/Core.Components.OxyPlot/Converter/ChartDataCollectionConverter.cs =================================================================== diff -u -rf816b467d3aae059a7728645575ec2eabfbcb0f7 -r8aa11a9aa48733a5b5b72c58c71674472825b26c --- Core/Components/src/Core.Components.OxyPlot/Converter/ChartDataCollectionConverter.cs (.../ChartDataCollectionConverter.cs) (revision f816b467d3aae059a7728645575ec2eabfbcb0f7) +++ Core/Components/src/Core.Components.OxyPlot/Converter/ChartDataCollectionConverter.cs (.../ChartDataCollectionConverter.cs) (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -33,7 +33,7 @@ { protected override IList Convert(ChartDataCollection data) { - var factory = new SeriesFactory(); + var factory = new ChartSeriesFactory(); var seriesCollection = new List(); foreach(var series in data.List) { Index: Core/Components/src/Core.Components.OxyPlot/Converter/ChartLineDataConverter.cs =================================================================== diff -u --- Core/Components/src/Core.Components.OxyPlot/Converter/ChartLineDataConverter.cs (revision 0) +++ Core/Components/src/Core.Components.OxyPlot/Converter/ChartLineDataConverter.cs (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -0,0 +1,46 @@ +// Copyright (C) Stichting Deltares 2016. 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.Collections.Generic; +using System.Linq; +using Core.Components.Charting.Data; +using OxyPlot.Series; + +namespace Core.Components.OxyPlot.Converter +{ + /// + /// This class converts into . + /// + public class ChartLineDataConverter : ChartDataConverter + { + protected override IList Convert(ChartLineData data) + { + var series = new LineSeries + { + ItemsSource = data.Points.ToArray(), + Mapping = TupleToDataPoint, + IsVisible = data.IsVisible, + Tag = data + }; + return new List{ series }; + } + } +} \ No newline at end of file Index: Core/Components/src/Core.Components.OxyPlot/Converter/ChartPointDataConverter.cs =================================================================== diff -u --- Core/Components/src/Core.Components.OxyPlot/Converter/ChartPointDataConverter.cs (revision 0) +++ Core/Components/src/Core.Components.OxyPlot/Converter/ChartPointDataConverter.cs (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -0,0 +1,49 @@ +// Copyright (C) Stichting Deltares 2016. 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.Collections.Generic; +using System.Linq; +using Core.Components.Charting.Data; +using OxyPlot; +using OxyPlot.Series; + +namespace Core.Components.OxyPlot.Converter +{ + /// + /// This class converts into with point styling. + /// + public class ChartPointDataConverter : ChartDataConverter + { + protected override IList Convert(ChartPointData data) + { + var series = new LineSeries + { + ItemsSource = data.Points.ToArray(), + IsVisible = data.IsVisible, + Mapping = TupleToDataPoint, + LineStyle = LineStyle.None, + MarkerType = MarkerType.Circle, + Tag = data, + }; + return new List { series }; + } + } +} \ No newline at end of file Index: Core/Components/src/Core.Components.OxyPlot/Converter/ChartSeriesFactory.cs =================================================================== diff -u --- Core/Components/src/Core.Components.OxyPlot/Converter/ChartSeriesFactory.cs (revision 0) +++ Core/Components/src/Core.Components.OxyPlot/Converter/ChartSeriesFactory.cs (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -0,0 +1,64 @@ +// Copyright (C) Stichting Deltares 2016. 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.Collections.ObjectModel; +using Core.Components.Charting.Data; +using OxyPlot.Series; + +namespace Core.Components.OxyPlot.Converter +{ + /// + /// This class creates new objects from . + /// + public class ChartSeriesFactory + { + /// + /// Collection of converters that the can use to transform . + /// + private readonly IEnumerable converters = new Collection + { + new ChartAreaDataConverter(), + new ChartLineDataConverter(), + new ChartPointDataConverter(), + new ChartDataCollectionConverter() + }; + + /// + /// Creates one or more new from the given . + /// + /// The to base the creation of the upon. + /// A new of . + /// Thrown when the given type is not supported. + public IList Create(ChartData data) + { + foreach (var converter in converters) + { + if (converter.CanConvertSeries(data)) + { + return converter.Convert(data); + } + } + throw new NotSupportedException(string.Format("ChartData of type {0} is not supported.", data.GetType().Name)); + } + } +} \ No newline at end of file Fisheye: Tag 8aa11a9aa48733a5b5b72c58c71674472825b26c refers to a dead (removed) revision in file `Core/Components/src/Core.Components.OxyPlot/Converter/LineDataConverter.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 8aa11a9aa48733a5b5b72c58c71674472825b26c refers to a dead (removed) revision in file `Core/Components/src/Core.Components.OxyPlot/Converter/PointDataConverter.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 8aa11a9aa48733a5b5b72c58c71674472825b26c refers to a dead (removed) revision in file `Core/Components/src/Core.Components.OxyPlot/Converter/SeriesFactory.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Components/src/Core.Components.OxyPlot/Core.Components.OxyPlot.csproj =================================================================== diff -u -r44055100aa3c3f382227becdaeae7d97c75d386c -r8aa11a9aa48733a5b5b72c58c71674472825b26c --- Core/Components/src/Core.Components.OxyPlot/Core.Components.OxyPlot.csproj (.../Core.Components.OxyPlot.csproj) (revision 44055100aa3c3f382227becdaeae7d97c75d386c) +++ Core/Components/src/Core.Components.OxyPlot/Core.Components.OxyPlot.csproj (.../Core.Components.OxyPlot.csproj) (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -48,15 +48,15 @@ Properties\GlobalAssembly.cs - + - - + + - + Index: Core/Components/test/Core.Components.Charting.Test/Core.Components.Charting.Test.csproj =================================================================== diff -u -r002ceaccea1dc8e92d6e88d41dd39b1f5d7b7e0d -r8aa11a9aa48733a5b5b72c58c71674472825b26c --- Core/Components/test/Core.Components.Charting.Test/Core.Components.Charting.Test.csproj (.../Core.Components.Charting.Test.csproj) (revision 002ceaccea1dc8e92d6e88d41dd39b1f5d7b7e0d) +++ Core/Components/test/Core.Components.Charting.Test/Core.Components.Charting.Test.csproj (.../Core.Components.Charting.Test.csproj) (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -46,12 +46,12 @@ - + - + - + Fisheye: Tag 8aa11a9aa48733a5b5b72c58c71674472825b26c refers to a dead (removed) revision in file `Core/Components/test/Core.Components.Charting.Test/Data/AreaDataTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Components/test/Core.Components.Charting.Test/Data/ChartAreaDataTest.cs =================================================================== diff -u --- Core/Components/test/Core.Components.Charting.Test/Data/ChartAreaDataTest.cs (revision 0) +++ Core/Components/test/Core.Components.Charting.Test/Data/ChartAreaDataTest.cs (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -0,0 +1,77 @@ +using System; +using System.Collections.ObjectModel; +using Core.Common.TestUtil; +using Core.Components.Charting.Data; +using NUnit.Framework; + +namespace Core.Components.Charting.Test.Data +{ + [TestFixture] + public class ChartAreaDataTest + { + [Test] + public void Constructor_NullPoints_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new ChartAreaData(null, "test data"); + + // Assert + Assert.Throws(test); + } + + [Test] + [TestCase(null)] + [TestCase("")] + [TestCase(" ")] + public void Constructor_InvalidName_ThrowsArgumentException(string invalidName) + { + // Setup + var points = new Collection>(); + + // Call + TestDelegate test = () => new ChartAreaData(points, invalidName); + + // Assert + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, "A name must be set to map data"); + } + + [Test] + public void Constructor_WithEmptyPoints_CreatesNewICharData() + { + // Setup + var points = new Collection>(); + + // Call + var data = new ChartAreaData(points, "test data"); + + // Assert + Assert.IsInstanceOf(data); + Assert.AreNotSame(points, data.Points); + } + + [Test] + public void Constructor_WithPoints_CreatesNewICharData() + { + // Setup + var points = CreateTestPoints(); + + // Call + var data = new ChartAreaData(points, "test data"); + + // Assert + Assert.IsInstanceOf(data); + Assert.AreNotSame(points, data.Points); + CollectionAssert.AreEqual(points, data.Points); + } + + private Collection> CreateTestPoints() + { + return new Collection> + { + Tuple.Create(0.0, 1.1), + Tuple.Create(1.0, 2.1), + Tuple.Create(1.6, 1.6) + }; + } + } +} \ No newline at end of file Index: Core/Components/test/Core.Components.Charting.Test/Data/ChartDataCollectionTest.cs =================================================================== diff -u -r74cd1965818ae9b23da6cad8776b7da2868be4a7 -r8aa11a9aa48733a5b5b72c58c71674472825b26c --- Core/Components/test/Core.Components.Charting.Test/Data/ChartDataCollectionTest.cs (.../ChartDataCollectionTest.cs) (revision 74cd1965818ae9b23da6cad8776b7da2868be4a7) +++ Core/Components/test/Core.Components.Charting.Test/Data/ChartDataCollectionTest.cs (.../ChartDataCollectionTest.cs) (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -1,5 +1,6 @@ using System; using System.Linq; +using Core.Common.TestUtil; using Core.Components.Charting.Data; using NUnit.Framework; @@ -12,20 +13,36 @@ public void Constructor_NullList_ThrowsArgumentNullException() { // Call - TestDelegate test = () => new ChartDataCollection(null); + TestDelegate test = () => new ChartDataCollection(null, "test data"); // Assert Assert.Throws(test); } [Test] + [TestCase("")] + [TestCase(" ")] + [TestCase(null)] + public void Constructor_InvalidName_ThrowsArgumentExcpetion(string invalidName) + { + // Setup + var list = Enumerable.Empty().ToList(); + + // Call + TestDelegate test = () => new ChartDataCollection(list, invalidName); + + // Assert + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, "A name must be set to map data"); + } + + [Test] public void Constructor_ListSet_InstanceWithListSet() { // Setup var list = Enumerable.Empty().ToList(); // Call - var collection = new ChartDataCollection(list); + var collection = new ChartDataCollection(list, "test data"); // Assert Assert.IsInstanceOf(collection); Index: Core/Components/test/Core.Components.Charting.Test/Data/ChartDataTest.cs =================================================================== diff -u -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8 -r8aa11a9aa48733a5b5b72c58c71674472825b26c --- Core/Components/test/Core.Components.Charting.Test/Data/ChartDataTest.cs (.../ChartDataTest.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8) +++ Core/Components/test/Core.Components.Charting.Test/Data/ChartDataTest.cs (.../ChartDataTest.cs) (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -1,4 +1,6 @@ -using Core.Common.Base; +using System; +using Core.Common.Base; +using Core.Common.TestUtil; using Core.Components.Charting.Data; using NUnit.Framework; @@ -8,15 +10,55 @@ public class ChartDataTest { [Test] - public void DefaultConstructor_Observable() + [TestCase(null)] + [TestCase(" ")] + [TestCase("")] + public void Constructor_InvalidName_ThrowsArgumentException(string invalidName) { // Call - var chartData = new TestChartData(); + TestDelegate call = () => new TestChartData(invalidName); // Assert - Assert.IsInstanceOf(chartData); - } + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, "A name must be set to map data"); + } + + [Test] + public void Constructor_WithName_ExpectedValues() + { + // Setup + var name = "Some name"; + + // Call + var data = new TestChartData(name); + + // Assert + Assert.IsInstanceOf(data); + Assert.AreEqual(name, data.Name); + } + + [Test] + public void Name_SetName_ReturnsNewName() + { + // setup + var name = "Some name"; + var newName = "Something"; + var data = new TestChartData(name); + + // Precondition + Assert.AreEqual(name, data.Name); + + // Call + data.Name = newName; + + // Assert + Assert.AreNotEqual(name, data.Name); + Assert.AreEqual(newName, data.Name); + + } } - public class TestChartData : ChartData {} + public class TestChartData : ChartData + { + public TestChartData(string name) : base(name) { } + } } \ No newline at end of file Index: Core/Components/test/Core.Components.Charting.Test/Data/ChartLineDataTest.cs =================================================================== diff -u --- Core/Components/test/Core.Components.Charting.Test/Data/ChartLineDataTest.cs (revision 0) +++ Core/Components/test/Core.Components.Charting.Test/Data/ChartLineDataTest.cs (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -0,0 +1,78 @@ +using System; +using System.Collections.ObjectModel; +using System.Linq; +using Core.Common.TestUtil; +using Core.Components.Charting.Data; +using NUnit.Framework; + +namespace Core.Components.Charting.Test.Data +{ + [TestFixture] + public class ChartLineDataTest + { + [Test] + public void Constructor_NullPoints_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new ChartLineData(null, "test data"); + + // Assert + Assert.Throws(test); + } + + [Test] + [TestCase(null)] + [TestCase("")] + [TestCase(" ")] + public void Constructor_InvalidName_ThrowsArgumentException(string invalidName) + { + // Setup + var points = new Collection>(); + + // Call + TestDelegate test = () => new ChartLineData(points, invalidName); + + // Assert + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, "A name must be set to map data"); + } + + [Test] + public void Constructor_WithEmptyPoints_CreatesNewICharData() + { + // Setup + var points = new Collection>(); + + // Call + var data = new ChartLineData(points, "test data"); + + // Assert + Assert.IsInstanceOf(data); + Assert.AreNotSame(points, data.Points); + } + + [Test] + public void Constructor_WithPoints_CreatesNewICharData() + { + // Setup + var points = CreateTestPoints(); + + // Call + var data = new ChartLineData(points, "test data"); + + // Assert + Assert.IsInstanceOf(data); + Assert.AreNotSame(points, data.Points); + CollectionAssert.AreEqual(points, data.Points); + } + + private Collection> CreateTestPoints() + { + return new Collection> + { + Tuple.Create(0.0, 1.1), + Tuple.Create(1.0, 2.1), + Tuple.Create(1.6, 1.6) + }; + } + } +} \ No newline at end of file Index: Core/Components/test/Core.Components.Charting.Test/Data/ChartPointDataTest.cs =================================================================== diff -u --- Core/Components/test/Core.Components.Charting.Test/Data/ChartPointDataTest.cs (revision 0) +++ Core/Components/test/Core.Components.Charting.Test/Data/ChartPointDataTest.cs (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -0,0 +1,77 @@ +using System; +using System.Collections.ObjectModel; +using Core.Common.TestUtil; +using Core.Components.Charting.Data; +using NUnit.Framework; + +namespace Core.Components.Charting.Test.Data +{ + [TestFixture] + public class ChartPointDataTest + { + [Test] + public void Constructor_NullPoints_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new ChartPointData(null, "test data"); + + // Assert + Assert.Throws(test); + } + + [Test] + [TestCase(null)] + [TestCase("")] + [TestCase(" ")] + public void Constructor_InvalidName_ThrowsArgumentException(string invalidName) + { + // Setup + var points = new Collection>(); + + // Call + TestDelegate test = () => new ChartPointData(points, invalidName); + + // Assert + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, "A name must be set to map data"); + } + + [Test] + public void Constructor_WithEmptyPoints_CreatesNewICharData() + { + // Setup + var points = new Collection>(); + + // Call + var data = new ChartPointData(points, "test data"); + + // Assert + Assert.IsInstanceOf(data); + Assert.AreNotSame(points, data.Points); + } + + [Test] + public void Constructor_WithPoints_CreatesNewICharData() + { + // Setup + var points = CreateTestPoints(); + + // Call + var data = new ChartPointData(points, "test data"); + + // Assert + Assert.IsInstanceOf(data); + Assert.AreNotSame(points, data.Points); + CollectionAssert.AreEqual(points, data.Points); + } + + private Collection> CreateTestPoints() + { + return new Collection> + { + Tuple.Create(0.0, 1.1), + Tuple.Create(1.0, 2.1), + Tuple.Create(1.6, 1.6) + }; + } + } +} \ No newline at end of file Fisheye: Tag 8aa11a9aa48733a5b5b72c58c71674472825b26c refers to a dead (removed) revision in file `Core/Components/test/Core.Components.Charting.Test/Data/LineDataTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Components/test/Core.Components.Charting.Test/Data/PointBasedChartDataTest.cs =================================================================== diff -u -r002ceaccea1dc8e92d6e88d41dd39b1f5d7b7e0d -r8aa11a9aa48733a5b5b72c58c71674472825b26c --- Core/Components/test/Core.Components.Charting.Test/Data/PointBasedChartDataTest.cs (.../PointBasedChartDataTest.cs) (revision 002ceaccea1dc8e92d6e88d41dd39b1f5d7b7e0d) +++ Core/Components/test/Core.Components.Charting.Test/Data/PointBasedChartDataTest.cs (.../PointBasedChartDataTest.cs) (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -13,14 +13,34 @@ public void Constructor_WithoutPoints_ThrowsArgumentNullException() { // Call - TestDelegate test = () => new TestPointBasedChartData(null); + TestDelegate test = () => new TestPointBasedChartData(null, "test data"); // Assert var expectedMessage = "A point collection is required when creating a subclass of Core.Components.Charting.Data.PointBasedChartData."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); } [Test] + [TestCase(null)] + [TestCase("")] + [TestCase(" ")] + public void Constructor_InvalidName_ThrowsArgumentExcpetion(string invalidName) + { + // Setup + var points = new Collection> + { + Tuple.Create(0.0, 1.0), + Tuple.Create(2.5, 1.1) + }; + + // Call + TestDelegate test = () => new TestPointBasedChartData(points, invalidName); + + // Assert + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, "A name must be set to map data"); + } + + [Test] public void Constructor_WithPoints_PropertiesSet() { // Setup @@ -31,7 +51,7 @@ }; // Call - var data = new TestPointBasedChartData(points); + var data = new TestPointBasedChartData(points, "test data"); // Assert Assert.AreNotSame(points, data.Points); @@ -42,6 +62,6 @@ public class TestPointBasedChartData : PointBasedChartData { - public TestPointBasedChartData(IEnumerable> points) : base(points) { } + public TestPointBasedChartData(IEnumerable> points, string name) : base(points, name) { } } } \ No newline at end of file Fisheye: Tag 8aa11a9aa48733a5b5b72c58c71674472825b26c refers to a dead (removed) revision in file `Core/Components/test/Core.Components.Charting.Test/Data/PointDataTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Components/test/Core.Components.Charting.TestUtil/TestChartData.cs =================================================================== diff -u -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8 -r8aa11a9aa48733a5b5b72c58c71674472825b26c --- Core/Components/test/Core.Components.Charting.TestUtil/TestChartData.cs (.../TestChartData.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8) +++ Core/Components/test/Core.Components.Charting.TestUtil/TestChartData.cs (.../TestChartData.cs) (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -5,5 +5,8 @@ /// /// A class representing a ChartData type which is not in the regular codebase. /// - public class TestChartData : ChartData {} + public class TestChartData : ChartData + { + public TestChartData(string name) : base(name) {} + } } \ No newline at end of file Index: Core/Components/test/Core.Components.OxyPlot.Forms.Test/ChartControlTest.cs =================================================================== diff -u -r30b12b82918d500fe834eafd9f6cd9b2c5dbe60f -r8aa11a9aa48733a5b5b72c58c71674472825b26c --- Core/Components/test/Core.Components.OxyPlot.Forms.Test/ChartControlTest.cs (.../ChartControlTest.cs) (revision 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f) +++ Core/Components/test/Core.Components.OxyPlot.Forms.Test/ChartControlTest.cs (.../ChartControlTest.cs) (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -34,7 +34,7 @@ { // Setup var chart = new ChartControl(); - var testData = new TestChartData(); + var testData = new TestChartData("test data"); // Call TestDelegate test = () => chart.Data = testData; @@ -61,7 +61,7 @@ { // Setup var chart = new ChartControl(); - var testData = new LineData(Enumerable.Empty>()); + var testData = new ChartLineData(Enumerable.Empty>(), "test data"); var observers = TypeUtils.GetField>(testData, "observers"); var view = TypeUtils.GetField(chart, "view"); @@ -81,8 +81,8 @@ { // Setup var chart = new ChartControl(); - var testDataOld = new LineData(Enumerable.Empty>()); - var testDataNew = new LineData(Enumerable.Empty>()); + var testDataOld = new ChartLineData(Enumerable.Empty>(), "test data"); + var testDataNew = new ChartLineData(Enumerable.Empty>(), "test data"); var observersOld = TypeUtils.GetField>(testDataOld, "observers"); var observersNew = TypeUtils.GetField>(testDataNew, "observers"); var view = TypeUtils.GetField(chart, "view"); @@ -105,7 +105,7 @@ { // Setup var chart = new ChartControl(); - var testData = new LineData(Enumerable.Empty>()); + var testData = new ChartLineData(Enumerable.Empty>(), "test data"); var observers = TypeUtils.GetField>(testData, "observers"); var view = TypeUtils.GetField(chart, "view"); @@ -168,7 +168,7 @@ // Setup var form = new Form(); var chart = new ChartControl(); - var testData = new LineData(Enumerable.Empty>()); + var testData = new ChartLineData(Enumerable.Empty>(), "test data"); var view = TypeUtils.GetField(chart, "view"); var invalidated = 0; @@ -194,7 +194,7 @@ // Setup var form = new Form(); var chart = new ChartControl(); - var testData = new LineData(Enumerable.Empty>()); + var testData = new ChartLineData(Enumerable.Empty>(), "test data"); var view = TypeUtils.GetField(chart, "view"); var invalidated = 0; Fisheye: Tag 8aa11a9aa48733a5b5b72c58c71674472825b26c refers to a dead (removed) revision in file `Core/Components/test/Core.Components.OxyPlot.Test/Converter/AreaDataConverterTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Components/test/Core.Components.OxyPlot.Test/Converter/ChartAreaDataConverterTest.cs =================================================================== diff -u --- Core/Components/test/Core.Components.OxyPlot.Test/Converter/ChartAreaDataConverterTest.cs (revision 0) +++ Core/Components/test/Core.Components.OxyPlot.Test/Converter/ChartAreaDataConverterTest.cs (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -0,0 +1,113 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using Core.Common.TestUtil; +using Core.Components.Charting.Data; +using Core.Components.Charting.TestUtil; +using Core.Components.OxyPlot.Converter; +using NUnit.Framework; +using OxyPlot; +using OxyPlot.Series; + +namespace Core.Components.OxyPlot.Test.Converter +{ + [TestFixture] + public class ChartAreaDataConverterTest + { + [Test] + public void DefaultConstructor_IsChartDataConverter() + { + // Call + var converter = new ChartAreaDataConverter(); + + // Assert + Assert.IsInstanceOf>(converter); + } + + [Test] + public void CanConvertSeries_AreaData_ReturnTrue() + { + // Setup + var converter = new ChartAreaDataConverter(); + var areaData = new ChartAreaData(new Collection>(), "test data"); + + // Call + var canConvert = converter.CanConvertSeries(areaData); + + // Assert + Assert.IsTrue(canConvert); + } + + [Test] + public void CanConvertSeries_ChartData_ReturnsFalse() + { + // Setup + var converter = new ChartAreaDataConverter(); + var chartData = new TestChartData("test data"); + + // Call + var canConvert = converter.CanConvertSeries(chartData); + + // Assert + Assert.IsFalse(canConvert); + } + + [Test] + public void Convert_RandomPointData_ReturnsNewSeries() + { + // Setup + var converter = new ChartAreaDataConverter(); + var random = new Random(21); + var randomCount = random.Next(5, 10); + var points = new Collection>(); + + for (int i = 0; i < randomCount; i++) + { + points.Add(Tuple.Create(random.NextDouble(), random.NextDouble())); + } + + var areaData = new ChartAreaData(points, "test data"); + + // Call + var series = converter.Convert(areaData); + + // Assert + Assert.IsInstanceOf>(series); + var areaSeries = ((AreaSeries)series[0]); + var expectedData = points.Select(t => new DataPoint(t.Item1, t.Item2)).ToArray(); + CollectionAssert.AreEqual(expectedData, areaSeries.Points); + CollectionAssert.AreEqual(new Collection { expectedData.First() }, areaSeries.Points2); + } + + [Test] + public void Convert_DataNull_ThrowsArgumentNullException() + { + // Setup + var testConverter = new ChartAreaDataConverter(); + + // Call + TestDelegate test = () => testConverter.Convert(null); + + // Assert + Assert.Throws(test); + } + + [Test] + public void Convert_DataCannotBeConverted_ThrowsArgumentException() + { + // Setup + var testConverter = new ChartAreaDataConverter(); + var testChartData = new TestChartData("test data"); + var expectedMessage = string.Format("The data of type {0} cannot be converted by this converter.", testChartData.GetType()); + // Precondition + Assert.IsFalse(testConverter.CanConvertSeries(testChartData)); + + // Call + TestDelegate test = () => testConverter.Convert(testChartData); + + // Assert + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); + } + } +} \ No newline at end of file Index: Core/Components/test/Core.Components.OxyPlot.Test/Converter/ChartDataCollectionConverterTest.cs =================================================================== diff -u -ra3c8c0cb4384de51a18d77cc7bea487f97ba21e1 -r8aa11a9aa48733a5b5b72c58c71674472825b26c --- Core/Components/test/Core.Components.OxyPlot.Test/Converter/ChartDataCollectionConverterTest.cs (.../ChartDataCollectionConverterTest.cs) (revision a3c8c0cb4384de51a18d77cc7bea487f97ba21e1) +++ Core/Components/test/Core.Components.OxyPlot.Test/Converter/ChartDataCollectionConverterTest.cs (.../ChartDataCollectionConverterTest.cs) (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -29,7 +29,7 @@ { // Setup var converter = new ChartDataCollectionConverter(); - var collectionData = new ChartDataCollection(new List()); + var collectionData = new ChartDataCollection(new List(), "test data"); // Call var canConvert = converter.CanConvertSeries(collectionData); @@ -43,7 +43,7 @@ { // Setup var converter = new ChartDataCollectionConverter(); - var chartData = new TestChartData(); + var chartData = new TestChartData("test data"); // Call var canConvert = converter.CanConvertSeries(chartData); @@ -68,9 +68,9 @@ pointsLine.Add(Tuple.Create(random.NextDouble(), random.NextDouble())); } - var collectionData = new ChartDataCollection(new List()); - var areaData = new AreaData(pointsArea); - var lineData = new LineData(pointsLine); + var collectionData = new ChartDataCollection(new List(), "test data"); + var areaData = new ChartAreaData(pointsArea, "test data"); + var lineData = new ChartLineData(pointsLine, "test data"); collectionData.List.Add(areaData); collectionData.List.Add(lineData); @@ -103,7 +103,7 @@ { // Setup var testConverter = new ChartDataCollectionConverter(); - var testChartData = new TestChartData(); + var testChartData = new TestChartData("test data"); var expectedMessage = string.Format("The data of type {0} cannot be converted by this converter.", testChartData.GetType()); // Precondition Assert.IsFalse(testConverter.CanConvertSeries(testChartData)); Index: Core/Components/test/Core.Components.OxyPlot.Test/Converter/ChartDataConverterTest.cs =================================================================== diff -u -ra3c8c0cb4384de51a18d77cc7bea487f97ba21e1 -r8aa11a9aa48733a5b5b72c58c71674472825b26c --- Core/Components/test/Core.Components.OxyPlot.Test/Converter/ChartDataConverterTest.cs (.../ChartDataConverterTest.cs) (revision a3c8c0cb4384de51a18d77cc7bea487f97ba21e1) +++ Core/Components/test/Core.Components.OxyPlot.Test/Converter/ChartDataConverterTest.cs (.../ChartDataConverterTest.cs) (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -38,9 +38,9 @@ var testConverter = new TestChartDataConverter(); // Call - var chartDataResult = testConverter.CanConvertSeries(new TestChartData()); - var classResult = testConverter.CanConvertSeries(new Class()); - var childResult = testConverter.CanConvertSeries(new Child()); + var chartDataResult = testConverter.CanConvertSeries(new TestChartData("test data")); + var classResult = testConverter.CanConvertSeries(new Class("test data")); + var childResult = testConverter.CanConvertSeries(new Child("test data")); // Assert Assert.IsFalse(chartDataResult); @@ -66,7 +66,7 @@ { // Setup var testConverter = new TestChartDataConverter(); - var testChartData = new TestChartData(); + var testChartData = new TestChartData("test data"); var expectedMessage = string.Format("The data of type {0} cannot be converted by this converter.", testChartData.GetType()); // Precondition Assert.IsFalse(testConverter.CanConvertSeries(testChartData)); @@ -78,9 +78,15 @@ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); } - private class Class : ChartData {} + private class Class : ChartData + { + public Class(string name) : base(name) {} + } - private class Child : Class {} + private class Child : Class + { + public Child(string name) : base(name) { } + } private class TestChartDataConverter : ChartDataConverter where T : ChartData { Index: Core/Components/test/Core.Components.OxyPlot.Test/Converter/ChartLineDataConverterTest.cs =================================================================== diff -u --- Core/Components/test/Core.Components.OxyPlot.Test/Converter/ChartLineDataConverterTest.cs (revision 0) +++ Core/Components/test/Core.Components.OxyPlot.Test/Converter/ChartLineDataConverterTest.cs (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -0,0 +1,110 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using Core.Common.TestUtil; +using Core.Components.Charting.Data; +using Core.Components.Charting.TestUtil; +using Core.Components.OxyPlot.Converter; +using NUnit.Framework; +using OxyPlot.Series; + +namespace Core.Components.OxyPlot.Test.Converter +{ + [TestFixture] + public class ChartLineDataConverterTest + { + [Test] + public void DefaultConstructor_IsChartDataConverter() + { + // Call + var converter = new ChartLineDataConverter(); + + // Assert + Assert.IsInstanceOf>(converter); + } + + [Test] + public void CanConvertSeries_LineData_ReturnTrue() + { + // Setup + var converter = new ChartLineDataConverter(); + var lineData = new ChartLineData(new Collection>(), "test data"); + + // Call + var canConvert = converter.CanConvertSeries(lineData); + + // Assert + Assert.IsTrue(canConvert); + } + + [Test] + public void CanConvertSeries_ChartData_ReturnsFalse() + { + // Setup + var converter = new ChartLineDataConverter(); + var chartData = new TestChartData("test data"); + + // Call + var canConvert = converter.CanConvertSeries(chartData); + + // Assert + Assert.IsFalse(canConvert); + } + + [Test] + public void Convert_RandomPointData_ReturnsNewSeries() + { + // Setup + var converter = new ChartLineDataConverter(); + var random = new Random(21); + var randomCount = random.Next(5, 10); + var points = new Collection>(); + + for (int i = 0; i < randomCount; i++) + { + points.Add(Tuple.Create(random.NextDouble(), random.NextDouble())); + } + + var lineData = new ChartLineData(points, "test data"); + + // Call + var series = converter.Convert(lineData); + + // Assert + Assert.IsInstanceOf>(series); + var lineSeries = ((LineSeries)series[0]); + CollectionAssert.AreEqual(points, lineSeries.ItemsSource); + Assert.AreNotSame(points, lineSeries.ItemsSource); + } + + [Test] + public void Convert_DataNull_ThrowsArgumentNullException() + { + // Setup + var testConverter = new ChartLineDataConverter(); + + // Call + TestDelegate test = () => testConverter.Convert(null); + + // Assert + Assert.Throws(test); + } + + [Test] + public void Convert_DataCannotBeConverted_ThrowsArgumentException() + { + // Setup + var testConverter = new ChartLineDataConverter(); + var testChartData = new TestChartData("test data"); + var expectedMessage = string.Format("The data of type {0} cannot be converted by this converter.", testChartData.GetType()); + // Precondition + Assert.IsFalse(testConverter.CanConvertSeries(testChartData)); + + // Call + TestDelegate test = () => testConverter.Convert(testChartData); + + // Assert + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); + } + } +} \ No newline at end of file Index: Core/Components/test/Core.Components.OxyPlot.Test/Converter/ChartPointDataConverterTest.cs =================================================================== diff -u --- Core/Components/test/Core.Components.OxyPlot.Test/Converter/ChartPointDataConverterTest.cs (revision 0) +++ Core/Components/test/Core.Components.OxyPlot.Test/Converter/ChartPointDataConverterTest.cs (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -0,0 +1,113 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using Core.Common.TestUtil; +using Core.Components.Charting.Data; +using Core.Components.Charting.TestUtil; +using Core.Components.OxyPlot.Converter; +using NUnit.Framework; +using OxyPlot; +using OxyPlot.Series; + +namespace Core.Components.OxyPlot.Test.Converter +{ + [TestFixture] + public class ChartPointDataConverterTest + { + [Test] + public void DefaultConstructor_IsChartDataConverter() + { + // Call + var converter = new ChartPointDataConverter(); + + // Assert + Assert.IsInstanceOf>(converter); + } + + [Test] + public void CanConvertSeries_PointData_ReturnTrue() + { + // Setup + var converter = new ChartPointDataConverter(); + var pointData = new ChartPointData(new Collection>(), "test data"); + + // Call + var canConvert = converter.CanConvertSeries(pointData); + + // Assert + Assert.IsTrue(canConvert); + } + + [Test] + public void CanConvertSeries_ChartData_ReturnsFalse() + { + // Setup + var converter = new ChartPointDataConverter(); + var chartData = new TestChartData("test data"); + + // Call + var canConvert = converter.CanConvertSeries(chartData); + + // Assert + Assert.IsFalse(canConvert); + } + + [Test] + public void Convert_RandomPointData_ReturnsNewSeries() + { + // Setup + var converter = new ChartPointDataConverter(); + var random = new Random(21); + var randomCount = random.Next(5, 10); + var points = new Collection>(); + + for (int i = 0; i < randomCount; i++) + { + points.Add(Tuple.Create(random.NextDouble(), random.NextDouble())); + } + + var pointData = new ChartPointData(points, "test data"); + + // Call + var series = converter.Convert(pointData); + + // Assert + Assert.IsInstanceOf>(series); + var lineSeries = ((LineSeries)series[0]); + CollectionAssert.AreEqual(points, lineSeries.ItemsSource); + Assert.AreNotSame(points, lineSeries.ItemsSource); + Assert.AreEqual(LineStyle.None, lineSeries.LineStyle); + Assert.AreEqual(MarkerType.Circle, lineSeries.MarkerType); + } + + [Test] + public void Convert_DataNull_ThrowsArgumentNullException() + { + // Setup + var testConverter = new ChartPointDataConverter(); + + // Call + TestDelegate test = () => testConverter.Convert(null); + + // Assert + Assert.Throws(test); + } + + [Test] + public void Convert_DataCannotBeConverted_ThrowsArgumentException() + { + // Setup + var testConverter = new ChartPointDataConverter(); + var testChartData = new TestChartData("test data"); + var expectedMessage = string.Format("The data of type {0} cannot be converted by this converter.", testChartData.GetType()); + // Precondition + Assert.IsFalse(testConverter.CanConvertSeries(testChartData)); + + // Call + TestDelegate test = () => testConverter.Convert(testChartData); + + // Assert + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); + } + } +} \ No newline at end of file Index: Core/Components/test/Core.Components.OxyPlot.Test/Converter/ChartSeriesFactoryTest.cs =================================================================== diff -u --- Core/Components/test/Core.Components.OxyPlot.Test/Converter/ChartSeriesFactoryTest.cs (revision 0) +++ Core/Components/test/Core.Components.OxyPlot.Test/Converter/ChartSeriesFactoryTest.cs (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using Core.Components.Charting.Data; +using Core.Components.Charting.TestUtil; +using Core.Components.OxyPlot.Converter; +using NUnit.Framework; +using OxyPlot; +using OxyPlot.Series; + +namespace Core.Components.OxyPlot.Test.Converter +{ + [TestFixture] + public class ChartSeriesFactoryTest + { + [Test] + public void Create_AreaData_ReturnsAreaSeries() + { + // Setup + var factory = new ChartSeriesFactory(); + var testData = CreateTestData(); + var expectedData = CreateExpectedData(testData); + + // Call + IList series = factory.Create(new ChartAreaData(testData, "test data")); + + // Assert + Assert.AreEqual(1, series.Count); + Assert.IsInstanceOf>(series); + var areaSeries = ((AreaSeries)series[0]); + CollectionAssert.AreEqual(expectedData, areaSeries.Points); + CollectionAssert.AreEqual(new Collection{expectedData.First()}, areaSeries.Points2); + Assert.AreNotSame(expectedData, areaSeries.ItemsSource); + } + + [Test] + public void Create_LineData_ReturnsLineSeries() + { + // Setup + var factory = new ChartSeriesFactory(); + var testData = CreateTestData(); + + // Call + IList series = factory.Create(new ChartLineData(testData, "test data")); + + // Assert + Assert.AreEqual(1, series.Count); + Assert.IsInstanceOf>(series); + var lineSeries = ((LineSeries)series[0]); + CollectionAssert.AreEqual(testData, lineSeries.ItemsSource); + Assert.AreNotSame(testData, lineSeries.ItemsSource); + } + + [Test] + public void Create_PointData_ReturnsLinesSeriesWithPointStyle() + { + // Setup + var factory = new ChartSeriesFactory(); + var testData = CreateTestData(); + + // Call + IList series = factory.Create(new ChartPointData(testData, "test data")); + + // Assert + Assert.AreEqual(1, series.Count); + Assert.IsInstanceOf>(series); + var lineSeries = ((LineSeries)series[0]); + CollectionAssert.AreEqual(testData, lineSeries.ItemsSource); + Assert.AreNotSame(testData, lineSeries.ItemsSource); + Assert.AreEqual(LineStyle.None, lineSeries.LineStyle); + Assert.AreEqual(MarkerType.Circle, lineSeries.MarkerType); + } + + [Test] + public void Create_OtherData_ThrowsNotSupportedException() + { + // Setup + var factory = new ChartSeriesFactory(); + var testData = new TestChartData("test data"); + + // Call + TestDelegate test = () => factory.Create(testData); + + // Assert + Assert.Throws(test); + } + + private static ICollection CreateExpectedData(IEnumerable> testData) + { + return testData.Select(p => new DataPoint(p.Item1, p.Item2)).ToArray(); + } + + private static Collection> CreateTestData() + { + return new Collection> + { + Tuple.Create(1.2, 3.4), + Tuple.Create(3.2, 3.4), + Tuple.Create(0.2, 2.4) + }; + } + } +} \ No newline at end of file Fisheye: Tag 8aa11a9aa48733a5b5b72c58c71674472825b26c refers to a dead (removed) revision in file `Core/Components/test/Core.Components.OxyPlot.Test/Converter/LineDataConverterTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 8aa11a9aa48733a5b5b72c58c71674472825b26c refers to a dead (removed) revision in file `Core/Components/test/Core.Components.OxyPlot.Test/Converter/PointDataConverterTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 8aa11a9aa48733a5b5b72c58c71674472825b26c refers to a dead (removed) revision in file `Core/Components/test/Core.Components.OxyPlot.Test/Converter/SeriesFactoryTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Components/test/Core.Components.OxyPlot.Test/Core.Components.OxyPlot.Test.csproj =================================================================== diff -u -rc5672681b9872a622ff718acd6975118ad59474f -r8aa11a9aa48733a5b5b72c58c71674472825b26c --- Core/Components/test/Core.Components.OxyPlot.Test/Core.Components.OxyPlot.Test.csproj (.../Core.Components.OxyPlot.Test.csproj) (revision c5672681b9872a622ff718acd6975118ad59474f) +++ Core/Components/test/Core.Components.OxyPlot.Test/Core.Components.OxyPlot.Test.csproj (.../Core.Components.OxyPlot.Test.csproj) (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -50,14 +50,14 @@ - + - - + + - + Index: Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendView.cs =================================================================== diff -u -r5e80369138024933a45f3e4ae721509dfb17d8fb -r8aa11a9aa48733a5b5b72c58c71674472825b26c --- Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendView.cs (.../LegendView.cs) (revision 5e80369138024933a45f3e4ae721509dfb17d8fb) +++ Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendView.cs (.../LegendView.cs) (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -46,7 +46,7 @@ InitializeComponent(); Text = Resources.General_Chart; - treeViewControl.RegisterTreeNodeInfo(new TreeNodeInfo + treeViewControl.RegisterTreeNodeInfo(new TreeNodeInfo { Text = pointData => OxyPlotResources.ChartData_Point_data_label, Image = pointData => OxyPlotResources.PointsIcon, @@ -56,7 +56,7 @@ OnNodeChecked = PointBasedChartDataOnNodeChecked }); - treeViewControl.RegisterTreeNodeInfo(new TreeNodeInfo + treeViewControl.RegisterTreeNodeInfo(new TreeNodeInfo { Text = lineData => OxyPlotResources.ChartData_Line_data_label, Image = lineData => OxyPlotResources.LineIcon, @@ -66,7 +66,7 @@ OnNodeChecked = PointBasedChartDataOnNodeChecked }); - treeViewControl.RegisterTreeNodeInfo(new TreeNodeInfo + treeViewControl.RegisterTreeNodeInfo(new TreeNodeInfo { Text = areaData => OxyPlotResources.ChartData_Area_data_label, Image = areaData => OxyPlotResources.AreaIcon, Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Forms/ChartDataViewTest.cs =================================================================== diff -u -r30b12b82918d500fe834eafd9f6cd9b2c5dbe60f -r8aa11a9aa48733a5b5b72c58c71674472825b26c --- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Forms/ChartDataViewTest.cs (.../ChartDataViewTest.cs) (revision 30b12b82918d500fe834eafd9f6cd9b2c5dbe60f) +++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Forms/ChartDataViewTest.cs (.../ChartDataViewTest.cs) (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -60,7 +60,7 @@ // Setup var chartView = new ChartDataView(); var chart = (ChartControl)chartView.Controls[0]; - var lineData = new LineData(Enumerable.Empty>()); + var lineData = new ChartLineData(Enumerable.Empty>(), "test data"); // Call chartView.Data = lineData; @@ -76,7 +76,7 @@ // Setup var chartView = new ChartDataView(); var chart = (ChartControl)chartView.Controls[0]; - var pointData = new PointData(Enumerable.Empty>()); + var pointData = new ChartPointData(Enumerable.Empty>(), "test data"); // Call chartView.Data = pointData; @@ -92,7 +92,7 @@ // Setup var chartView = new ChartDataView(); var chart = (ChartControl)chartView.Controls[0]; - var areaData = new AreaData(Enumerable.Empty>()); + var areaData = new ChartAreaData(Enumerable.Empty>(), "test data"); // Call chartView.Data = areaData; @@ -108,7 +108,7 @@ // Setup var chartView = new ChartDataView(); var chart = (ChartControl)chartView.Controls[0]; - var chartDataCollection = new ChartDataCollection(new ChartData[0]); + var chartDataCollection = new ChartDataCollection(new ChartData[0], "test data"); // Call chartView.Data = chartDataCollection; Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/AreaDataTreeNodeInfoTest.cs =================================================================== diff -u -r249fd5e4604012895724a9d7df67201332c9e7dc -r8aa11a9aa48733a5b5b72c58c71674472825b26c --- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/AreaDataTreeNodeInfoTest.cs (.../AreaDataTreeNodeInfoTest.cs) (revision 249fd5e4604012895724a9d7df67201332c9e7dc) +++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/AreaDataTreeNodeInfoTest.cs (.../AreaDataTreeNodeInfoTest.cs) (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -29,7 +29,7 @@ var treeViewControl = TypeUtils.GetField(legendView, "treeViewControl"); var treeNodeInfoLookup = TypeUtils.GetField>(treeViewControl, "tagTypeTreeNodeInfoLookup"); - info = treeNodeInfoLookup[typeof(AreaData)]; + info = treeNodeInfoLookup[typeof(ChartAreaData)]; } [TearDown] @@ -42,7 +42,7 @@ public void Initialized_Always_ExpectedPropertiesSet() { // Assert - Assert.AreEqual(typeof(AreaData), info.TagType); + Assert.AreEqual(typeof(ChartAreaData), info.TagType); Assert.IsNull(info.ForeColor); Assert.IsNull(info.ContextMenuStrip); Assert.IsNull(info.EnsureVisibleOnCreate); @@ -60,7 +60,7 @@ public void Text_Always_ReturnsTextFromResource() { // Setup - var areaData = mocks.StrictMock(Enumerable.Empty>()); + var areaData = mocks.StrictMock(Enumerable.Empty>(), "test data"); mocks.ReplayAll(); @@ -77,7 +77,7 @@ public void Image_Always_ReturnsSetImage() { // Setup - var areaData = mocks.StrictMock(Enumerable.Empty>()); + var areaData = mocks.StrictMock(Enumerable.Empty>(), "test data"); mocks.ReplayAll(); @@ -94,7 +94,7 @@ public void CanDrag_Always_ReturnsTrue() { // Setup - var areaData = mocks.StrictMock(Enumerable.Empty>()); + var areaData = mocks.StrictMock(Enumerable.Empty>(), "test data"); mocks.ReplayAll(); @@ -111,7 +111,7 @@ public void CanCheck_Always_ReturnsTrue() { // Setup - var areaData = mocks.StrictMock(Enumerable.Empty>()); + var areaData = mocks.StrictMock(Enumerable.Empty>(), "test data"); mocks.ReplayAll(); @@ -129,7 +129,7 @@ public void IsChecked_Always_ReturnsAccordingToVisibleStateOfAreaData(bool isVisible) { // Setup - var areaData = mocks.StrictMock(Enumerable.Empty>()); + var areaData = mocks.StrictMock(Enumerable.Empty>(), "test data"); areaData.IsVisible = isVisible; @@ -149,7 +149,7 @@ public void OnNodeChecked_AreaDataNodeWithoutParent_SetsAreaDataVisibility(bool initialVisibleState) { // Setup - var areaData = mocks.StrictMock(Enumerable.Empty>()); + var areaData = mocks.StrictMock(Enumerable.Empty>(), "test data"); mocks.ReplayAll(); @@ -170,7 +170,7 @@ { // Setup var observable = mocks.StrictMock(); - var areaData = mocks.StrictMock(Enumerable.Empty>()); + var areaData = mocks.StrictMock(Enumerable.Empty>(), "test data"); observable.Expect(o => o.NotifyObservers()); Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartDataCollectionTreeNodeInfoTest.cs =================================================================== diff -u -r249fd5e4604012895724a9d7df67201332c9e7dc -r8aa11a9aa48733a5b5b72c58c71674472825b26c --- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartDataCollectionTreeNodeInfoTest.cs (.../ChartDataCollectionTreeNodeInfoTest.cs) (revision 249fd5e4604012895724a9d7df67201332c9e7dc) +++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartDataCollectionTreeNodeInfoTest.cs (.../ChartDataCollectionTreeNodeInfoTest.cs) (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -61,7 +61,7 @@ public void Text_Always_ReturnsTextFromResource() { // Setup - var chartDataCollection = mocks.StrictMock(new List()); + var chartDataCollection = mocks.StrictMock(new List(), "test data"); mocks.ReplayAll(); @@ -78,7 +78,7 @@ public void Image_Always_ReturnsSetImage() { // Setup - var chartDataCollection = mocks.StrictMock(new List()); + var chartDataCollection = mocks.StrictMock(new List(), "test data"); mocks.ReplayAll(); @@ -95,15 +95,15 @@ public void ChildNodeObjects_Always_ReturnsChildsOnDataReversed() { // Setup - var chartData1 = mocks.StrictMock(); - var chartData2 = mocks.StrictMock(); - var chartData3 = mocks.StrictMock(); + var chartData1 = mocks.StrictMock("test data"); + var chartData2 = mocks.StrictMock("test data"); + var chartData3 = mocks.StrictMock("test data"); var chartDataCollection = mocks.StrictMock(new List { chartData1, chartData2, chartData3 - }); + }, "test data"); mocks.ReplayAll(); @@ -120,7 +120,7 @@ public void CanDrop_SourceNodeTagIsNoChartData_ReturnsFalse() { // Setup - var chartDataCollection = mocks.StrictMock(new List()); + var chartDataCollection = mocks.StrictMock(new List(), "test data"); mocks.ReplayAll(); @@ -137,8 +137,8 @@ public void CanDrop_SourceNodeTagIsChartData_ReturnsTrue() { // Setup - var chartData = mocks.StrictMock(); - var chartDataCollection = mocks.StrictMock(new List()); + var chartData = mocks.StrictMock("test data"); + var chartDataCollection = mocks.StrictMock(new List(), "test data"); mocks.ReplayAll(); @@ -155,7 +155,7 @@ public void CanInsert_SourceNodeTagIsNoChartData_ReturnsFalse() { // Setup - var chartDataCollection = mocks.StrictMock(new List()); + var chartDataCollection = mocks.StrictMock(new List(), "test data"); mocks.ReplayAll(); @@ -172,8 +172,8 @@ public void CanInsert_SourceNodeTagIsChartData_ReturnsTrue() { // Setup - var chartData = mocks.StrictMock(); - var chartDataCollection = mocks.StrictMock(new List()); + var chartData = mocks.StrictMock("test data"); + var chartDataCollection = mocks.StrictMock(new List(), "test data"); mocks.ReplayAll(); @@ -194,15 +194,15 @@ { // Setup var observer = mocks.StrictMock(); - var chartData1 = mocks.StrictMock(); - var chartData2 = mocks.StrictMock(); - var chartData3 = mocks.StrictMock(); + var chartData1 = mocks.StrictMock("test data"); + var chartData2 = mocks.StrictMock("test data"); + var chartData3 = mocks.StrictMock("test data"); var chartDataCollection = mocks.StrictMock(new List { chartData1, chartData2, chartData3 - }); + }, "test data"); var treeViewControlMock = mocks.StrictMock(); @@ -231,15 +231,15 @@ { // Setup var observer = mocks.StrictMock(); - var chartData1 = mocks.StrictMock(); - var chartData2 = mocks.StrictMock(); - var chartData3 = mocks.StrictMock(); + var chartData1 = mocks.StrictMock("test data"); + var chartData2 = mocks.StrictMock("test data"); + var chartData3 = mocks.StrictMock("test data"); var chartDataCollection = mocks.StrictMock(new List { chartData1, chartData2, chartData3 - }); + }, "test data"); chartDataCollection.Attach(observer); Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/LegendViewTest.cs =================================================================== diff -u -raadef283cdf782eaefc208b8a40df9c568fdaece -r8aa11a9aa48733a5b5b72c58c71674472825b26c --- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/LegendViewTest.cs (.../LegendViewTest.cs) (revision aadef283cdf782eaefc208b8a40df9c568fdaece) +++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/LegendViewTest.cs (.../LegendViewTest.cs) (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -34,7 +34,7 @@ // Setup using (var view = new LegendView()) { - var chartDataCollection = new ChartDataCollection(new List()); + var chartDataCollection = new ChartDataCollection(new List(), "test data"); // Call view.Data = chartDataCollection; @@ -78,7 +78,7 @@ // Setup var legendView = new LegendView { - Data = new ChartDataCollection(new List()) + Data = new ChartDataCollection(new List(), "test data") }; var treeViewControl = TypeUtils.GetField(legendView, "treeViewControl"); Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/LineDataTreeNodeInfoTest.cs =================================================================== diff -u -r249fd5e4604012895724a9d7df67201332c9e7dc -r8aa11a9aa48733a5b5b72c58c71674472825b26c --- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/LineDataTreeNodeInfoTest.cs (.../LineDataTreeNodeInfoTest.cs) (revision 249fd5e4604012895724a9d7df67201332c9e7dc) +++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/LineDataTreeNodeInfoTest.cs (.../LineDataTreeNodeInfoTest.cs) (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -29,7 +29,7 @@ var treeViewControl = TypeUtils.GetField(legendView, "treeViewControl"); var treeNodeInfoLookup = TypeUtils.GetField>(treeViewControl, "tagTypeTreeNodeInfoLookup"); - info = treeNodeInfoLookup[typeof(LineData)]; + info = treeNodeInfoLookup[typeof(ChartLineData)]; } [TearDown] @@ -42,7 +42,7 @@ public void Initialized_Always_ExpectedPropertiesSet() { // Assert - Assert.AreEqual(typeof(LineData), info.TagType); + Assert.AreEqual(typeof(ChartLineData), info.TagType); Assert.IsNull(info.ForeColor); Assert.IsNull(info.ContextMenuStrip); Assert.IsNull(info.EnsureVisibleOnCreate); @@ -60,7 +60,7 @@ public void Text_Always_ReturnsTextFromResource() { // Setup - var lineData = mocks.StrictMock(Enumerable.Empty>()); + var lineData = mocks.StrictMock(Enumerable.Empty>(), "test data"); mocks.ReplayAll(); @@ -77,7 +77,7 @@ public void Image_Always_ReturnsSetImage() { // Setup - var lineData = mocks.StrictMock(Enumerable.Empty>()); + var lineData = mocks.StrictMock(Enumerable.Empty>(), "test data"); mocks.ReplayAll(); @@ -94,7 +94,7 @@ public void CanDrag_Always_ReturnsTrue() { // Setup - var lineData = mocks.StrictMock(Enumerable.Empty>()); + var lineData = mocks.StrictMock(Enumerable.Empty>(), "test data"); mocks.ReplayAll(); @@ -111,7 +111,7 @@ public void CanCheck_Always_ReturnsTrue() { // Setup - var lineData = mocks.StrictMock(Enumerable.Empty>()); + var lineData = mocks.StrictMock(Enumerable.Empty>(), "test data"); mocks.ReplayAll(); @@ -129,7 +129,7 @@ public void IsChecked_Always_ReturnsAccordingToVisibleStateOfLineData(bool isVisible) { // Setup - var lineData = mocks.StrictMock(Enumerable.Empty>()); + var lineData = mocks.StrictMock(Enumerable.Empty>(), "test data"); lineData.IsVisible = isVisible; @@ -149,7 +149,7 @@ public void LineDataNodeWithoutParent_SetsLineDataVisibility(bool initialVisibleState) { // Setup - var lineData = mocks.StrictMock(Enumerable.Empty>()); + var lineData = mocks.StrictMock(Enumerable.Empty>(), "test data"); mocks.ReplayAll(); @@ -170,7 +170,7 @@ { // Setup var observable = mocks.StrictMock(); - var lineData = mocks.StrictMock(Enumerable.Empty>()); + var lineData = mocks.StrictMock(Enumerable.Empty>(), "test data"); observable.Expect(o => o.NotifyObservers()); Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/PointDataTreeNodeInfoTest.cs =================================================================== diff -u -r249fd5e4604012895724a9d7df67201332c9e7dc -r8aa11a9aa48733a5b5b72c58c71674472825b26c --- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/PointDataTreeNodeInfoTest.cs (.../PointDataTreeNodeInfoTest.cs) (revision 249fd5e4604012895724a9d7df67201332c9e7dc) +++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/PointDataTreeNodeInfoTest.cs (.../PointDataTreeNodeInfoTest.cs) (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -29,7 +29,7 @@ var treeViewControl = TypeUtils.GetField(legendView, "treeViewControl"); var treeNodeInfoLookup = TypeUtils.GetField>(treeViewControl, "tagTypeTreeNodeInfoLookup"); - info = treeNodeInfoLookup[typeof(PointData)]; + info = treeNodeInfoLookup[typeof(ChartPointData)]; } [TearDown] @@ -42,7 +42,7 @@ public void Initialized_Always_ExpectedPropertiesSet() { // Assert - Assert.AreEqual(typeof(PointData), info.TagType); + Assert.AreEqual(typeof(ChartPointData), info.TagType); Assert.IsNull(info.ForeColor); Assert.IsNull(info.ContextMenuStrip); Assert.IsNull(info.EnsureVisibleOnCreate); @@ -60,7 +60,7 @@ public void Text_Always_ReturnsTextFromResource() { // Setup - var pointData = mocks.StrictMock(Enumerable.Empty>()); + var pointData = mocks.StrictMock(Enumerable.Empty>(), "test data"); mocks.ReplayAll(); @@ -77,7 +77,7 @@ public void Image_Always_ReturnsSetImage() { // Setup - var pointData = mocks.StrictMock(Enumerable.Empty>()); + var pointData = mocks.StrictMock(Enumerable.Empty>(), "test data"); mocks.ReplayAll(); @@ -94,7 +94,7 @@ public void CanDrag_Always_ReturnsTrue() { // Setup - var pointData = mocks.StrictMock(Enumerable.Empty>()); + var pointData = mocks.StrictMock(Enumerable.Empty>(), "test data"); mocks.ReplayAll(); @@ -111,7 +111,7 @@ public void CanCheck_Always_ReturnsTrue() { // Setup - var pointData = mocks.StrictMock(Enumerable.Empty>()); + var pointData = mocks.StrictMock(Enumerable.Empty>(), "test data"); mocks.ReplayAll(); @@ -129,7 +129,7 @@ public void IsChecked_Always_ReturnsAccordingToVisibleStateOfPointsData(bool isVisible) { // Setup - var pointData = mocks.StrictMock(Enumerable.Empty>()); + var pointData = mocks.StrictMock(Enumerable.Empty>(), "test data"); pointData.IsVisible = isVisible; @@ -149,7 +149,7 @@ public void PointDataNodeWithoutParent_SetsPointDataVisibility(bool initialVisibleState) { // Setup - var pointData = mocks.StrictMock(Enumerable.Empty>()); + var pointData = mocks.StrictMock(Enumerable.Empty>(), "test data"); mocks.ReplayAll(); @@ -170,7 +170,7 @@ { // Setup var observable = mocks.StrictMock(); - var pointData = mocks.StrictMock(Enumerable.Empty>()); + var pointData = mocks.StrictMock(Enumerable.Empty>(), "test data"); observable.Expect(o => o.NotifyObservers()); Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/OxyPlotGuiPluginTest.cs =================================================================== diff -u -rf906ba10d1763e14a608bb2629b15893f37e9deb -r8aa11a9aa48733a5b5b72c58c71674472825b26c --- Core/Plugins/test/Core.Plugins.OxyPlot.Test/OxyPlotGuiPluginTest.cs (.../OxyPlotGuiPluginTest.cs) (revision f906ba10d1763e14a608bb2629b15893f37e9deb) +++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/OxyPlotGuiPluginTest.cs (.../OxyPlotGuiPluginTest.cs) (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -64,7 +64,7 @@ { var chartView = mocks.Stub(); var chart = mocks.Stub(); - chart.Data = new TestChartData(); + chart.Data = new TestChartData("test data"); chartView.Stub(v => v.Chart).Return(chart); view = chartView; } Index: Demo/Ringtoets/src/Demo.Ringtoets/Commands/OpenChartViewCommand.cs =================================================================== diff -u -r5047fad63b41f7f79bc8a1690fc69045e7233666 -r8aa11a9aa48733a5b5b72c58c71674472825b26c --- Demo/Ringtoets/src/Demo.Ringtoets/Commands/OpenChartViewCommand.cs (.../OpenChartViewCommand.cs) (revision 5047fad63b41f7f79bc8a1690fc69045e7233666) +++ Demo/Ringtoets/src/Demo.Ringtoets/Commands/OpenChartViewCommand.cs (.../OpenChartViewCommand.cs) (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -5,6 +5,7 @@ using Core.Common.Controls.Commands; using Core.Common.Gui; using Core.Components.Charting.Data; +using Demo.Ringtoets.Properties; namespace Demo.Ringtoets.Commands { @@ -42,7 +43,7 @@ public void Execute(params object[] arguments) { - var line1 = new LineData(new Collection> + var line1 = new ChartLineData(new Collection> { Tuple.Create(0.0, 0.500), Tuple.Create(0.1, 0.723), @@ -66,9 +67,9 @@ Tuple.Create(1.9, 1.317), Tuple.Create(2.0, 1.540), Tuple.Create(2.1, 1.823) - }); + }, Resources.OpenChartViewCommand_Execute_Line_one); - var line2 = new LineData(new Collection> + var line2 = new ChartLineData(new Collection> { Tuple.Create(0.0, 0.800), Tuple.Create(0.1, 1.009), @@ -92,9 +93,9 @@ Tuple.Create(1.9, 0.658), Tuple.Create(2.0, 0.752), Tuple.Create(2.1, 0.895) - }); + }, Resources.OpenChartViewCommand_Execute_Line_two); - var area1 = new AreaData(new Collection> + var area1 = new ChartAreaData(new Collection> { Tuple.Create(0.0, 0.500), Tuple.Create(0.1, 0.723), @@ -129,8 +130,8 @@ Tuple.Create(0.1, 0.723 - 0.5), Tuple.Create(0.0, 0.000), Tuple.Create(0.0, 0.500) - }); - var area2 = new AreaData(new Collection> + }, Resources.OpenChartViewCommand_Execute_Area_one); + var area2 = new ChartAreaData(new Collection> { Tuple.Create(0.1, 0.723 - 0.5), Tuple.Create(0.2, 0.892 - 0.5), @@ -171,8 +172,8 @@ Tuple.Create(0.2, 0.892 - 0.7), Tuple.Create(0.1, 0.723 - 0.7), Tuple.Create(0.1, 0.723 - 0.5) - }); - var points1 = new PointData(new Collection> + }, Resources.OpenChartViewCommand_Execute_Area_two); + var points1 = new ChartPointData(new Collection> { Tuple.Create(0.2, 0.892 + 0.04), Tuple.Create(0.3, 1.013 + 0.02), @@ -182,9 +183,9 @@ Tuple.Create(1.4, 0.892 - 0.02), Tuple.Create(1.5, 0.905 + 0.01), Tuple.Create(1.8, 1.148 + 0.02) - }); + }, Resources.OpenChartViewCommand_Execute_Points_one); - var points2 = new PointData(new Collection> + var points2 = new ChartPointData(new Collection> { Tuple.Create(0.0, 0.800 + 0.01), Tuple.Create(0.1, 1.009 + 0.02), @@ -201,12 +202,12 @@ Tuple.Create(1.4, 0.716 + 0.02), Tuple.Create(1.7, 0.591), Tuple.Create(1.8, 0.606) - }); + }, Resources.OpenChartViewCommand_Execute_Points_two); documentViewController.DocumentViewsResolver.OpenViewForData(new ChartDataCollection(new List { area1, area2, line1, line2, points1, points2 - })); + }, Resources.OpenChartViewCommand_Execute_Graph_data)); } } } \ No newline at end of file Index: Demo/Ringtoets/src/Demo.Ringtoets/Commands/OpenMapViewCommand.cs =================================================================== diff -u -r04b631b486b742c5339deb1d5504bb13ab5e248d -r8aa11a9aa48733a5b5b72c58c71674472825b26c --- Demo/Ringtoets/src/Demo.Ringtoets/Commands/OpenMapViewCommand.cs (.../OpenMapViewCommand.cs) (revision 04b631b486b742c5339deb1d5504bb13ab5e248d) +++ Demo/Ringtoets/src/Demo.Ringtoets/Commands/OpenMapViewCommand.cs (.../OpenMapViewCommand.cs) (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -7,6 +7,7 @@ using Core.Components.Gis.Data; using Core.Components.Gis.Features; using Core.Components.Gis.Geometries; +using Demo.Ringtoets.Properties; namespace Demo.Ringtoets.Commands { @@ -49,35 +50,35 @@ new Point2D(4.764723, 52.990274), new Point2D(4.713888, 53.056108), new Point2D(4.883333, 53.184168) - }), "Texel"); + }), Resources.OpenMapViewCommand_Execute_Texel); var polygons2 = new MapPolygonData(GetFeatureWithPoints(new Collection { new Point2D(4.957224, 53.23778), new Point2D(4.879999, 53.214441), new Point2D(5.10639, 53.303331) - }), "Vlieland"); + }), Resources.OpenMapViewCommand_Execute_Vlieland); var polygons3 = new MapPolygonData(GetFeatureWithPoints(new Collection { new Point2D(5.213057, 53.35), new Point2D(5.16889, 53.373888), new Point2D(5.581945, 53.447779) - }), "Terschelling"); + }), Resources.OpenMapViewCommand_Execute_Terschelling); var polygons4 = new MapPolygonData(GetFeatureWithPoints(new Collection { new Point2D(5.699167, 53.462778), new Point2D(5.956114, 53.462778), new Point2D(5.633055, 53.441668) - }), "Ameland"); + }), Resources.OpenMapViewCommand_Execute_Ameland); var polygons5 = new MapPolygonData(GetFeatureWithPoints(new Collection { new Point2D(6.135, 53.453608), new Point2D(6.14889, 53.497499), new Point2D(6.341112, 53.502779) - }), "Schiermonnikoog"); + }), Resources.OpenMapViewCommand_Execute_Schiermonnikoog); var pointsRandstad = new MapPointData(GetFeatureWithPoints(new Collection { @@ -87,7 +88,7 @@ new Point2D(4.3007, 52.0705), new Point2D(4.8952, 52.3702), new Point2D(4.3667, 52.0167) - }), "Randstad"); + }), Resources.OpenMapViewCommand_Execute_Randstad); var linesRandstad = new MapLineData(GetFeatureWithPoints(new Collection { @@ -100,7 +101,7 @@ new Point2D(4.3667, 52.0167), new Point2D(5.1146, 52.0918), new Point2D(4.8952, 52.3702) - }), "Snelwegen randstad"); + }), Resources.OpenMapViewCommand_Execute_Snelwegen_randstad); var lines = new MapLineData(GetFeatureWithPoints(new Collection { @@ -113,7 +114,7 @@ new Point2D(5.855558, 52.544168), new Point2D(5.855558, 52.492495), new Point2D(5.763887, 52.415277) - }), "Kustlijn Flevoland"); + }), Resources.OpenMapViewCommand_Execute_Kustlijn_Flevoland); var polygonNetherlands = new MapPolygonData(GetFeatureWithPoints(new Collection { @@ -156,12 +157,12 @@ new Point2D(4.58, 52.471666), new Point2D(4.734167, 52.955553), new Point2D(6.871668, 53.416109) - }), "Continentaal Nederland"); + }), Resources.OpenMapViewCommand_Execute_Continentaal_Nederland); documentViewController.DocumentViewsResolver.OpenViewForData(new MapDataCollection(new List { polygons1, polygons2, polygons3, polygons4, polygons5, lines, polygonNetherlands, linesRandstad, pointsRandstad - }, "Demo kaart Nederland")); + }, Resources.OpenMapViewCommand_Execute_Demo_map_netherlands)); } private IEnumerable GetFeatureWithPoints(Collection points) Index: Demo/Ringtoets/src/Demo.Ringtoets/Properties/Resources.Designer.cs =================================================================== diff -u -r8b5a6f938fe2b04cd78623649df37580e145055f -r8aa11a9aa48733a5b5b72c58c71674472825b26c --- Demo/Ringtoets/src/Demo.Ringtoets/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 8b5a6f938fe2b04cd78623649df37580e145055f) +++ Demo/Ringtoets/src/Demo.Ringtoets/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18444 +// Runtime Version:4.0.30319.17929 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -155,6 +155,69 @@ } /// + /// Looks up a localized string similar to Gebied 1. + /// + public static string OpenChartViewCommand_Execute_Area_one { + get { + return ResourceManager.GetString("OpenChartViewCommand_Execute_Area_one", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Gebied 2. + /// + public static string OpenChartViewCommand_Execute_Area_two { + get { + return ResourceManager.GetString("OpenChartViewCommand_Execute_Area_two", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Grafiek data. + /// + public static string OpenChartViewCommand_Execute_Graph_data { + get { + return ResourceManager.GetString("OpenChartViewCommand_Execute_Graph_data", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Lijn 1. + /// + public static string OpenChartViewCommand_Execute_Line_one { + get { + return ResourceManager.GetString("OpenChartViewCommand_Execute_Line_one", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Lijn 2. + /// + public static string OpenChartViewCommand_Execute_Line_two { + get { + return ResourceManager.GetString("OpenChartViewCommand_Execute_Line_two", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Punten 1. + /// + public static string OpenChartViewCommand_Execute_Points_one { + get { + return ResourceManager.GetString("OpenChartViewCommand_Execute_Points_one", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Punten 2. + /// + public static string OpenChartViewCommand_Execute_Points_two { + get { + return ResourceManager.GetString("OpenChartViewCommand_Execute_Points_two", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Open een documentvenster met een kaart.. /// public static string OpenMapView_ToolTip { @@ -164,6 +227,42 @@ } /// + /// Looks up a localized string similar to Ameland. + /// + public static string OpenMapViewCommand_Execute_Ameland { + get { + return ResourceManager.GetString("OpenMapViewCommand_Execute_Ameland", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Continentaal Nederland. + /// + public static string OpenMapViewCommand_Execute_Continentaal_Nederland { + get { + return ResourceManager.GetString("OpenMapViewCommand_Execute_Continentaal_Nederland", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Demo kaart Nederland. + /// + public static string OpenMapViewCommand_Execute_Demo_map_netherlands { + get { + return ResourceManager.GetString("OpenMapViewCommand_Execute_Demo_map_netherlands", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Kustlijn Flevoland. + /// + public static string OpenMapViewCommand_Execute_Kustlijn_Flevoland { + get { + return ResourceManager.GetString("OpenMapViewCommand_Execute_Kustlijn_Flevoland", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Lijn demo data. /// public static string OpenMapViewCommand_Execute_Line_demo_data { @@ -200,6 +299,60 @@ } /// + /// Looks up a localized string similar to Randstad. + /// + public static string OpenMapViewCommand_Execute_Randstad { + get { + return ResourceManager.GetString("OpenMapViewCommand_Execute_Randstad", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Schiermonnikoog. + /// + public static string OpenMapViewCommand_Execute_Schiermonnikoog { + get { + return ResourceManager.GetString("OpenMapViewCommand_Execute_Schiermonnikoog", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Snelwegen randstad. + /// + public static string OpenMapViewCommand_Execute_Snelwegen_randstad { + get { + return ResourceManager.GetString("OpenMapViewCommand_Execute_Snelwegen_randstad", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Terschelling. + /// + public static string OpenMapViewCommand_Execute_Terschelling { + get { + return ResourceManager.GetString("OpenMapViewCommand_Execute_Terschelling", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Texel. + /// + public static string OpenMapViewCommand_Execute_Texel { + get { + return ResourceManager.GetString("OpenMapViewCommand_Execute_Texel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Vlieland. + /// + public static string OpenMapViewCommand_Execute_Vlieland { + get { + return ResourceManager.GetString("OpenMapViewCommand_Execute_Vlieland", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Demo. /// public static string Ribbon_Demo_Header { Index: Demo/Ringtoets/src/Demo.Ringtoets/Properties/Resources.resx =================================================================== diff -u -r8b5a6f938fe2b04cd78623649df37580e145055f -r8aa11a9aa48733a5b5b72c58c71674472825b26c --- Demo/Ringtoets/src/Demo.Ringtoets/Properties/Resources.resx (.../Resources.resx) (revision 8b5a6f938fe2b04cd78623649df37580e145055f) +++ Demo/Ringtoets/src/Demo.Ringtoets/Properties/Resources.resx (.../Resources.resx) (revision 8aa11a9aa48733a5b5b72c58c71674472825b26c) @@ -166,4 +166,55 @@ Lijst + + Lijn 1 + + + Lijn 2 + + + Gebied 1 + + + Gebied 2 + + + Punten 1 + + + Punten 2 + + + Grafiek data + + + Texel + + + Vlieland + + + Terschelling + + + Ameland + + + Schiermonnikoog + + + Randstad + + + Snelwegen randstad + + + Kustlijn Flevoland + + + Continentaal Nederland + + + Demo kaart Nederland + \ No newline at end of file