Index: Core/Components/src/Core.Components.Gis/Theme/CategoryTheme.cs
===================================================================
diff -u -r3c41a03f6a1173872af5d8507465e291f9e3f8f2 -r0eefe4fd03e9a34a58295a2f94705597189df4cd
--- Core/Components/src/Core.Components.Gis/Theme/CategoryTheme.cs (.../CategoryTheme.cs) (revision 3c41a03f6a1173872af5d8507465e291f9e3f8f2)
+++ Core/Components/src/Core.Components.Gis/Theme/CategoryTheme.cs (.../CategoryTheme.cs) (revision 0eefe4fd03e9a34a58295a2f94705597189df4cd)
@@ -20,7 +20,6 @@
// All rights reserved.
using System;
-using System.Collections.Generic;
using System.Drawing;
using Core.Components.Gis.Theme.Criteria;
@@ -29,7 +28,7 @@
///
/// Class to define themes for categories.
///
- public class CategoryTheme
+ public class CategoryTheme
{
///
/// Creates a new instance of .
@@ -57,6 +56,6 @@
///
/// Gets the criteria that is associated with the category theme.
///
- public ICriteria Criteria { get; }
+ public ICriteria Criteria { get; }
}
}
\ No newline at end of file
Index: Core/Components/src/Core.Components.Gis/Theme/Criteria/ICriteria.cs
===================================================================
diff -u -r49fc59dc9e08d2601389edb8b62aea031daeafba -r0eefe4fd03e9a34a58295a2f94705597189df4cd
--- Core/Components/src/Core.Components.Gis/Theme/Criteria/ICriteria.cs (.../ICriteria.cs) (revision 49fc59dc9e08d2601389edb8b62aea031daeafba)
+++ Core/Components/src/Core.Components.Gis/Theme/Criteria/ICriteria.cs (.../ICriteria.cs) (revision 0eefe4fd03e9a34a58295a2f94705597189df4cd)
@@ -21,5 +21,8 @@
namespace Core.Components.Gis.Theme.Criteria
{
+ ///
+ /// Interface for criteria to apply to classify data.
+ ///
public interface ICriteria {}
}
\ No newline at end of file
Index: Core/Components/test/Core.Components.Gis.Test/Core.Components.Gis.Test.csproj
===================================================================
diff -u -r3c41a03f6a1173872af5d8507465e291f9e3f8f2 -r0eefe4fd03e9a34a58295a2f94705597189df4cd
--- Core/Components/test/Core.Components.Gis.Test/Core.Components.Gis.Test.csproj (.../Core.Components.Gis.Test.csproj) (revision 3c41a03f6a1173872af5d8507465e291f9e3f8f2)
+++ Core/Components/test/Core.Components.Gis.Test/Core.Components.Gis.Test.csproj (.../Core.Components.Gis.Test.csproj) (revision 0eefe4fd03e9a34a58295a2f94705597189df4cd)
@@ -19,10 +19,10 @@
-
-
-
-
+
+
+
+
Index: Core/Components/test/Core.Components.Gis.Test/Theme/CategoryThemeTest.cs
===================================================================
diff -u
--- Core/Components/test/Core.Components.Gis.Test/Theme/CategoryThemeTest.cs (revision 0)
+++ Core/Components/test/Core.Components.Gis.Test/Theme/CategoryThemeTest.cs (revision 0eefe4fd03e9a34a58295a2f94705597189df4cd)
@@ -0,0 +1,70 @@
+// 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.Drawing;
+using Core.Common.TestUtil;
+using Core.Components.Gis.Theme;
+using Core.Components.Gis.Theme.Criteria;
+using NUnit.Framework;
+using Rhino.Mocks;
+
+namespace Core.Components.Gis.Test.Theme
+{
+ [TestFixture]
+ public class CategoryThemeTest
+ {
+ [Test]
+ public void Constructor_CriteriaNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var random = new Random(21);
+ Color themeColor = Color.FromKnownColor(random.NextEnumValue());
+
+ // Call
+ TestDelegate call = () => new CategoryTheme(themeColor, null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("criteria", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_ValidArguments_ReturnsExpectedProperties()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var criteria = mocks.Stub();
+ mocks.ReplayAll();
+
+ var random = new Random(21);
+ Color themeColor = Color.FromKnownColor(random.NextEnumValue());
+
+ // Call
+ var category = new CategoryTheme(themeColor, criteria);
+
+ // Assert
+ Assert.AreEqual(themeColor, category.Color);
+ Assert.AreSame(criteria, category.Criteria);
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Core/Components/test/Core.Components.Gis.Test/Theme/Criteria/RangeCriteriaTest.cs
===================================================================
diff -u
--- Core/Components/test/Core.Components.Gis.Test/Theme/Criteria/RangeCriteriaTest.cs (revision 0)
+++ Core/Components/test/Core.Components.Gis.Test/Theme/Criteria/RangeCriteriaTest.cs (revision 0eefe4fd03e9a34a58295a2f94705597189df4cd)
@@ -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.Theme.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/Theme/Criteria/ValueCriteriaTest.cs
===================================================================
diff -u
--- Core/Components/test/Core.Components.Gis.Test/Theme/Criteria/ValueCriteriaTest.cs (revision 0)
+++ Core/Components/test/Core.Components.Gis.Test/Theme/Criteria/ValueCriteriaTest.cs (revision 0eefe4fd03e9a34a58295a2f94705597189df4cd)
@@ -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.Theme.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/Theme/MapThemeTest.cs
===================================================================
diff -u
--- Core/Components/test/Core.Components.Gis.Test/Theme/MapThemeTest.cs (revision 0)
+++ Core/Components/test/Core.Components.Gis.Test/Theme/MapThemeTest.cs (revision 0eefe4fd03e9a34a58295a2f94705597189df4cd)
@@ -0,0 +1,95 @@
+// 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.TestUtil.Theme;
+using Core.Components.Gis.Theme;
+using NUnit.Framework;
+
+namespace Core.Components.Gis.Test.Theme
+{
+ [TestFixture]
+ public class MapThemeTest
+ {
+ [Test]
+ [TestCase(null)]
+ [TestCase("")]
+ [TestCase(" ")]
+ public void Constructor_InvalidAttribute_ThrowsArgumentException(string invalidAttributeName)
+ {
+ // Call
+ TestDelegate call = () => new MapTheme(invalidAttributeName, new[]
+ {
+ CategoryThemeTestFactory.CreateCategoryTheme()
+ });
+
+ // Assert
+ const string expectedMessage = "AttributeName is null, empty or consists of whitespace.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage);
+ }
+
+ [Test]
+ public void Constructor_CategoryThemesNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new MapTheme("Arbitrary attribute", null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("categoryThemes", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_CategoryThemesEmpty_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
+ const string attributeName = "Arbitrary attribute";
+ var mapCategories = new[]
+ {
+ CategoryThemeTestFactory.CreateCategoryTheme()
+ };
+
+ // Call
+ var theme = new MapTheme(attributeName, mapCategories);
+
+ // Assert
+ Assert.AreEqual(attributeName, theme.AttributeName);
+ Assert.AreSame(mapCategories, theme.CategoryThemes);
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 0eefe4fd03e9a34a58295a2f94705597189df4cd refers to a dead (removed) revision in file `Core/Components/test/Core.Components.Gis.Test/Themes/CategoryThemeTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 0eefe4fd03e9a34a58295a2f94705597189df4cd refers to a dead (removed) revision in file `Core/Components/test/Core.Components.Gis.Test/Themes/Criteria/RangeCriteriaTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 0eefe4fd03e9a34a58295a2f94705597189df4cd refers to a dead (removed) revision in file `Core/Components/test/Core.Components.Gis.Test/Themes/Criteria/ValueCriteriaTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 0eefe4fd03e9a34a58295a2f94705597189df4cd refers to a dead (removed) revision in file `Core/Components/test/Core.Components.Gis.Test/Themes/MapThemeTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?