Index: Core/Components/src/Core.Components.Gis/Data/MapLineData.cs
===================================================================
diff -u -rabc02e9330166ed14bdbbb095424ffc9e79a11b8 -r2f5fc74d129a8b1c3410c3d256f33f84a26e8dfd
--- Core/Components/src/Core.Components.Gis/Data/MapLineData.cs (.../MapLineData.cs) (revision abc02e9330166ed14bdbbb095424ffc9e79a11b8)
+++ Core/Components/src/Core.Components.Gis/Data/MapLineData.cs (.../MapLineData.cs) (revision 2f5fc74d129a8b1c3410c3d256f33f84a26e8dfd)
@@ -32,7 +32,7 @@
///
/// This class represents features that are visible as a line.
///
- public class MapLineData : FeatureBasedMapData
+ public class MapLineData : FeatureBasedMapData
{
///
/// Creates a new instance of with default styling.
@@ -51,7 +51,20 @@
/// null or only whitespace.
/// Thrown when
/// is null.
- public MapLineData(string name, LineStyle style) : base(name)
+ public MapLineData(string name, LineStyle style) : this(name, style, null) {}
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The name of the .
+ /// The default style of the data that is not categorized by the categories
+ /// defined in .
+ /// The map theme belong to the data.
+ /// Thrown when is
+ /// null or only whitespace.
+ /// Thrown when
+ /// is null.
+ public MapLineData(string name, LineStyle style, MapTheme mapTheme) : base(name, mapTheme)
{
if (style == null)
{
@@ -67,11 +80,6 @@
public LineStyle Style { get; }
///
- /// Gets or sets the map theme of the .
- ///
- public MapTheme Theme { get; set; }
-
- ///
/// This method validates newly set features.
///
/// The new features to validate.
Index: Core/Components/src/Core.Components.Gis/Data/MapPointData.cs
===================================================================
diff -u -rabc02e9330166ed14bdbbb095424ffc9e79a11b8 -r2f5fc74d129a8b1c3410c3d256f33f84a26e8dfd
--- Core/Components/src/Core.Components.Gis/Data/MapPointData.cs (.../MapPointData.cs) (revision abc02e9330166ed14bdbbb095424ffc9e79a11b8)
+++ Core/Components/src/Core.Components.Gis/Data/MapPointData.cs (.../MapPointData.cs) (revision 2f5fc74d129a8b1c3410c3d256f33f84a26e8dfd)
@@ -32,7 +32,7 @@
///
/// This class represents features that are visible as points.
///
- public class MapPointData : FeatureBasedMapData
+ public class MapPointData : FeatureBasedMapData
{
///
/// Creates a new instance of with default styling.
@@ -51,7 +51,21 @@
/// null or only whitespace.
/// Thrown when
/// is null.
- public MapPointData(string name, PointStyle style) : base(name)
+ public MapPointData(string name, PointStyle style) : this(name, style, null) {}
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The name of the .
+ /// The default style of the data that is not categorized by the categories
+ /// defined in .
+ /// The map theme belong to the data.
+ /// Thrown when is
+ /// null or only whitespace.
+ /// Thrown when
+ /// is null.
+ public MapPointData(string name, PointStyle style, MapTheme mapTheme)
+ : base(name, mapTheme)
{
if (style == null)
{
@@ -67,11 +81,6 @@
public PointStyle Style { get; }
///
- /// Gets or sets the map theme of the .
- ///
- public MapTheme Theme { get; set; }
-
- ///
/// This method validates newly set features.
///
/// The new features to validate.
Index: Core/Components/src/Core.Components.Gis/Data/MapPolygonData.cs
===================================================================
diff -u -rabc02e9330166ed14bdbbb095424ffc9e79a11b8 -r2f5fc74d129a8b1c3410c3d256f33f84a26e8dfd
--- Core/Components/src/Core.Components.Gis/Data/MapPolygonData.cs (.../MapPolygonData.cs) (revision abc02e9330166ed14bdbbb095424ffc9e79a11b8)
+++ Core/Components/src/Core.Components.Gis/Data/MapPolygonData.cs (.../MapPolygonData.cs) (revision 2f5fc74d129a8b1c3410c3d256f33f84a26e8dfd)
@@ -32,7 +32,7 @@
///
/// This class represents features that form a closed area.
///
- public class MapPolygonData : FeatureBasedMapData
+ public class MapPolygonData : FeatureBasedMapData
{
///
/// Creates a new instance of with default styling.
@@ -51,7 +51,20 @@
/// null or only whitespace.
/// Thrown when
/// is null.
- public MapPolygonData(string name, PolygonStyle style) : base(name)
+ public MapPolygonData(string name, PolygonStyle style) : this(name, style, null) {}
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The name of the .
+ /// The default style of the data that is not categorized by the categories
+ /// defined in .
+ /// The map theme belong to the data.
+ /// Thrown when is
+ /// null or only whitespace.
+ /// Thrown when
+ /// is null.
+ public MapPolygonData(string name, PolygonStyle style, MapTheme mapTheme) : base(name, mapTheme)
{
if (style == null)
{
@@ -67,11 +80,6 @@
public PolygonStyle Style { get; }
///
- /// Gets or sets the map theme of the .
- ///
- public MapTheme Theme { get; set; }
-
- ///
/// This method validates newly set features.
///
/// The new features to validate.
Index: Core/Components/test/Core.Components.Gis.Test/Data/MapLineDataTest.cs
===================================================================
diff -u -rabc02e9330166ed14bdbbb095424ffc9e79a11b8 -r2f5fc74d129a8b1c3410c3d256f33f84a26e8dfd
--- Core/Components/test/Core.Components.Gis.Test/Data/MapLineDataTest.cs (.../MapLineDataTest.cs) (revision abc02e9330166ed14bdbbb095424ffc9e79a11b8)
+++ Core/Components/test/Core.Components.Gis.Test/Data/MapLineDataTest.cs (.../MapLineDataTest.cs) (revision 2f5fc74d129a8b1c3410c3d256f33f84a26e8dfd)
@@ -29,6 +29,8 @@
using Core.Components.Gis.Features;
using Core.Components.Gis.Geometries;
using Core.Components.Gis.Style;
+using Core.Components.Gis.TestUtil;
+using Core.Components.Gis.Theme;
using NUnit.Framework;
namespace Core.Components.Gis.Test.Data
@@ -37,7 +39,7 @@
public class MapLineDataTest
{
[Test]
- public void Constructor_ValidName_NameAndDefaultValuesSet()
+ public void Constructor_WithValidName_ExpectedValues()
{
// Setup
const string name = "test data";
@@ -48,7 +50,7 @@
// Assert
Assert.AreEqual(name, data.Name);
CollectionAssert.IsEmpty(data.Features);
- Assert.IsInstanceOf(data);
+ Assert.IsInstanceOf>(data);
Assert.AreEqual(Color.Black, data.Style.Color);
Assert.AreEqual(2, data.Style.Width);
Assert.AreEqual(LineDashStyle.Solid, data.Style.DashStyle);
@@ -106,17 +108,61 @@
};
// Call
- var data = new MapLineData("test data", style);
+ var data = new MapLineData(name, style);
// Assert
Assert.AreEqual(name, data.Name);
CollectionAssert.IsEmpty(data.Features);
- Assert.IsInstanceOf(data);
Assert.AreSame(style, data.Style);
Assert.IsNull(data.Theme);
}
[Test]
+ public void Constructor_StyleNullAndWithMapTheme_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new MapLineData("test data",
+ null,
+ new MapTheme("attribute", new[]
+ {
+ new LineCategoryTheme(ValueCriterionTestFactory.CreateValueCriterion(),
+ new LineStyle())
+ }));
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("style", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_WithStyleAndMapTheme_ExpectedValues()
+ {
+ // Setup
+ const string name = "test data";
+ var style = new LineStyle
+ {
+ Color = Color.Red,
+ Width = 5,
+ DashStyle = LineDashStyle.Dash
+ };
+
+ var mapTheme = new MapTheme("attribute", new[]
+ {
+ new LineCategoryTheme(ValueCriterionTestFactory.CreateValueCriterion(),
+ new LineStyle())
+ });
+
+ // Call
+ var data = new MapLineData(name, style, mapTheme);
+
+ // Assert
+ Assert.AreEqual(name, data.Name);
+ CollectionAssert.IsEmpty(data.Features);
+ Assert.AreSame(style, data.Style);
+ Assert.AreSame(mapTheme, data.Theme);
+ }
+
+ [Test]
public void Features_SetValidNewValue_GetsNewValue()
{
// Setup
Index: Core/Components/test/Core.Components.Gis.Test/Data/MapPointDataTest.cs
===================================================================
diff -u -rabc02e9330166ed14bdbbb095424ffc9e79a11b8 -r2f5fc74d129a8b1c3410c3d256f33f84a26e8dfd
--- Core/Components/test/Core.Components.Gis.Test/Data/MapPointDataTest.cs (.../MapPointDataTest.cs) (revision abc02e9330166ed14bdbbb095424ffc9e79a11b8)
+++ Core/Components/test/Core.Components.Gis.Test/Data/MapPointDataTest.cs (.../MapPointDataTest.cs) (revision 2f5fc74d129a8b1c3410c3d256f33f84a26e8dfd)
@@ -29,6 +29,8 @@
using Core.Components.Gis.Features;
using Core.Components.Gis.Geometries;
using Core.Components.Gis.Style;
+using Core.Components.Gis.TestUtil;
+using Core.Components.Gis.Theme;
using NUnit.Framework;
namespace Core.Components.Gis.Test.Data
@@ -37,7 +39,7 @@
public class MapPointDataTest
{
[Test]
- public void Constructor_ValidName_NameAndDefaultValuesSet()
+ public void Constructor_WithValidName_ExpectedValues()
{
// Setup
const string name = "test data";
@@ -48,7 +50,7 @@
// Assert
Assert.AreEqual(name, data.Name);
CollectionAssert.IsEmpty(data.Features);
- Assert.IsInstanceOf(data);
+ Assert.IsInstanceOf>(data);
Assert.AreEqual(Color.Black, data.Style.Color);
Assert.AreEqual(2, data.Style.Size);
Assert.AreEqual(PointSymbol.Square, data.Style.Symbol);
@@ -116,12 +118,59 @@
// Assert
Assert.AreEqual(name, data.Name);
CollectionAssert.IsEmpty(data.Features);
- Assert.IsInstanceOf(data);
Assert.AreSame(style, data.Style);
Assert.IsNull(data.Theme);
}
[Test]
+ public void Constructor_StyleNullAndWithMapTheme_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new MapPointData("test data",
+ null,
+ new MapTheme("attribute", new[]
+ {
+ new PointCategoryTheme(ValueCriterionTestFactory.CreateValueCriterion(),
+ new PointStyle())
+ }));
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("style", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_WithStyleAndMapTheme_ExpectedValues()
+ {
+ // Setup
+ const string name = "test data";
+ Color color = Color.Aqua;
+ var style = new PointStyle
+ {
+ Color = color,
+ Size = 3,
+ Symbol = PointSymbol.Circle,
+ StrokeColor = color,
+ StrokeThickness = 1
+ };
+
+ var mapTheme = new MapTheme("attribute", new[]
+ {
+ new PointCategoryTheme(ValueCriterionTestFactory.CreateValueCriterion(),
+ new PointStyle())
+ });
+
+ // Call
+ var data = new MapPointData(name, style, mapTheme);
+
+ // Assert
+ Assert.AreEqual(name, data.Name);
+ CollectionAssert.IsEmpty(data.Features);
+ Assert.AreSame(style, data.Style);
+ Assert.AreSame(mapTheme, data.Theme);
+ }
+
+ [Test]
public void Features_SetValidNewValue_GetsNewValue()
{
// Setup
Index: Core/Components/test/Core.Components.Gis.Test/Data/MapPolygonDataTest.cs
===================================================================
diff -u -rabc02e9330166ed14bdbbb095424ffc9e79a11b8 -r2f5fc74d129a8b1c3410c3d256f33f84a26e8dfd
--- Core/Components/test/Core.Components.Gis.Test/Data/MapPolygonDataTest.cs (.../MapPolygonDataTest.cs) (revision abc02e9330166ed14bdbbb095424ffc9e79a11b8)
+++ Core/Components/test/Core.Components.Gis.Test/Data/MapPolygonDataTest.cs (.../MapPolygonDataTest.cs) (revision 2f5fc74d129a8b1c3410c3d256f33f84a26e8dfd)
@@ -29,6 +29,8 @@
using Core.Components.Gis.Features;
using Core.Components.Gis.Geometries;
using Core.Components.Gis.Style;
+using Core.Components.Gis.TestUtil;
+using Core.Components.Gis.Theme;
using NUnit.Framework;
namespace Core.Components.Gis.Test.Data
@@ -48,7 +50,7 @@
// Assert
Assert.AreEqual(name, data.Name);
CollectionAssert.IsEmpty(data.Features);
- Assert.IsInstanceOf(data);
+ Assert.IsInstanceOf>(data);
Assert.AreEqual(Color.DarkGray, data.Style.FillColor);
Assert.AreEqual(Color.Black, data.Style.StrokeColor);
Assert.AreEqual(2, data.Style.StrokeThickness);
@@ -111,11 +113,56 @@
// Assert
Assert.AreEqual(name, data.Name);
CollectionAssert.IsEmpty(data.Features);
- Assert.IsInstanceOf(data);
Assert.AreSame(style, data.Style);
+ Assert.IsNull(data.Theme);
}
[Test]
+ public void Constructor_StyleNullAndWithMapTheme_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new MapPointData("test data",
+ null,
+ new MapTheme("attribute", new[]
+ {
+ new PointCategoryTheme(ValueCriterionTestFactory.CreateValueCriterion(),
+ new PointStyle())
+ }));
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("style", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_WithStyleAndMapTheme_ExpectedValues()
+ {
+ // Setup
+ const string name = "test data";
+ var style = new PolygonStyle
+ {
+ FillColor = Color.Aqua,
+ StrokeColor = Color.DarkGoldenrod,
+ StrokeThickness = 3
+ };
+
+ var mapTheme = new MapTheme("attribute", new[]
+ {
+ new PolygonCategoryTheme(ValueCriterionTestFactory.CreateValueCriterion(),
+ new PolygonStyle())
+ });
+
+ // Call
+ var data = new MapPolygonData(name, style, mapTheme);
+
+ // Assert
+ Assert.AreEqual(name, data.Name);
+ CollectionAssert.IsEmpty(data.Features);
+ Assert.AreSame(style, data.Style);
+ Assert.AreSame(mapTheme, data.Theme);
+ }
+
+ [Test]
public void Features_SetValidNewValue_GetsNewValue()
{
// Setup