Index: Core/Components/src/Core.Components.DotSpatial/Layer/MapLineDataLayer.cs =================================================================== diff -u -rf245fcfc202b53559917a5b89810a30c42949303 -racf1c815d99af1ce78dfd0b04b1949203c731803 --- Core/Components/src/Core.Components.DotSpatial/Layer/MapLineDataLayer.cs (.../MapLineDataLayer.cs) (revision f245fcfc202b53559917a5b89810a30c42949303) +++ Core/Components/src/Core.Components.DotSpatial/Layer/MapLineDataLayer.cs (.../MapLineDataLayer.cs) (revision acf1c815d99af1ce78dfd0b04b1949203c731803) @@ -40,7 +40,7 @@ /// /// Creates a new instance of . /// - /// The which the map line layer is based upon. + /// The which the map line data layer is based upon. public MapLineDataLayer(MapLineData mapLineData) { if (mapLineData == null) Index: Core/Components/src/Core.Components.DotSpatial/Layer/MapPointDataLayer.cs =================================================================== diff -u -rf245fcfc202b53559917a5b89810a30c42949303 -racf1c815d99af1ce78dfd0b04b1949203c731803 --- Core/Components/src/Core.Components.DotSpatial/Layer/MapPointDataLayer.cs (.../MapPointDataLayer.cs) (revision f245fcfc202b53559917a5b89810a30c42949303) +++ Core/Components/src/Core.Components.DotSpatial/Layer/MapPointDataLayer.cs (.../MapPointDataLayer.cs) (revision acf1c815d99af1ce78dfd0b04b1949203c731803) @@ -19,7 +19,7 @@ /// /// Creates a new instance of . /// - /// The which the map point layer is based upon. + /// The which the map point data layer is based upon. public MapPointDataLayer(MapPointData mapPointData) { if (mapPointData == null) Index: Core/Components/src/Core.Components.DotSpatial/Layer/MapPolygonDataLayer.cs =================================================================== diff -u -rf245fcfc202b53559917a5b89810a30c42949303 -racf1c815d99af1ce78dfd0b04b1949203c731803 --- Core/Components/src/Core.Components.DotSpatial/Layer/MapPolygonDataLayer.cs (.../MapPolygonDataLayer.cs) (revision f245fcfc202b53559917a5b89810a30c42949303) +++ Core/Components/src/Core.Components.DotSpatial/Layer/MapPolygonDataLayer.cs (.../MapPolygonDataLayer.cs) (revision acf1c815d99af1ce78dfd0b04b1949203c731803) @@ -40,7 +40,7 @@ /// /// Creates a new instance of . /// - /// The which the map polygon layer is based upon. + /// The which the map polygon data layer is based upon. public MapPolygonDataLayer(MapPolygonData mapPolygonData) { if (mapPolygonData == null) Index: Core/Components/test/Core.Components.DotSpatial.Test/Converter/FeatureBasedMapDataConverterTest.cs =================================================================== diff -u -r6a120e6618195c2c7b56d31f7c24637f5baa17e3 -racf1c815d99af1ce78dfd0b04b1949203c731803 --- Core/Components/test/Core.Components.DotSpatial.Test/Converter/FeatureBasedMapDataConverterTest.cs (.../FeatureBasedMapDataConverterTest.cs) (revision 6a120e6618195c2c7b56d31f7c24637f5baa17e3) +++ Core/Components/test/Core.Components.DotSpatial.Test/Converter/FeatureBasedMapDataConverterTest.cs (.../FeatureBasedMapDataConverterTest.cs) (revision acf1c815d99af1ce78dfd0b04b1949203c731803) @@ -278,8 +278,12 @@ { MetaData = { - { "Id", 1.1 }, - { "Name", "Feature" } + { + "Id", 1.1 + }, + { + "Name", "Feature" + } } } }, Index: Core/Components/test/Core.Components.DotSpatial.Test/Core.Components.DotSpatial.Test.csproj =================================================================== diff -u -r8b36313c9a9136c821c2614762889a63968aa8e6 -racf1c815d99af1ce78dfd0b04b1949203c731803 --- Core/Components/test/Core.Components.DotSpatial.Test/Core.Components.DotSpatial.Test.csproj (.../Core.Components.DotSpatial.Test.csproj) (revision 8b36313c9a9136c821c2614762889a63968aa8e6) +++ Core/Components/test/Core.Components.DotSpatial.Test/Core.Components.DotSpatial.Test.csproj (.../Core.Components.DotSpatial.Test.csproj) (revision acf1c815d99af1ce78dfd0b04b1949203c731803) @@ -85,6 +85,9 @@ + + + Index: Core/Components/test/Core.Components.DotSpatial.Test/Layer/MapLineDataLayerTest.cs =================================================================== diff -u --- Core/Components/test/Core.Components.DotSpatial.Test/Layer/MapLineDataLayerTest.cs (revision 0) +++ Core/Components/test/Core.Components.DotSpatial.Test/Layer/MapLineDataLayerTest.cs (revision acf1c815d99af1ce78dfd0b04b1949203c731803) @@ -0,0 +1,42 @@ +// 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 Core.Components.DotSpatial.Layer; +using NUnit.Framework; + +namespace Core.Components.DotSpatial.Test.Layer +{ + [TestFixture] + public class MapLineDataLayerTest + { + [Test] + public void Constructor_WithoutMapLineData_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new MapLineDataLayer(null); + + // Assert + string parameter = Assert.Throws(test).ParamName; + Assert.AreEqual("mapLineData", parameter); + } + } +} Index: Core/Components/test/Core.Components.DotSpatial.Test/Layer/MapPointDataLayerTest.cs =================================================================== diff -u --- Core/Components/test/Core.Components.DotSpatial.Test/Layer/MapPointDataLayerTest.cs (revision 0) +++ Core/Components/test/Core.Components.DotSpatial.Test/Layer/MapPointDataLayerTest.cs (revision acf1c815d99af1ce78dfd0b04b1949203c731803) @@ -0,0 +1,157 @@ +// 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.Drawing; +using Core.Common.Base.Geometry; +using Core.Components.DotSpatial.Layer; +using Core.Components.Gis.Data; +using Core.Components.Gis.Features; +using Core.Components.Gis.Geometries; +using Core.Components.Gis.Style; +using DotSpatial.Symbology; +using NUnit.Framework; +using PointShape = DotSpatial.Symbology.PointShape; + +namespace Core.Components.DotSpatial.Test.Layer +{ + [TestFixture] + public class MapPointDataLayerTest + { + [Test] + public void Constructor_WithoutMapPointData_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new MapPointDataLayer(null); + + // Assert + string parameter = Assert.Throws(test).ParamName; + Assert.AreEqual("mapPointData", parameter); + } + + [Test] + public void Constructor_MapPointDataWithTestProperties_MapPointDataLayerCreatedAccordingly() + { + // Setup + var mapPointData = new MapPointData("Test name"); + + SetMapPointDataTestProperties(mapPointData); + + // Call + var mapPointDataLayer = new MapPointDataLayer(mapPointData); + + // Assert + AssertMapPointDataLayerTestProperties(mapPointDataLayer); + } + + [Test] + public void Update_MapPointDataWithTestProperties_MapPointDataLayerUpdatedAccordingly() + { + // Setup + var mapPointData = new MapPointData("Test name"); + var mapPointDataLayer = new MapPointDataLayer(mapPointData); + + SetMapPointDataTestProperties(mapPointData); + + // Precondition + AssertMapPointDataLayerDefaultProperties(mapPointDataLayer); + + // Call + mapPointDataLayer.Update(); + + // Assert + AssertMapPointDataLayerTestProperties(mapPointDataLayer); + } + + private static void SetMapPointDataTestProperties(MapPointData mapPointData) + { + mapPointData.Name = "Another test name"; + mapPointData.IsVisible = false; + mapPointData.ShowLabels = true; + mapPointData.SelectedMetaDataAttribute = "Name"; + mapPointData.Style = new PointStyle(Color.AliceBlue, 2, PointSymbol.Circle); + mapPointData.Features = new[] + { + CreateTestMapFeature() + }; + } + + private static void AssertMapPointDataLayerTestProperties(MapPointDataLayer mapPointDataLayer) + { + Assert.AreEqual("Another test name", mapPointDataLayer.Name); + Assert.IsFalse(mapPointDataLayer.IsVisible); + Assert.IsTrue(mapPointDataLayer.ShowLabels); + + Assert.IsNotNull(mapPointDataLayer.LabelLayer); + Assert.AreEqual(string.Format("[{0}]", "2"), mapPointDataLayer.LabelLayer.Symbology.Categories[0].Expression); + + var firstStroke = (SimpleSymbol) mapPointDataLayer.Symbolizer.Symbols[0]; + Assert.AreEqual(Color.AliceBlue, firstStroke.Color); + Assert.AreEqual(2, firstStroke.Size.Width); + Assert.AreEqual(2, firstStroke.Size.Height); + Assert.AreEqual(PointShape.Ellipse, firstStroke.PointShape); + + Assert.AreEqual(1, mapPointDataLayer.DataSet.Features.Count); + } + + private static void AssertMapPointDataLayerDefaultProperties(MapPointDataLayer mapPointDataLayer) + { + Assert.AreEqual("Test name", mapPointDataLayer.Name); + Assert.IsTrue(mapPointDataLayer.IsVisible); + Assert.IsFalse(mapPointDataLayer.ShowLabels); + + Assert.IsNotNull(mapPointDataLayer.LabelLayer); + Assert.IsNull(mapPointDataLayer.LabelLayer.Symbology.Categories[0].Expression); + + var firstStroke = (SimpleSymbol) mapPointDataLayer.Symbolizer.Symbols[0]; + Assert.AreEqual(4, firstStroke.Size.Width); + Assert.AreEqual(4, firstStroke.Size.Height); + Assert.AreEqual(PointShape.Rectangle, firstStroke.PointShape); + + Assert.AreEqual(0, mapPointDataLayer.DataSet.Features.Count); + } + + private static MapFeature CreateTestMapFeature() + { + return new MapFeature(new[] + { + new MapGeometry(new[] + { + new[] + { + new Point2D(1, 2) + } + }) + }) + { + MetaData = + { + { + "Id", 1.1 + }, + { + "Name", "Feature" + } + } + }; + } + } +} \ No newline at end of file Index: Core/Components/test/Core.Components.DotSpatial.Test/Layer/MapPolygonDataLayerTest.cs =================================================================== diff -u --- Core/Components/test/Core.Components.DotSpatial.Test/Layer/MapPolygonDataLayerTest.cs (revision 0) +++ Core/Components/test/Core.Components.DotSpatial.Test/Layer/MapPolygonDataLayerTest.cs (revision acf1c815d99af1ce78dfd0b04b1949203c731803) @@ -0,0 +1,42 @@ +// 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 Core.Components.DotSpatial.Layer; +using NUnit.Framework; + +namespace Core.Components.DotSpatial.Test.Layer +{ + [TestFixture] + public class MapPolygonDataLayerTest + { + [Test] + public void Constructor_WithoutMapPolygonData_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new MapPolygonDataLayer(null); + + // Assert + string parameter = Assert.Throws(test).ParamName; + Assert.AreEqual("mapPolygonData", parameter); + } + } +}