Index: Core/Components/src/Core.Components.Gis/Core.Components.Gis.csproj
===================================================================
diff -u -r03b2b2080feb05e11d65b29a02760dcdd2651b6e -r205d6bacdfb7da4a3f96e65cf4392135323ebd8d
--- Core/Components/src/Core.Components.Gis/Core.Components.Gis.csproj (.../Core.Components.Gis.csproj) (revision 03b2b2080feb05e11d65b29a02760dcdd2651b6e)
+++ Core/Components/src/Core.Components.Gis/Core.Components.Gis.csproj (.../Core.Components.Gis.csproj) (revision 205d6bacdfb7da4a3f96e65cf4392135323ebd8d)
@@ -12,13 +12,13 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -78,7 +78,5 @@
Designer
-
-
-
+
\ No newline at end of file
Fisheye: Tag 205d6bacdfb7da4a3f96e65cf4392135323ebd8d refers to a dead (removed) revision in file `Core/Components/src/Core.Components.Gis/Data/Categories/IMapCategory.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 205d6bacdfb7da4a3f96e65cf4392135323ebd8d refers to a dead (removed) revision in file `Core/Components/src/Core.Components.Gis/Data/Categories/IMapCriteria.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 205d6bacdfb7da4a3f96e65cf4392135323ebd8d refers to a dead (removed) revision in file `Core/Components/src/Core.Components.Gis/Data/Categories/RangeCriteria.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 205d6bacdfb7da4a3f96e65cf4392135323ebd8d refers to a dead (removed) revision in file `Core/Components/src/Core.Components.Gis/Data/Categories/RangeCriteriaOperator.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 205d6bacdfb7da4a3f96e65cf4392135323ebd8d refers to a dead (removed) revision in file `Core/Components/src/Core.Components.Gis/Data/Categories/ValueCriteria.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 205d6bacdfb7da4a3f96e65cf4392135323ebd8d refers to a dead (removed) revision in file `Core/Components/src/Core.Components.Gis/Data/Categories/ValueCriteriaOperator.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Core/Components/src/Core.Components.Gis/Data/FeatureBasedMapData.cs
===================================================================
diff -u -r07c2c40e502eaac198c2cd661f16ef5f7be9da65 -r205d6bacdfb7da4a3f96e65cf4392135323ebd8d
--- Core/Components/src/Core.Components.Gis/Data/FeatureBasedMapData.cs (.../FeatureBasedMapData.cs) (revision 07c2c40e502eaac198c2cd661f16ef5f7be9da65)
+++ Core/Components/src/Core.Components.Gis/Data/FeatureBasedMapData.cs (.../FeatureBasedMapData.cs) (revision 205d6bacdfb7da4a3f96e65cf4392135323ebd8d)
@@ -23,6 +23,7 @@
using System.Collections.Generic;
using System.Linq;
using Core.Components.Gis.Features;
+using Core.Components.Gis.Themes;
namespace Core.Components.Gis.Data
{
Fisheye: Tag 205d6bacdfb7da4a3f96e65cf4392135323ebd8d refers to a dead (removed) revision in file `Core/Components/src/Core.Components.Gis/Data/MapTheme.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Core/Components/src/Core.Components.Gis/Theme/Criteria/IMapCriteria.cs
===================================================================
diff -u
--- Core/Components/src/Core.Components.Gis/Theme/Criteria/IMapCriteria.cs (revision 0)
+++ Core/Components/src/Core.Components.Gis/Theme/Criteria/IMapCriteria.cs (revision 205d6bacdfb7da4a3f96e65cf4392135323ebd8d)
@@ -0,0 +1,25 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+namespace Core.Components.Gis.Theme.Criteria
+{
+ public interface IMapCriteria {}
+}
\ No newline at end of file
Index: Core/Components/src/Core.Components.Gis/Theme/Criteria/RangeCriteria.cs
===================================================================
diff -u
--- Core/Components/src/Core.Components.Gis/Theme/Criteria/RangeCriteria.cs (revision 0)
+++ Core/Components/src/Core.Components.Gis/Theme/Criteria/RangeCriteria.cs (revision 205d6bacdfb7da4a3f96e65cf4392135323ebd8d)
@@ -0,0 +1,78 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.ComponentModel;
+
+namespace Core.Components.Gis.Theme.Criteria
+{
+ ///
+ /// Criteria which can be used to specifiy ranges.
+ ///
+ public class RangeCriteria : IMapCriteria
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ ///
+ /// The lower bound of the range.
+ /// The upper bound of the range.
+ /// Thrown when
+ /// contains an invalid value for .
+ /// Thrown when is
+ /// larger or equal to the .
+ public RangeCriteria(RangeCriteriaOperator rangeCriteriaOperator,
+ double lowerBound,
+ double upperBound)
+ {
+ if (!Enum.IsDefined(typeof(RangeCriteriaOperator), rangeCriteriaOperator))
+ {
+ throw new InvalidEnumArgumentException(nameof(rangeCriteriaOperator),
+ (int) rangeCriteriaOperator,
+ typeof(RangeCriteriaOperator));
+ }
+
+ if (lowerBound >= upperBound)
+ {
+ throw new ArgumentException(@"Lower bound cannot be larger or equal than upper bound.", nameof(lowerBound));
+ }
+
+ RangeCriteriaOperator = rangeCriteriaOperator;
+ LowerBound = lowerBound;
+ UpperBound = upperBound;
+ }
+
+ ///
+ /// Gets the operator for the .
+ ///
+ public RangeCriteriaOperator RangeCriteriaOperator { get; }
+
+ ///
+ /// Gets the lower bound of the range.
+ ///
+ public double LowerBound { get; }
+
+ ///
+ /// Gets the upper bound of the range.
+ ///
+ public double UpperBound { get; }
+ }
+}
\ No newline at end of file
Index: Core/Components/src/Core.Components.Gis/Theme/Criteria/RangeCriteriaOperator.cs
===================================================================
diff -u
--- Core/Components/src/Core.Components.Gis/Theme/Criteria/RangeCriteriaOperator.cs (revision 0)
+++ Core/Components/src/Core.Components.Gis/Theme/Criteria/RangeCriteriaOperator.cs (revision 205d6bacdfb7da4a3f96e65cf4392135323ebd8d)
@@ -0,0 +1,49 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+namespace Core.Components.Gis.Theme.Criteria
+{
+ ///
+ /// Defines the operators of the range criteria operator.
+ ///
+ public enum RangeCriteriaOperator
+ {
+ ///
+ /// Represents an interval: Lower bound <= X <= Upper bound
+ ///
+ AllBoundsInclusive = 1,
+
+ ///
+ /// Represents an interval: Lower bound <= X < Upper bound
+ ///
+ LowerBoundInclusive = 2,
+
+ ///
+ /// Represents an interval: Lower bound < X <= Upper bound
+ ///
+ UpperBoundInclusive = 3,
+
+ ///
+ /// Represents an interval: Lower bound < X < Upper bound
+ ///
+ AllBoundsExclusive = 4
+ }
+}
\ No newline at end of file
Index: Core/Components/src/Core.Components.Gis/Theme/Criteria/ValueCriteria.cs
===================================================================
diff -u
--- Core/Components/src/Core.Components.Gis/Theme/Criteria/ValueCriteria.cs (revision 0)
+++ Core/Components/src/Core.Components.Gis/Theme/Criteria/ValueCriteria.cs (revision 205d6bacdfb7da4a3f96e65cf4392135323ebd8d)
@@ -0,0 +1,62 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.ComponentModel;
+
+namespace Core.Components.Gis.Theme.Criteria
+{
+ ///
+ /// Criteria to be used for equal or unequal values.
+ ///
+ public class ValueCriteria : IMapCriteria
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The belonging to this criteria.
+ /// The value to apply when using this criteria.
+ /// Thrown when
+ /// contains an invalid value for .
+ public ValueCriteria(ValueCriteriaOperator valueOperator, double value)
+ {
+ if (!Enum.IsDefined(typeof(ValueCriteriaOperator), valueOperator))
+ {
+ throw new InvalidEnumArgumentException(nameof(valueOperator),
+ (int) valueOperator,
+ typeof(ValueCriteriaOperator));
+ }
+
+ ValueOperator = valueOperator;
+ Value = value;
+ }
+
+ ///
+ /// Gets the operator for the criteria.
+ ///
+ public ValueCriteriaOperator ValueOperator { get; }
+
+ ///
+ /// Gets the value that belongs to the criteria.
+ ///
+ public double Value { get; }
+ }
+}
\ No newline at end of file
Index: Core/Components/src/Core.Components.Gis/Theme/Criteria/ValueCriteriaOperator.cs
===================================================================
diff -u
--- Core/Components/src/Core.Components.Gis/Theme/Criteria/ValueCriteriaOperator.cs (revision 0)
+++ Core/Components/src/Core.Components.Gis/Theme/Criteria/ValueCriteriaOperator.cs (revision 205d6bacdfb7da4a3f96e65cf4392135323ebd8d)
@@ -0,0 +1,39 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+namespace Core.Components.Gis.Theme.Criteria
+{
+ ///
+ /// Defines the operators of an equality based criterion.
+ ///
+ public enum ValueCriteriaOperator
+ {
+ ///
+ /// Represents the operator '=='
+ ///
+ EqualValue = 1,
+
+ ///
+ /// Represents the operator '!='
+ ///
+ UnequalValue = 2
+ }
+}
\ No newline at end of file
Index: Core/Components/src/Core.Components.Gis/Theme/IMapCategory.cs
===================================================================
diff -u
--- Core/Components/src/Core.Components.Gis/Theme/IMapCategory.cs (revision 0)
+++ Core/Components/src/Core.Components.Gis/Theme/IMapCategory.cs (revision 205d6bacdfb7da4a3f96e65cf4392135323ebd8d)
@@ -0,0 +1,43 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System.Collections.Generic;
+using System.Drawing;
+using Core.Components.Gis.Theme.Criteria;
+
+namespace Core.Components.Gis.Theme
+{
+ ///
+ /// Interface for map categories.
+ ///
+ public interface IMapCategory // TODO: IThemeCategory --> make concrete class?
+ {
+ ///
+ /// The color of the map category.
+ ///
+ Color Color { get; }
+
+ ///
+ /// The criteria that is associated with the map category.
+ ///
+ IEnumerable Criteria { get; } // TODO: IThemeCriteria
+ }
+}
\ No newline at end of file
Index: Core/Components/src/Core.Components.Gis/Theme/MapTheme.cs
===================================================================
diff -u
--- Core/Components/src/Core.Components.Gis/Theme/MapTheme.cs (revision 0)
+++ Core/Components/src/Core.Components.Gis/Theme/MapTheme.cs (revision 205d6bacdfb7da4a3f96e65cf4392135323ebd8d)
@@ -0,0 +1,75 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Core.Components.Gis.Theme;
+
+namespace Core.Components.Gis.Themes
+{
+ ///
+ /// Class that contains the definition for a categorial theming of
+ /// map data objects.
+ ///
+ public class MapTheme
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The name of the attribute to which the theme is applicable for.
+ /// The map categories that are applicable for the theme.
+ /// Thrown when is null.
+ /// Thrown when:
+ ///
+ /// - is null, empty or consists of only whitespace.
+ /// - is empty.
+ ///
+ public MapTheme(string attributeName, IEnumerable mapCategories)
+ {
+ if (string.IsNullOrWhiteSpace(attributeName))
+ {
+ throw new ArgumentException(@"AttributeName is null, empty or consists of whitespace.", nameof(attributeName));
+ }
+ if (mapCategories == null)
+ {
+ throw new ArgumentNullException(nameof(mapCategories));
+ }
+ if (!mapCategories.Any())
+ {
+ throw new ArgumentException(@"MapCategories is empty.", nameof(mapCategories));
+ }
+
+ MapCategories = mapCategories;
+ AttributeName = attributeName;
+ }
+
+ ///
+ /// Gets the attribute to which the theme applies to.
+ ///
+ public string AttributeName { get; }
+
+ ///
+ /// Gets the categories that are applicable for the theme.
+ ///
+ public IEnumerable MapCategories { get; }
+ }
+}
\ No newline at end of file
Index: Core/Components/test/Core.Components.Gis.Test/Core.Components.Gis.Test.csproj
===================================================================
diff -u -r03b2b2080feb05e11d65b29a02760dcdd2651b6e -r205d6bacdfb7da4a3f96e65cf4392135323ebd8d
--- Core/Components/test/Core.Components.Gis.Test/Core.Components.Gis.Test.csproj (.../Core.Components.Gis.Test.csproj) (revision 03b2b2080feb05e11d65b29a02760dcdd2651b6e)
+++ Core/Components/test/Core.Components.Gis.Test/Core.Components.Gis.Test.csproj (.../Core.Components.Gis.Test.csproj) (revision 205d6bacdfb7da4a3f96e65cf4392135323ebd8d)
@@ -19,9 +19,9 @@
-
-
-
+
+
+
Fisheye: Tag 205d6bacdfb7da4a3f96e65cf4392135323ebd8d refers to a dead (removed) revision in file `Core/Components/test/Core.Components.Gis.Test/Data/Categories/RangeCriteriaTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 205d6bacdfb7da4a3f96e65cf4392135323ebd8d refers to a dead (removed) revision in file `Core/Components/test/Core.Components.Gis.Test/Data/Categories/ValueCriteriaTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 205d6bacdfb7da4a3f96e65cf4392135323ebd8d refers to a dead (removed) revision in file `Core/Components/test/Core.Components.Gis.Test/Data/MapThemeTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Core/Components/test/Core.Components.Gis.Test/Themes/Criteria/RangeCriteriaTest.cs
===================================================================
diff -u
--- Core/Components/test/Core.Components.Gis.Test/Themes/Criteria/RangeCriteriaTest.cs (revision 0)
+++ Core/Components/test/Core.Components.Gis.Test/Themes/Criteria/RangeCriteriaTest.cs (revision 205d6bacdfb7da4a3f96e65cf4392135323ebd8d)
@@ -0,0 +1,85 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.ComponentModel;
+using Core.Common.TestUtil;
+using Core.Components.Gis.Theme.Criteria;
+using NUnit.Framework;
+
+namespace Core.Components.Gis.Test.Themes.Criteria
+{
+ [TestFixture]
+ public class RangeCriteriaTest
+ {
+ [Test]
+ public void Constructor_ValidArguments_ReturnsExpectedValues()
+ {
+ // Setup
+ var random = new Random(21);
+
+ var rangeCriteriaOperator = random.NextEnumValue();
+ double lowerBound = random.NextDouble();
+ double upperBound = 1 + random.NextDouble();
+
+ // Call
+ var criteria = new RangeCriteria(rangeCriteriaOperator, lowerBound, upperBound);
+
+ // Assert
+ Assert.IsInstanceOf(criteria);
+ Assert.AreEqual(rangeCriteriaOperator, criteria.RangeCriteriaOperator);
+ Assert.AreEqual(lowerBound, criteria.LowerBound);
+ Assert.AreEqual(upperBound, criteria.UpperBound);
+ }
+
+ [Test]
+ public void Constructor_InvalidRangeCriteriaOperator_ThrownInvalidEnumArgumentException()
+ {
+ // Setup
+ var random = new Random(21);
+ const RangeCriteriaOperator invalidOperator = (RangeCriteriaOperator) 99999;
+
+ // Call
+ TestDelegate call = () => new RangeCriteria(invalidOperator, random.NextDouble(), random.NextDouble());
+
+ // Assert
+ string expectedMessage = $"The value of argument 'rangeCriteriaOperator' ({invalidOperator}) is invalid for Enum type '{nameof(RangeCriteriaOperator)}'.";
+ string parameterName = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage).ParamName;
+ Assert.AreEqual("rangeCriteriaOperator", parameterName);
+ }
+
+ [Test]
+ [TestCase(10, 10)]
+ [TestCase(11, 10)]
+ public void Constructor_InvalidLowerBound_ThrowsArgumentException(double lowerBound, double upperBound)
+ {
+ // Setup
+ var random = new Random(21);
+
+ // Call
+ TestDelegate call = () => new RangeCriteria(random.NextEnumValue(), lowerBound, upperBound);
+
+ // Assert
+ const string expectedMessage = "Lower bound cannot be larger or equal than upper bound.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage);
+ }
+ }
+}
\ No newline at end of file
Index: Core/Components/test/Core.Components.Gis.Test/Themes/Criteria/ValueCriteriaTest.cs
===================================================================
diff -u
--- Core/Components/test/Core.Components.Gis.Test/Themes/Criteria/ValueCriteriaTest.cs (revision 0)
+++ Core/Components/test/Core.Components.Gis.Test/Themes/Criteria/ValueCriteriaTest.cs (revision 205d6bacdfb7da4a3f96e65cf4392135323ebd8d)
@@ -0,0 +1,66 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.ComponentModel;
+using Core.Common.TestUtil;
+using Core.Components.Gis.Theme.Criteria;
+using NUnit.Framework;
+
+namespace Core.Components.Gis.Test.Themes.Criteria
+{
+ [TestFixture]
+ public class ValueCriteriaTest
+ {
+ [Test]
+ public void Constructor_ReturnsExpectedProperties()
+ {
+ // Setup
+ var random = new Random(21);
+ var valueOperator = random.NextEnumValue();
+ double value = random.NextDouble();
+
+ // Call
+ var criteria = new ValueCriteria(valueOperator, value);
+
+ // Assert
+ Assert.IsInstanceOf(criteria);
+ Assert.AreEqual(valueOperator, criteria.ValueOperator);
+ Assert.AreEqual(value, criteria.Value);
+ }
+
+ [Test]
+ public void Constructor_InvalidEqualityBasedOperator_ThrowsInvalidEnumArgumentException()
+ {
+ // Setup
+ var random = new Random(21);
+ const ValueCriteriaOperator invalidOperator = (ValueCriteriaOperator) 9999;
+
+ // Call
+ TestDelegate call = () => new ValueCriteria(invalidOperator, random.NextDouble());
+
+ // Assert
+ string expectedMessage = $"The value of argument 'valueOperator' ({invalidOperator}) is invalid for Enum type '{nameof(ValueCriteriaOperator)}'.";
+ string parameterName = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage).ParamName;
+ Assert.AreEqual("valueOperator", parameterName);
+ }
+ }
+}
\ No newline at end of file
Index: Core/Components/test/Core.Components.Gis.Test/Themes/MapThemeTest.cs
===================================================================
diff -u
--- Core/Components/test/Core.Components.Gis.Test/Themes/MapThemeTest.cs (revision 0)
+++ Core/Components/test/Core.Components.Gis.Test/Themes/MapThemeTest.cs (revision 205d6bacdfb7da4a3f96e65cf4392135323ebd8d)
@@ -0,0 +1,107 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Core.Common.TestUtil;
+using Core.Components.Gis.Theme;
+using Core.Components.Gis.Themes;
+using NUnit.Framework;
+using Rhino.Mocks;
+
+namespace Core.Components.Gis.Test.Themes
+{
+ [TestFixture]
+ public class MapThemeTest
+ {
+ [Test]
+ [TestCase(" ")]
+ [TestCase("")]
+ [TestCase(null)]
+ public void Constructor_InvalidAttribute_ThrowsArgumentException(string invalidAttributeName)
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var mapCategory = mocks.Stub();
+ mocks.ReplayAll();
+
+ // Call
+ TestDelegate call = () => new MapTheme(invalidAttributeName, new []
+ {
+ mapCategory
+ });
+
+ // Assert
+ const string expectedMessage = "AttributeName is null, empty or consists of whitespace.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_MapCategoriesNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new MapTheme("Arbitrary attribute", null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("mapCategories", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_MapCategoriesEmpty_ThrowsArgumentException()
+ {
+ // Setup
+ IEnumerable mapCategories = Enumerable.Empty();
+
+ // Call
+ TestDelegate call = () => new MapTheme("Arbitrary attribute", mapCategories);
+
+ // Assert
+ const string expectedMessage = "MapCategories is empty.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage);
+ }
+
+ [Test]
+ public void Constructor_ValidArguments_SetsExpectedValues()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var mapCategory = mocks.Stub();
+ mocks.ReplayAll();
+
+ const string attributeName = "Arbitrary attribute";
+ var mapCategories = new[]
+ {
+ mapCategory
+ };
+
+ // Call
+ var theme = new MapTheme(attributeName, mapCategories);
+
+ // Assert
+ Assert.AreEqual(attributeName, theme.AttributeName);
+ Assert.AreSame(mapCategories, theme.MapCategories);
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file