Index: Core/Common/src/Core.Common.Utils/Reflection/TypeUtils.cs
===================================================================
diff -u -rb2b9fdf365e70928a05c57966eeed30d9050e528 -r4b32064801ece7ab70357a2a942e21f113abc679
--- Core/Common/src/Core.Common.Utils/Reflection/TypeUtils.cs (.../TypeUtils.cs) (revision b2b9fdf365e70928a05c57966eeed30d9050e528)
+++ Core/Common/src/Core.Common.Utils/Reflection/TypeUtils.cs (.../TypeUtils.cs) (revision 4b32064801ece7ab70357a2a942e21f113abc679)
@@ -24,6 +24,7 @@
using System.Globalization;
using System.Linq.Expressions;
using System.Reflection;
+using Core.Common.Utils.Attributes;
using Core.Common.Utils.Properties;
namespace Core.Common.Utils.Reflection
@@ -34,6 +35,27 @@
public static class TypeUtils
{
///
+ /// Gets the string representation of an enum value, taking
+ /// into account.
+ ///
+ /// The type of the enum.
+ /// The value of the enum.
+ /// The display name of the enum value.
+ public static string GetDisplayName(TEnumType enumValue) where TEnumType : IConvertible
+ {
+ string valueString = enumValue.ToString();
+ FieldInfo fieldInfo = typeof(TEnumType).GetField(valueString);
+ if (fieldInfo == null)
+ {
+ throw new InvalidEnumArgumentException(nameof(enumValue), Convert.ToInt32(enumValue), typeof(TEnumType));
+ }
+ var resourcesDisplayNameAttribute = (ResourcesDisplayNameAttribute)Attribute.GetCustomAttribute(fieldInfo, typeof(ResourcesDisplayNameAttribute));
+ return resourcesDisplayNameAttribute != null ?
+ resourcesDisplayNameAttribute.DisplayName :
+ valueString;
+ }
+
+ ///
/// Checks if a type implements, inherits from or is a certain other type.
///
/// The type to check for.
Index: Core/Common/test/Core.Common.TestUtil.Test/Core.Common.TestUtil.Test.csproj
===================================================================
diff -u -r888f6cdc81e8fb6d6a5b9baadf6395f209008836 -r4b32064801ece7ab70357a2a942e21f113abc679
--- Core/Common/test/Core.Common.TestUtil.Test/Core.Common.TestUtil.Test.csproj (.../Core.Common.TestUtil.Test.csproj) (revision 888f6cdc81e8fb6d6a5b9baadf6395f209008836)
+++ Core/Common/test/Core.Common.TestUtil.Test/Core.Common.TestUtil.Test.csproj (.../Core.Common.TestUtil.Test.csproj) (revision 4b32064801ece7ab70357a2a942e21f113abc679)
@@ -62,6 +62,7 @@
+
@@ -92,6 +93,10 @@
{30e4c2ae-719e-4d70-9fa9-668a9767fbfa}Core.Common.Gui
+
+ {f49bd8b2-332a-4c91-a196-8cce0a2c7d98}
+ Core.Common.Utils
+ {D749EE4C-CE50-4C17-BF01-9A953028C126}Core.Common.TestUtil
Index: Core/Common/test/Core.Common.TestUtil.Test/EnumTestFixtureTest.cs
===================================================================
diff -u
--- Core/Common/test/Core.Common.TestUtil.Test/EnumTestFixtureTest.cs (revision 0)
+++ Core/Common/test/Core.Common.TestUtil.Test/EnumTestFixtureTest.cs (revision 4b32064801ece7ab70357a2a942e21f113abc679)
@@ -0,0 +1,56 @@
+// 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.Common.TestUtil.Test.Properties;
+using Core.Common.Utils.Attributes;
+using NUnit.Framework;
+
+namespace Core.Common.TestUtil.Test
+{
+ [TestFixture]
+ public class EnumTestFixtureTest : EnumTestFixture
+ {
+ protected override IDictionary ExpectedDisplayNameForEnumValues
+ {
+ get
+ {
+ return new Dictionary
+ {
+ {
+ DisplayNameTestEnum.NoDisplayName, null
+ },
+ {
+ DisplayNameTestEnum.HasResourcesDisplayName, Resources.SomeDisplayName
+ }
+ };
+ }
+ }
+
+ public enum DisplayNameTestEnum
+ {
+ NoDisplayName,
+
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.SomeDisplayName))]
+ HasResourcesDisplayName
+ }
+ }
+}
\ No newline at end of file
Index: Core/Common/test/Core.Common.TestUtil.Test/Properties/Resources.Designer.cs
===================================================================
diff -u -rbb0308b863b1f9b65a349c4291e1d44944ebf805 -r4b32064801ece7ab70357a2a942e21f113abc679
--- Core/Common/test/Core.Common.TestUtil.Test/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision bb0308b863b1f9b65a349c4291e1d44944ebf805)
+++ Core/Common/test/Core.Common.TestUtil.Test/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 4b32064801ece7ab70357a2a942e21f113abc679)
@@ -110,5 +110,14 @@
return ((System.Drawing.Bitmap)(obj));
}
}
+
+ ///
+ /// Looks up a localized string similar to I'm a ResourcesDisplayName text.
+ ///
+ internal static string SomeDisplayName {
+ get {
+ return ResourceManager.GetString("SomeDisplayName", resourceCulture);
+ }
+ }
}
}
Index: Core/Common/test/Core.Common.TestUtil.Test/Properties/Resources.resx
===================================================================
diff -u -rbb0308b863b1f9b65a349c4291e1d44944ebf805 -r4b32064801ece7ab70357a2a942e21f113abc679
--- Core/Common/test/Core.Common.TestUtil.Test/Properties/Resources.resx (.../Resources.resx) (revision bb0308b863b1f9b65a349c4291e1d44944ebf805)
+++ Core/Common/test/Core.Common.TestUtil.Test/Properties/Resources.resx (.../Resources.resx) (revision 4b32064801ece7ab70357a2a942e21f113abc679)
@@ -127,4 +127,7 @@
..\Resources\double-abacus.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ I'm a ResourcesDisplayName text
+
\ No newline at end of file
Index: Core/Common/test/Core.Common.TestUtil/Core.Common.TestUtil.csproj
===================================================================
diff -u -rfa3b352bc1b1c01fc73a9a45268c5573807a6381 -r4b32064801ece7ab70357a2a942e21f113abc679
--- Core/Common/test/Core.Common.TestUtil/Core.Common.TestUtil.csproj (.../Core.Common.TestUtil.csproj) (revision fa3b352bc1b1c01fc73a9a45268c5573807a6381)
+++ Core/Common/test/Core.Common.TestUtil/Core.Common.TestUtil.csproj (.../Core.Common.TestUtil.csproj) (revision 4b32064801ece7ab70357a2a942e21f113abc679)
@@ -95,6 +95,7 @@
+
Index: Core/Common/test/Core.Common.TestUtil/EnumTestFixture.cs
===================================================================
diff -u
--- Core/Common/test/Core.Common.TestUtil/EnumTestFixture.cs (revision 0)
+++ Core/Common/test/Core.Common.TestUtil/EnumTestFixture.cs (revision 4b32064801ece7ab70357a2a942e21f113abc679)
@@ -0,0 +1,61 @@
+// 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.Linq;
+using System.Reflection;
+using Core.Common.Utils.Attributes;
+using NUnit.Framework;
+
+namespace Core.Common.TestUtil
+{
+ [TestFixture]
+ public abstract class EnumTestFixture
+ {
+ protected abstract IDictionary ExpectedDisplayNameForEnumValues { get; }
+
+ [Test]
+ public void DisplayName_Always_ReturnExpectedValues()
+ {
+ foreach (TEnumType value in Enum.GetValues(typeof(TEnumType)))
+ {
+ Assert.AreEqual(ExpectedDisplayNameForEnumValues[value], GetDisplayName(value),
+ $"Display name for {value} incorrect.");
+ }
+ }
+
+ private static string GetDisplayName(TEnumType value)
+ {
+ var type = typeof(TEnumType);
+ MemberInfo[] memInfo = type.GetMember(value.ToString());
+ object[] attributes = memInfo[0].GetCustomAttributes(typeof(ResourcesDisplayNameAttribute), false);
+ if (attributes.Length > 0)
+ {
+ return ((ResourcesDisplayNameAttribute) attributes[0]).DisplayName;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Core/Common/test/Core.Common.Utils.Test/Reflection/TypeUtilsTest.cs
===================================================================
diff -u -r4faae1433690b9b06b40c18ff322140aa16df739 -r4b32064801ece7ab70357a2a942e21f113abc679
--- Core/Common/test/Core.Common.Utils.Test/Reflection/TypeUtilsTest.cs (.../TypeUtilsTest.cs) (revision 4faae1433690b9b06b40c18ff322140aa16df739)
+++ Core/Common/test/Core.Common.Utils.Test/Reflection/TypeUtilsTest.cs (.../TypeUtilsTest.cs) (revision 4b32064801ece7ab70357a2a942e21f113abc679)
@@ -23,7 +23,10 @@
using System.ComponentModel;
using System.Linq.Expressions;
using System.Reflection;
+using Core.Common.TestUtil;
+using Core.Common.Utils.Attributes;
using Core.Common.Utils.Reflection;
+using Core.Common.Utils.Test.Properties;
using NUnit.Framework;
namespace Core.Common.Utils.Test.Reflection
@@ -32,6 +35,47 @@
public class TypeUtilsTest
{
[Test]
+ public void GetDisplayName_EnumWithoutResourcesAttribute_EnumToString()
+ {
+ // Setup
+ var value = TestEnum.NoDisplayName;
+
+ // Call
+ string result = TypeUtils.GetDisplayName(value);
+
+ // Assert
+ Assert.AreEqual(value.ToString(), result);
+ }
+
+ [Test]
+ public void GetDisplayName_EnumWithResourcesAttribute_ResourceText()
+ {
+ // Setup
+ var value = TestEnum.HasDisplayName;
+
+ // Call
+ string result = TypeUtils.GetDisplayName(value);
+
+ // Assert
+ Assert.AreEqual(Resources.EnumStringResource, result);
+ }
+
+ [Test]
+ public void GetDisplayName_ValueNotPartOfEnumMembers_ThrowInvalidEnumArgumentException()
+ {
+ // Setup
+ var value = (TestEnum) 999;
+
+ // Call
+ TestDelegate call = () => TypeUtils.GetDisplayName(value);
+
+ // Assert
+ var message = "The value of argument 'enumValue' (999) is invalid for Enum type 'TestEnum'.";
+ var exception = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, message);
+ Assert.AreEqual("enumValue", exception.ParamName);
+ }
+
+ [Test]
public void Implements_TypeNull_ThrowArgumentNullException()
{
// Call
@@ -578,6 +622,14 @@
Assert.IsTrue(hasTypeConverter);
}
+ private enum TestEnum
+ {
+ NoDisplayName,
+
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.EnumStringResource))]
+ HasDisplayName
+ }
+
private class TestClass
{
///
Index: Core/Components/src/Core.Components.Gis/Core.Components.Gis.csproj
===================================================================
diff -u -r3722e29f53ce7db0f11fb184cdc2a76d33078cf2 -r4b32064801ece7ab70357a2a942e21f113abc679
--- Core/Components/src/Core.Components.Gis/Core.Components.Gis.csproj (.../Core.Components.Gis.csproj) (revision 3722e29f53ce7db0f11fb184cdc2a76d33078cf2)
+++ Core/Components/src/Core.Components.Gis/Core.Components.Gis.csproj (.../Core.Components.Gis.csproj) (revision 4b32064801ece7ab70357a2a942e21f113abc679)
@@ -40,13 +40,16 @@
Properties\GlobalAssembly.cs
+
+
+
@@ -72,6 +75,11 @@
Core.Common.BaseFalse
+
+ {f49bd8b2-332a-4c91-a196-8cce0a2c7d98}
+ Core.Common.Utils
+ False
+
Index: Core/Components/src/Core.Components.Gis/Data/ImageBasedMapData.cs
===================================================================
diff -u
--- Core/Components/src/Core.Components.Gis/Data/ImageBasedMapData.cs (revision 0)
+++ Core/Components/src/Core.Components.Gis/Data/ImageBasedMapData.cs (revision 4b32064801ece7ab70357a2a942e21f113abc679)
@@ -0,0 +1,67 @@
+// 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.Common.Base.Data;
+using Core.Components.Gis.Properties;
+
+namespace Core.Components.Gis.Data
+{
+ ///
+ /// Abstract class for that depend on image data.
+ ///
+ public abstract class ImageBasedMapData : MapData
+ {
+ private RoundedDouble transparency;
+
+ ///
+ /// Initializes a new instance of with a given name.
+ ///
+ /// The name of the map data.
+ /// Thrown when is null or only whitespace.
+ protected ImageBasedMapData(string name) : base(name)
+ {
+ transparency = new RoundedDouble(2);
+ }
+
+ ///
+ /// Gets or sets the transparency of the map data.
+ ///
+ public RoundedDouble Transparency
+ {
+ get
+ {
+ return transparency;
+ }
+ set
+ {
+ var newValue = new RoundedDouble(transparency.NumberOfDecimalPlaces, value);
+ if (double.IsNaN(newValue) || newValue < 0.0 || newValue > 1.0)
+ {
+ throw new ArgumentOutOfRangeException(nameof(value),
+ Resources.ImageBasedMapData_Transparency_Value_must_be_in_zero_to_one_range);
+ }
+
+ transparency = newValue;
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Core/Components/src/Core.Components.Gis/Data/WellKnownTileSource.cs
===================================================================
diff -u
--- Core/Components/src/Core.Components.Gis/Data/WellKnownTileSource.cs (revision 0)
+++ Core/Components/src/Core.Components.Gis/Data/WellKnownTileSource.cs (revision 4b32064801ece7ab70357a2a942e21f113abc679)
@@ -0,0 +1,45 @@
+// 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 Core.Common.Utils.Attributes;
+using Core.Components.Gis.Properties;
+
+namespace Core.Components.Gis.Data
+{
+ ///
+ /// All tile sources for which built-in support is provided.
+ ///
+ public enum WellKnownTileSource
+ {
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.OpenStreetMap_DisplayName))]
+ OpenStreetMap,
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.BingAerial_DisplayName))]
+ BingAerial,
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.BingHybrid_DisplayName))]
+ BingHybrid,
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.BingRoads_DisplayName))]
+ BingRoads,
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.EsriWorldTopo_DisplayName))]
+ EsriWorldTopo,
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.EsriWorldShadedRelief_DisplayName))]
+ EsriWorldShadedRelief
+ }
+}
\ No newline at end of file
Index: Core/Components/src/Core.Components.Gis/Data/WellKnownTileSourceMapData.cs
===================================================================
diff -u
--- Core/Components/src/Core.Components.Gis/Data/WellKnownTileSourceMapData.cs (revision 0)
+++ Core/Components/src/Core.Components.Gis/Data/WellKnownTileSourceMapData.cs (revision 4b32064801ece7ab70357a2a942e21f113abc679)
@@ -0,0 +1,45 @@
+// 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.ComponentModel;
+using Core.Common.Utils.Reflection;
+
+namespace Core.Components.Gis.Data
+{
+ ///
+ /// Class for representing an map tile source that for which that is built-in support.
+ ///
+ public class WellKnownTileSourceMapData : ImageBasedMapData
+ {
+ ///
+ /// Initializes a new instance of .
+ ///
+ /// The tile source.
+ /// Thrown when
+ /// isn't a member of .
+ public WellKnownTileSourceMapData(WellKnownTileSource source) : base(TypeUtils.GetDisplayName(source))
+ {
+ TileSource = source;
+ }
+
+ public WellKnownTileSource TileSource { get; }
+ }
+}
\ No newline at end of file
Index: Core/Components/src/Core.Components.Gis/Data/WmtsMapData.cs
===================================================================
diff -u -rb41f4c465f094e91312ffd90174e765417b28ba9 -r4b32064801ece7ab70357a2a942e21f113abc679
--- Core/Components/src/Core.Components.Gis/Data/WmtsMapData.cs (.../WmtsMapData.cs) (revision b41f4c465f094e91312ffd90174e765417b28ba9)
+++ Core/Components/src/Core.Components.Gis/Data/WmtsMapData.cs (.../WmtsMapData.cs) (revision 4b32064801ece7ab70357a2a942e21f113abc679)
@@ -20,18 +20,15 @@
// All rights reserved.
using System;
-using Core.Common.Base.Data;
using Core.Components.Gis.Properties;
namespace Core.Components.Gis.Data
{
///
/// Class representing a mapdata coming from a Web Map Tile Service (WMTS).
///
- public class WmtsMapData : MapData
+ public class WmtsMapData : ImageBasedMapData
{
- private RoundedDouble transparency;
-
///
/// Creates a new instance of .
///
@@ -60,7 +57,6 @@
/// Thrown when is null or only whitespace.
private WmtsMapData(string name) : base(name)
{
- transparency = new RoundedDouble(2, 0.0);
IsVisible = false;
}
@@ -76,28 +72,6 @@
public string SelectedCapabilityIdentifier { get; private set; }
///
- /// Gets or sets the transparency of the map data.
- ///
- public RoundedDouble Transparency
- {
- get
- {
- return transparency;
- }
- set
- {
- var newValue = new RoundedDouble(transparency.NumberOfDecimalPlaces, value);
- if (double.IsNaN(newValue) || newValue < 0.0 || newValue > 1.0)
- {
- throw new ArgumentOutOfRangeException(nameof(value),
- Resources.WmtsMapData_Transparency_Value_must_be_in_zero_to_one_range);
- }
-
- transparency = newValue;
- }
- }
-
- ///
/// Gets a value indicating if the map data is configured to use a particular WMTS.
///
public bool IsConfigured { get; private set; }
Index: Core/Components/src/Core.Components.Gis/Properties/Resources.Designer.cs
===================================================================
diff -u -r3722e29f53ce7db0f11fb184cdc2a76d33078cf2 -r4b32064801ece7ab70357a2a942e21f113abc679
--- Core/Components/src/Core.Components.Gis/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 3722e29f53ce7db0f11fb184cdc2a76d33078cf2)
+++ Core/Components/src/Core.Components.Gis/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 4b32064801ece7ab70357a2a942e21f113abc679)
@@ -82,24 +82,78 @@
}
///
- /// Looks up a localized string similar to PDOK achtergrondkaart.
+ /// Looks up a localized string similar to Bing Maps - Satelliet.
///
- internal static string WmtsMapData_CreateDefaultPdokMapData_Name {
+ internal static string BingAerial_DisplayName {
get {
- return ResourceManager.GetString("WmtsMapData_CreateDefaultPdokMapData_Name", resourceCulture);
+ return ResourceManager.GetString("BingAerial_DisplayName", resourceCulture);
}
}
///
+ /// Looks up a localized string similar to Bing Maps - Satelliet + Wegen.
+ ///
+ internal static string BingHybrid_DisplayName {
+ get {
+ return ResourceManager.GetString("BingHybrid_DisplayName", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Bing Maps - Wegen.
+ ///
+ internal static string BingRoads_DisplayName {
+ get {
+ return ResourceManager.GetString("BingRoads_DisplayName", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Esri World - Reliëf.
+ ///
+ internal static string EsriWorldShadedRelief_DisplayName {
+ get {
+ return ResourceManager.GetString("EsriWorldShadedRelief_DisplayName", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Esri World - Topografisch.
+ ///
+ internal static string EsriWorldTopo_DisplayName {
+ get {
+ return ResourceManager.GetString("EsriWorldTopo_DisplayName", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to De transparantie moet in het bereik [0.0, 1.0] liggen..
///
- internal static string WmtsMapData_Transparency_Value_must_be_in_zero_to_one_range {
+ internal static string ImageBasedMapData_Transparency_Value_must_be_in_zero_to_one_range {
get {
- return ResourceManager.GetString("WmtsMapData_Transparency_Value_must_be_in_zero_to_one_range", resourceCulture);
+ return ResourceManager.GetString("ImageBasedMapData_Transparency_Value_must_be_in_zero_to_one_range", resourceCulture);
}
}
///
+ /// Looks up a localized string similar to OpenStreetMap.
+ ///
+ internal static string OpenStreetMap_DisplayName {
+ get {
+ return ResourceManager.GetString("OpenStreetMap_DisplayName", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to PDOK achtergrondkaart.
+ ///
+ internal static string WmtsMapData_CreateDefaultPdokMapData_Name {
+ get {
+ return ResourceManager.GetString("WmtsMapData_CreateDefaultPdokMapData_Name", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to <niet bepaald>.
///
internal static string WmtsMapData_Unconfigured_name {
Index: Core/Components/src/Core.Components.Gis/Properties/Resources.resx
===================================================================
diff -u -r3722e29f53ce7db0f11fb184cdc2a76d33078cf2 -r4b32064801ece7ab70357a2a942e21f113abc679
--- Core/Components/src/Core.Components.Gis/Properties/Resources.resx (.../Resources.resx) (revision 3722e29f53ce7db0f11fb184cdc2a76d33078cf2)
+++ Core/Components/src/Core.Components.Gis/Properties/Resources.resx (.../Resources.resx) (revision 4b32064801ece7ab70357a2a942e21f113abc679)
@@ -117,7 +117,7 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
De transparantie moet in het bereik [0.0, 1.0] liggen.
@@ -126,4 +126,22 @@
PDOK achtergrondkaart
+
+ Bing Maps - Satelliet
+
+
+ Bing Maps - Satelliet + Wegen
+
+
+ Bing Maps - Wegen
+
+
+ Esri World - Reliëf
+
+
+ Esri World - Topografisch
+
+
+ OpenStreetMap
+
\ No newline at end of file
Index: Core/Components/test/Core.Components.Gis.Test/Core.Components.Gis.Test.csproj
===================================================================
diff -u -r16bd8076863c03907abeee60b16704aba1bdb1a0 -r4b32064801ece7ab70357a2a942e21f113abc679
--- Core/Components/test/Core.Components.Gis.Test/Core.Components.Gis.Test.csproj (.../Core.Components.Gis.Test.csproj) (revision 16bd8076863c03907abeee60b16704aba1bdb1a0)
+++ Core/Components/test/Core.Components.Gis.Test/Core.Components.Gis.Test.csproj (.../Core.Components.Gis.Test.csproj) (revision 4b32064801ece7ab70357a2a942e21f113abc679)
@@ -46,13 +46,16 @@
Properties\GlobalAssembly.cs
+
+
+
@@ -73,6 +76,10 @@
{3bbfd65b-b277-4e50-ae6d-bd24c3434609}Core.Common.Base
+
+ {f49bd8b2-332a-4c91-a196-8cce0a2c7d98}
+ Core.Common.Utils
+ {d749ee4c-ce50-4c17-bf01-9a953028c126}Core.Common.TestUtil
Index: Core/Components/test/Core.Components.Gis.Test/Data/ImageBasedMapDataTest.cs
===================================================================
diff -u
--- Core/Components/test/Core.Components.Gis.Test/Data/ImageBasedMapDataTest.cs (revision 0)
+++ Core/Components/test/Core.Components.Gis.Test/Data/ImageBasedMapDataTest.cs (revision 4b32064801ece7ab70357a2a942e21f113abc679)
@@ -0,0 +1,106 @@
+// 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.Common.Base.Data;
+using Core.Common.TestUtil;
+using Core.Components.Gis.Data;
+using NUnit.Framework;
+
+namespace Core.Components.Gis.Test.Data
+{
+ [TestFixture]
+ public class ImageBasedMapDataTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Setup
+ const string name = "A";
+
+ // Call
+ var mapData = new SimpleImageBasedMapData(name);
+
+ // Assert
+ Assert.IsInstanceOf(mapData);
+ Assert.AreEqual(name, mapData.Name);
+ Assert.IsTrue(mapData.IsVisible);
+
+ Assert.AreEqual(2, mapData.Transparency.NumberOfDecimalPlaces);
+ Assert.AreEqual(0, mapData.Transparency.Value);
+ }
+
+ [Test]
+ [TestCase(null)]
+ [TestCase("")]
+ [TestCase(" ")]
+ public void Constructor_NameInvalid_ThrowArgumentException(string invalidName)
+ {
+ // Call
+ TestDelegate call = () => new SimpleImageBasedMapData(invalidName);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("Name", paramName);
+ }
+
+ [Test]
+ [TestCase(0)]
+ [TestCase(0.8)]
+ [TestCase(1)]
+ public void Transparency_ValidValues_ReturnNewlySetValue(double newValue)
+ {
+ // Setup
+ var mapData = new SimpleImageBasedMapData("A");
+
+ // Call
+ mapData.Transparency = (RoundedDouble)newValue;
+
+ // Assert
+ Assert.AreEqual(newValue, mapData.Transparency);
+ }
+
+ [Test]
+ [TestCase(-123.56)]
+ [TestCase(0.0 - 1e-2)]
+ [TestCase(1.0 + 1e-2)]
+ [TestCase(456.876)]
+ [TestCase(double.NaN)]
+ public void Transparency_SetInvalidValue_ThrowArgumentOutOfRangeException(double invalidTransparency)
+ {
+ // Setup
+ var mapData = new SimpleImageBasedMapData("A");
+
+ // Call
+ TestDelegate call = () => mapData.Transparency = (RoundedDouble)invalidTransparency;
+
+ // Assert
+ var message = "De transparantie moet in het bereik [0.0, 1.0] liggen.";
+ string paramName = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, message).ParamName;
+ Assert.AreEqual("value", paramName);
+ }
+
+ private class SimpleImageBasedMapData : ImageBasedMapData
+ {
+ public SimpleImageBasedMapData(string name) : base(name) {}
+ }
+ }
+}
\ No newline at end of file
Index: Core/Components/test/Core.Components.Gis.Test/Data/WellKnownTileSourceMapDataTest.cs
===================================================================
diff -u
--- Core/Components/test/Core.Components.Gis.Test/Data/WellKnownTileSourceMapDataTest.cs (revision 0)
+++ Core/Components/test/Core.Components.Gis.Test/Data/WellKnownTileSourceMapDataTest.cs (revision 4b32064801ece7ab70357a2a942e21f113abc679)
@@ -0,0 +1,66 @@
+// 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.Common.Utils.Reflection;
+using Core.Components.Gis.Data;
+using NUnit.Framework;
+
+namespace Core.Components.Gis.Test.Data
+{
+ [TestFixture]
+ public class WellKnownTileSourceMapDataTest
+ {
+ [Test]
+ public void Constructor_ValidValues_ExpectedValues()
+ {
+ // Setup
+ var value = WellKnownTileSource.BingAerial;
+
+ // Call
+ var mapData = new WellKnownTileSourceMapData(value);
+
+ // Assert
+ Assert.IsInstanceOf(mapData);
+
+ Assert.AreEqual("Bing Maps - Satelliet", mapData.Name);
+ Assert.IsTrue(mapData.IsVisible);
+ Assert.AreEqual(0, mapData.Transparency.Value);
+ Assert.AreEqual(value, mapData.TileSource);
+ }
+
+
+ [Test]
+ public void Constructor_ForAllWellKnownTileSources_ProperlySetName()
+ {
+ // Setup
+ foreach (WellKnownTileSource wellKnownTileSource in Enum.GetValues(typeof(WellKnownTileSource)))
+ {
+ // Call
+ var mapData = new WellKnownTileSourceMapData(wellKnownTileSource);
+
+ // Assert
+ Assert.AreEqual(TypeUtils.GetDisplayName(wellKnownTileSource), mapData.Name);
+ Assert.AreEqual(wellKnownTileSource, mapData.TileSource);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Core/Components/test/Core.Components.Gis.Test/Data/WellKnownTileSourceTest.cs
===================================================================
diff -u
--- Core/Components/test/Core.Components.Gis.Test/Data/WellKnownTileSourceTest.cs (revision 0)
+++ Core/Components/test/Core.Components.Gis.Test/Data/WellKnownTileSourceTest.cs (revision 4b32064801ece7ab70357a2a942e21f113abc679)
@@ -0,0 +1,60 @@
+// 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.Common.TestUtil;
+using Core.Components.Gis.Data;
+using NUnit.Framework;
+
+namespace Core.Components.Gis.Test.Data
+{
+ [TestFixture]
+ public class WellKnownTileSourceTest : EnumTestFixture
+ {
+ protected override IDictionary ExpectedDisplayNameForEnumValues
+ {
+ get
+ {
+ return new Dictionary
+ {
+ {
+ WellKnownTileSource.OpenStreetMap, "OpenStreetMap"
+ },
+ {
+ WellKnownTileSource.BingAerial, "Bing Maps - Satelliet"
+ },
+ {
+ WellKnownTileSource.BingHybrid, "Bing Maps - Satelliet + Wegen"
+ },
+ {
+ WellKnownTileSource.BingRoads, "Bing Maps - Wegen"
+ },
+ {
+ WellKnownTileSource.EsriWorldTopo, "Esri World - Topografisch"
+ },
+ {
+ WellKnownTileSource.EsriWorldShadedRelief, "Esri World - Reliëf"
+ },
+ };
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Core/Components/test/Core.Components.Gis.Test/Data/WmtsMapDataTest.cs
===================================================================
diff -u -rb41f4c465f094e91312ffd90174e765417b28ba9 -r4b32064801ece7ab70357a2a942e21f113abc679
--- Core/Components/test/Core.Components.Gis.Test/Data/WmtsMapDataTest.cs (.../WmtsMapDataTest.cs) (revision b41f4c465f094e91312ffd90174e765417b28ba9)
+++ Core/Components/test/Core.Components.Gis.Test/Data/WmtsMapDataTest.cs (.../WmtsMapDataTest.cs) (revision 4b32064801ece7ab70357a2a942e21f113abc679)
@@ -44,7 +44,7 @@
var mapData = new WmtsMapData(name, url, capabilityIdentifier, imageFormat);
// Assert
- Assert.IsInstanceOf(mapData);
+ Assert.IsInstanceOf(mapData);
Assert.AreEqual(name, mapData.Name);
Assert.IsTrue(mapData.IsVisible);
Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/AssessmentSection/AssessmentSectionCompositionTest.cs
===================================================================
diff -u -r6a0d36b218ea1ebfa308960b3321bf4b7b099fac -r4b32064801ece7ab70357a2a942e21f113abc679
--- Ringtoets/Common/test/Ringtoets.Common.Data.Test/AssessmentSection/AssessmentSectionCompositionTest.cs (.../AssessmentSectionCompositionTest.cs) (revision 6a0d36b218ea1ebfa308960b3321bf4b7b099fac)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/AssessmentSection/AssessmentSectionCompositionTest.cs (.../AssessmentSectionCompositionTest.cs) (revision 4b32064801ece7ab70357a2a942e21f113abc679)
@@ -19,30 +19,33 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
-using Core.Common.Utils.Attributes;
+using System.Collections.Generic;
+using Core.Common.TestUtil;
using NUnit.Framework;
using Ringtoets.Common.Data.AssessmentSection;
namespace Ringtoets.Common.Data.Test.AssessmentSection
{
[TestFixture]
- public class AssessmentSectionCompositionTest
+ public class AssessmentSectionCompositionTest : EnumTestFixture
{
- [Test]
- public void DisplayName_Always_ReturnExpectedValues()
+ protected override IDictionary ExpectedDisplayNameForEnumValues
{
- // Assert
- Assert.AreEqual("Dijk", GetDisplayName(AssessmentSectionComposition.Dike));
- Assert.AreEqual("Duin", GetDisplayName(AssessmentSectionComposition.Dune));
- Assert.AreEqual("Dijk / Duin", GetDisplayName(AssessmentSectionComposition.DikeAndDune));
+ get
+ {
+ return new Dictionary
+ {
+ {
+ AssessmentSectionComposition.Dike, "Dijk"
+ },
+ {
+ AssessmentSectionComposition.Dune, "Duin"
+ },
+ {
+ AssessmentSectionComposition.DikeAndDune, "Dijk / Duin"
+ }
+ };
+ }
}
-
- private string GetDisplayName(AssessmentSectionComposition value)
- {
- var type = typeof(AssessmentSectionComposition);
- var memInfo = type.GetMember(value.ToString());
- var attributes = memInfo[0].GetCustomAttributes(typeof(ResourcesDisplayNameAttribute), false);
- return ((ResourcesDisplayNameAttribute) attributes[0]).DisplayName;
- }
}
}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/DikeProfiles/BreakWaterTypeTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Data.Test/DikeProfiles/BreakWaterTypeTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/DikeProfiles/BreakWaterTypeTest.cs (revision 4b32064801ece7ab70357a2a942e21f113abc679)
@@ -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 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 General Public License for more details.
+//
+// You should have received a copy of the GNU 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.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.DikeProfiles;
+
+namespace Ringtoets.Common.Data.Test.DikeProfiles
+{
+ [TestFixture]
+ public class BreakWaterTypeTest : EnumTestFixture
+ {
+ protected override IDictionary ExpectedDisplayNameForEnumValues
+ {
+ get
+ {
+ return new Dictionary
+ {
+ {
+ BreakWaterType.Wall, "Muur"
+ },
+ {
+ BreakWaterType.Caisson, "Caisson"
+ },
+ {
+ BreakWaterType.Dam, "Havendam"
+ }
+ };
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/FailureMechanism/AssessmentLayerOneStateTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Data.Test/FailureMechanism/AssessmentLayerOneStateTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/FailureMechanism/AssessmentLayerOneStateTest.cs (revision 4b32064801ece7ab70357a2a942e21f113abc679)
@@ -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 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 General Public License for more details.
+//
+// You should have received a copy of the GNU 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.Common.TestUtil;
+using Ringtoets.Common.Data.FailureMechanism;
+
+namespace Ringtoets.Common.Data.Test.FailureMechanism
+{
+ public class AssessmentLayerOneStateTest : EnumTestFixture
+ {
+ protected override IDictionary ExpectedDisplayNameForEnumValues
+ {
+ get
+ {
+ return new Dictionary
+ {
+ {
+ AssessmentLayerOneState.NotAssessed, "Toets niet uitgevoerd"
+ },
+ {
+ AssessmentLayerOneState.Sufficient, "Voldoende / Niet relevant"
+ },
+ {
+ AssessmentLayerOneState.NoVerdict, "Nog geen oordeel"
+ }
+ };
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/FailureMechanism/AssessmentLayerTwoAResultTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Data.Test/FailureMechanism/AssessmentLayerTwoAResultTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/FailureMechanism/AssessmentLayerTwoAResultTest.cs (revision 4b32064801ece7ab70357a2a942e21f113abc679)
@@ -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 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 General Public License for more details.
+//
+// You should have received a copy of the GNU 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.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.FailureMechanism;
+
+namespace Ringtoets.Common.Data.Test.FailureMechanism
+{
+ [TestFixture]
+ public class AssessmentLayerTwoAResultTest : EnumTestFixture
+ {
+ protected override IDictionary ExpectedDisplayNameForEnumValues
+ {
+ get
+ {
+ return new Dictionary
+ {
+ {
+ AssessmentLayerTwoAResult.NotCalculated, "Niet berekend"
+ },
+ {
+ AssessmentLayerTwoAResult.Failed, "Onvoldoende"
+ },
+ {
+ AssessmentLayerTwoAResult.Successful, "Voldoende"
+ }
+ };
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/CalculationConvergenceTest.cs
===================================================================
diff -u -r4eb3b5296acb1944201b09eb87e26584ec473b33 -r4b32064801ece7ab70357a2a942e21f113abc679
--- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/CalculationConvergenceTest.cs (.../CalculationConvergenceTest.cs) (revision 4eb3b5296acb1944201b09eb87e26584ec473b33)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/CalculationConvergenceTest.cs (.../CalculationConvergenceTest.cs) (revision 4b32064801ece7ab70357a2a942e21f113abc679)
@@ -19,30 +19,33 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
-using Core.Common.Utils.Attributes;
+using System.Collections.Generic;
+using Core.Common.TestUtil;
using NUnit.Framework;
using Ringtoets.Common.Data.Hydraulics;
namespace Ringtoets.Common.Data.Test.Hydraulics
{
[TestFixture]
- public class CalculationConvergenceTest
+ public class CalculationConvergenceTest : EnumTestFixture
{
- [Test]
- public void DisplayName_Always_ReturnExpectedValues()
+ protected override IDictionary ExpectedDisplayNameForEnumValues
{
- // Assert
- Assert.AreEqual("", GetDisplayName(CalculationConvergence.NotCalculated));
- Assert.AreEqual("Nee", GetDisplayName(CalculationConvergence.CalculatedNotConverged));
- Assert.AreEqual("Ja", GetDisplayName(CalculationConvergence.CalculatedConverged));
+ get
+ {
+ return new Dictionary
+ {
+ {
+ CalculationConvergence.NotCalculated, ""
+ },
+ {
+ CalculationConvergence.CalculatedNotConverged, "Nee"
+ },
+ {
+ CalculationConvergence.CalculatedConverged, "Ja"
+ }
+ };
+ }
}
-
- private string GetDisplayName(CalculationConvergence value)
- {
- var type = typeof(CalculationConvergence);
- var memInfo = type.GetMember(value.ToString());
- var attributes = memInfo[0].GetCustomAttributes(typeof(ResourcesDisplayNameAttribute), false);
- return ((ResourcesDisplayNameAttribute) attributes[0]).DisplayName;
- }
}
}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj
===================================================================
diff -u -r6a5d7b40b7ba4dcb73e393075338352d194e97c2 -r4b32064801ece7ab70357a2a942e21f113abc679
--- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj (.../Ringtoets.Common.Data.Test.csproj) (revision 6a5d7b40b7ba4dcb73e393075338352d194e97c2)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj (.../Ringtoets.Common.Data.Test.csproj) (revision 4b32064801ece7ab70357a2a942e21f113abc679)
@@ -60,8 +60,11 @@
+
+
+
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/DikeHeightCalculationTypeTest.cs
===================================================================
diff -u -rdd5aa48365b805d37f8ecce133832e5b920f5064 -r4b32064801ece7ab70357a2a942e21f113abc679
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/DikeHeightCalculationTypeTest.cs (.../DikeHeightCalculationTypeTest.cs) (revision dd5aa48365b805d37f8ecce133832e5b920f5064)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/DikeHeightCalculationTypeTest.cs (.../DikeHeightCalculationTypeTest.cs) (revision 4b32064801ece7ab70357a2a942e21f113abc679)
@@ -19,21 +19,32 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
-using Core.Common.Utils.Attributes;
+using System.Collections.Generic;
+using Core.Common.TestUtil;
using NUnit.Framework;
namespace Ringtoets.GrassCoverErosionInwards.Data.Test
{
[TestFixture]
- public class DikeHeightCalculationTypeTest
+ public class DikeHeightCalculationTypeTest : EnumTestFixture
{
- [Test]
- public void DisplayName_Always_ReturnExpectedValues()
+ protected override IDictionary ExpectedDisplayNameForEnumValues
{
- // Assert
- Assert.AreEqual("Niet", GetDisplayName(DikeHeightCalculationType.NoCalculation));
- Assert.AreEqual("HBN bij norm", GetDisplayName(DikeHeightCalculationType.CalculateByAssessmentSectionNorm));
- Assert.AreEqual("HBN bij doorsnede-eis", GetDisplayName(DikeHeightCalculationType.CalculateByProfileSpecificRequiredProbability));
+ get
+ {
+ return new Dictionary
+ {
+ {
+ DikeHeightCalculationType.NoCalculation, "Niet"
+ },
+ {
+ DikeHeightCalculationType.CalculateByAssessmentSectionNorm, "HBN bij norm"
+ },
+ {
+ DikeHeightCalculationType.CalculateByProfileSpecificRequiredProbability, "HBN bij doorsnede-eis"
+ }
+ };
+ }
}
[Test]
@@ -44,13 +55,5 @@
Assert.AreEqual(2, (byte) DikeHeightCalculationType.CalculateByAssessmentSectionNorm);
Assert.AreEqual(3, (byte) DikeHeightCalculationType.CalculateByProfileSpecificRequiredProbability);
}
-
- private static string GetDisplayName(DikeHeightCalculationType value)
- {
- var type = typeof(DikeHeightCalculationType);
- var memInfo = type.GetMember(value.ToString());
- var attributes = memInfo[0].GetCustomAttributes(typeof(ResourcesDisplayNameAttribute), false);
- return ((ResourcesDisplayNameAttribute) attributes[0]).DisplayName;
- }
}
}
\ No newline at end of file
Index: Ringtoets/Revetment/test/Ringtoets.Revetment.Data.Test/WaveConditionsInputStepSizeTest.cs
===================================================================
diff -u -r2973c5f790a5131e427bd5f73e2a620044199639 -r4b32064801ece7ab70357a2a942e21f113abc679
--- Ringtoets/Revetment/test/Ringtoets.Revetment.Data.Test/WaveConditionsInputStepSizeTest.cs (.../WaveConditionsInputStepSizeTest.cs) (revision 2973c5f790a5131e427bd5f73e2a620044199639)
+++ Ringtoets/Revetment/test/Ringtoets.Revetment.Data.Test/WaveConditionsInputStepSizeTest.cs (.../WaveConditionsInputStepSizeTest.cs) (revision 4b32064801ece7ab70357a2a942e21f113abc679)
@@ -19,29 +19,32 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
-using Core.Common.Utils.Attributes;
+using System.Collections.Generic;
+using Core.Common.TestUtil;
using NUnit.Framework;
namespace Ringtoets.Revetment.Data.Test
{
[TestFixture]
- public class WaveConditionsInputStepSizeTest
+ public class WaveConditionsInputStepSizeTest : EnumTestFixture
{
- [Test]
- public void DisplayName_Always_ReturnExpectedValues()
+ protected override IDictionary ExpectedDisplayNameForEnumValues
{
- // Assert
- Assert.AreEqual("0.5", GetDisplayName(WaveConditionsInputStepSize.Half));
- Assert.AreEqual("1.0", GetDisplayName(WaveConditionsInputStepSize.One));
- Assert.AreEqual("2.0", GetDisplayName(WaveConditionsInputStepSize.Two));
+ get
+ {
+ return new Dictionary
+ {
+ {
+ WaveConditionsInputStepSize.Half, "0.5"
+ },
+ {
+ WaveConditionsInputStepSize.One, "1.0"
+ },
+ {
+ WaveConditionsInputStepSize.Two, "2.0"
+ }
+ };
+ }
}
-
- private string GetDisplayName(WaveConditionsInputStepSize value)
- {
- var type = typeof(WaveConditionsInputStepSize);
- var memInfo = type.GetMember(value.ToString());
- var attributes = memInfo[0].GetCustomAttributes(typeof(ResourcesDisplayNameAttribute), false);
- return ((ResourcesDisplayNameAttribute) attributes[0]).DisplayName;
- }
}
}
\ No newline at end of file