Index: Ringtoets/Common/src/Ringtoets.Common.Data/AssessmentSection/RingtoetsWellKnownTileSource.cs =================================================================== diff -u -r5c1a60942a2effc207d546054d4832f4aabe8ba5 -r9f22d388df3a8fb1ca103eb046e0cc8866d588a0 --- Ringtoets/Common/src/Ringtoets.Common.Data/AssessmentSection/RingtoetsWellKnownTileSource.cs (.../RingtoetsWellKnownTileSource.cs) (revision 5c1a60942a2effc207d546054d4832f4aabe8ba5) +++ Ringtoets/Common/src/Ringtoets.Common.Data/AssessmentSection/RingtoetsWellKnownTileSource.cs (.../RingtoetsWellKnownTileSource.cs) (revision 9f22d388df3a8fb1ca103eb046e0cc8866d588a0) @@ -19,32 +19,23 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using Core.Common.Utils.Attributes; -using Ringtoets.Common.Data.Properties; - namespace Ringtoets.Common.Data.AssessmentSection { /// /// All well known tile sources for which built-in support is provided. /// public enum RingtoetsWellKnownTileSource { - [ResourcesDisplayName(typeof(Resources), nameof(Resources.RingtoetsWellKnownTileSource_OpenStreetMap_DisplayName))] OpenStreetMap = 1, - [ResourcesDisplayName(typeof(Resources), nameof(Resources.RingtoetsWellKnownTileSource_BingAerial_DisplayName))] BingAerial = 2, - [ResourcesDisplayName(typeof(Resources), nameof(Resources.RingtoetsWellKnownTileSource_BingHybrid_DisplayName))] BingHybrid = 3, - [ResourcesDisplayName(typeof(Resources), nameof(Resources.RingtoetsWellKnownTileSource_BingRoads_DisplayName))] BingRoads = 4, - [ResourcesDisplayName(typeof(Resources), nameof(Resources.RingtoetsWellKnownTileSource_EsriWorldTopo_DisplayName))] EsriWorldTopo = 5, - [ResourcesDisplayName(typeof(Resources), nameof(Resources.RingtoetsWellKnownTileSource_EsriWorldShadedRelief_DisplayName))] EsriWorldShadedRelief = 6 } } \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Data/AssessmentSection/RingtoetsWellKnownTileSourceExtension.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Data/AssessmentSection/RingtoetsWellKnownTileSourceExtension.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Data/AssessmentSection/RingtoetsWellKnownTileSourceExtension.cs (revision 9f22d388df3a8fb1ca103eb046e0cc8866d588a0) @@ -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 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; +using Ringtoets.Common.Data.Properties; + +namespace Ringtoets.Common.Data.AssessmentSection +{ + /// + /// Extension class for . + /// + public static class RingtoetsWellKnownTileSourceExtension + { + /// + /// Gets the display name corresponding to . + /// + /// The + /// to get the display name of. + /// The display name. + /// Thrown when + /// is not a valid value for . + public static string GetDisplayName(this RingtoetsWellKnownTileSource ringtoetsWellKnownTileSource) + { + switch (ringtoetsWellKnownTileSource) + { + case RingtoetsWellKnownTileSource.OpenStreetMap: + return Resources.RingtoetsWellKnownTileSource_OpenStreetMap_DisplayName; + case RingtoetsWellKnownTileSource.BingAerial: + return Resources.RingtoetsWellKnownTileSource_BingAerial_DisplayName; + case RingtoetsWellKnownTileSource.BingHybrid: + return Resources.RingtoetsWellKnownTileSource_BingHybrid_DisplayName; + case RingtoetsWellKnownTileSource.BingRoads: + return Resources.RingtoetsWellKnownTileSource_BingRoads_DisplayName; + case RingtoetsWellKnownTileSource.EsriWorldTopo: + return Resources.RingtoetsWellKnownTileSource_EsriWorldTopo_DisplayName; + case RingtoetsWellKnownTileSource.EsriWorldShadedRelief: + return Resources.RingtoetsWellKnownTileSource_EsriWorldShadedRelief_DisplayName; + default: + throw new NotSupportedException($"Unknown value '{ringtoetsWellKnownTileSource}'"); + } + } + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj =================================================================== diff -u -rfa68b38773452b965a9ee25db20436446c1a50b8 -r9f22d388df3a8fb1ca103eb046e0cc8866d588a0 --- Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj (.../Ringtoets.Common.Data.csproj) (revision fa68b38773452b965a9ee25db20436446c1a50b8) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj (.../Ringtoets.Common.Data.csproj) (revision 9f22d388df3a8fb1ca103eb046e0cc8866d588a0) @@ -45,6 +45,7 @@ + Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/AssessmentSection/RingtoetsWellKnownTileSourceExtensionTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/AssessmentSection/RingtoetsWellKnownTileSourceExtensionTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/AssessmentSection/RingtoetsWellKnownTileSourceExtensionTest.cs (revision 9f22d388df3a8fb1ca103eb046e0cc8866d588a0) @@ -0,0 +1,68 @@ +// 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; +using System.Collections.Generic; +using NUnit.Framework; +using Ringtoets.Common.Data.AssessmentSection; + +namespace Ringtoets.Common.Data.Test.AssessmentSection +{ + [TestFixture] + public class RingtoetsWellKnownTileSourceExtensionTest + { + [Test] + [TestCaseSource(nameof(GetValidRingtoetsWellKnownTileSources))] + public void GetDisplayName_ValidEnum_ReturnsExpectedDislayName(RingtoetsWellKnownTileSource ringtoetsWellKnownTileSource, + string expectedDisplayName) + { + // Call + string displayName = ringtoetsWellKnownTileSource.GetDisplayName(); + + // Assert + Assert.AreEqual(expectedDisplayName, displayName); + } + + [Test] + public void GetDisplayName_InvalidEnum_ThrowsNotSupportedException() + { + // Setup + const RingtoetsWellKnownTileSource ringtoetsWellKnownTileSource = (RingtoetsWellKnownTileSource) 9999; + + // Call + TestDelegate call = () => ringtoetsWellKnownTileSource.GetDisplayName(); + + // Assert + string message = Assert.Throws(call).Message; + Assert.AreEqual($"Unknown value '{ringtoetsWellKnownTileSource}'", message); + } + + private static IEnumerable GetValidRingtoetsWellKnownTileSources() + { + yield return new TestCaseData(RingtoetsWellKnownTileSource.OpenStreetMap, "OpenStreetMap"); + yield return new TestCaseData(RingtoetsWellKnownTileSource.BingAerial, "Bing Maps - Satelliet"); + yield return new TestCaseData(RingtoetsWellKnownTileSource.BingHybrid, "Bing Maps - Satelliet + Wegen"); + yield return new TestCaseData(RingtoetsWellKnownTileSource.BingRoads, "Bing Maps - Wegen"); + yield return new TestCaseData(RingtoetsWellKnownTileSource.EsriWorldTopo, "Esri World - Topografisch"); + yield return new TestCaseData(RingtoetsWellKnownTileSource.EsriWorldShadedRelief, "Esri World - Reliëf"); + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/AssessmentSection/RingtoetsWellKnownTileSourceTest.cs =================================================================== diff -u -r5c1a60942a2effc207d546054d4832f4aabe8ba5 -r9f22d388df3a8fb1ca103eb046e0cc8866d588a0 --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/AssessmentSection/RingtoetsWellKnownTileSourceTest.cs (.../RingtoetsWellKnownTileSourceTest.cs) (revision 5c1a60942a2effc207d546054d4832f4aabe8ba5) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/AssessmentSection/RingtoetsWellKnownTileSourceTest.cs (.../RingtoetsWellKnownTileSourceTest.cs) (revision 9f22d388df3a8fb1ca103eb046e0cc8866d588a0) @@ -36,22 +36,22 @@ return new Dictionary { { - RingtoetsWellKnownTileSource.OpenStreetMap, "OpenStreetMap" + RingtoetsWellKnownTileSource.OpenStreetMap, null }, { - RingtoetsWellKnownTileSource.BingAerial, "Bing Maps - Satelliet" + RingtoetsWellKnownTileSource.BingAerial, null }, { - RingtoetsWellKnownTileSource.BingHybrid, "Bing Maps - Satelliet + Wegen" + RingtoetsWellKnownTileSource.BingHybrid, null }, { - RingtoetsWellKnownTileSource.BingRoads, "Bing Maps - Wegen" + RingtoetsWellKnownTileSource.BingRoads, null }, { - RingtoetsWellKnownTileSource.EsriWorldTopo, "Esri World - Topografisch" + RingtoetsWellKnownTileSource.EsriWorldTopo, null }, { - RingtoetsWellKnownTileSource.EsriWorldShadedRelief, "Esri World - Reliëf" + RingtoetsWellKnownTileSource.EsriWorldShadedRelief, null } }; } Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj =================================================================== diff -u -rfa68b38773452b965a9ee25db20436446c1a50b8 -r9f22d388df3a8fb1ca103eb046e0cc8866d588a0 --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj (.../Ringtoets.Common.Data.Test.csproj) (revision fa68b38773452b965a9ee25db20436446c1a50b8) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj (.../Ringtoets.Common.Data.Test.csproj) (revision 9f22d388df3a8fb1ca103eb046e0cc8866d588a0) @@ -58,6 +58,7 @@ + Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/BackgroundDataTestDataGeneratorTest.cs =================================================================== diff -u -rfa68b38773452b965a9ee25db20436446c1a50b8 -r9f22d388df3a8fb1ca103eb046e0cc8866d588a0 --- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/BackgroundDataTestDataGeneratorTest.cs (.../BackgroundDataTestDataGeneratorTest.cs) (revision fa68b38773452b965a9ee25db20436446c1a50b8) +++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/BackgroundDataTestDataGeneratorTest.cs (.../BackgroundDataTestDataGeneratorTest.cs) (revision 9f22d388df3a8fb1ca103eb046e0cc8866d588a0) @@ -20,9 +20,7 @@ // All rights reserved. using System; -using System.ComponentModel; using Core.Common.TestUtil; -using Core.Common.Utils.Reflection; using Core.Components.Gis.Data; using NUnit.Framework; using Ringtoets.Common.Data.AssessmentSection; @@ -91,7 +89,7 @@ var configuration = (WellKnownBackgroundDataConfiguration) backgroundData.Configuration; - string backgroundDataName = TypeUtils.GetDisplayName(wellKnownTileSource); + string backgroundDataName = wellKnownTileSource.GetDisplayName(); Assert.AreEqual(backgroundDataName, backgroundData.Name); Assert.AreEqual(wellKnownTileSource, configuration.WellKnownTileSource); } @@ -106,7 +104,7 @@ TestDelegate call = () => BackgroundDataTestDataGenerator.GetWellKnownBackgroundMapData(invalidWellKnownTileSource); // Assert - Assert.Throws(call); + Assert.Throws(call); } } } \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/BackgroundDataTestDataGenerator.cs =================================================================== diff -u -rfa68b38773452b965a9ee25db20436446c1a50b8 -r9f22d388df3a8fb1ca103eb046e0cc8866d588a0 --- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/BackgroundDataTestDataGenerator.cs (.../BackgroundDataTestDataGenerator.cs) (revision fa68b38773452b965a9ee25db20436446c1a50b8) +++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/BackgroundDataTestDataGenerator.cs (.../BackgroundDataTestDataGenerator.cs) (revision 9f22d388df3a8fb1ca103eb046e0cc8866d588a0) @@ -19,8 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using System.ComponentModel; -using Core.Common.Utils.Reflection; +using System; using Core.Components.Gis.Data; using Ringtoets.Common.Data.AssessmentSection; @@ -56,14 +55,14 @@ /// /// The to create the background data for. /// The created . - /// Thrown when + /// Thrown when /// is an invalid . public static BackgroundData GetWellKnownBackgroundMapData(RingtoetsWellKnownTileSource tileSource) { return new BackgroundData(new WellKnownBackgroundDataConfiguration(tileSource)) { IsVisible = true, - Name = TypeUtils.GetDisplayName(tileSource) + Name = tileSource.GetDisplayName() }; } } Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/AssessmentSection.cs =================================================================== diff -u -r5c1a60942a2effc207d546054d4832f4aabe8ba5 -r9f22d388df3a8fb1ca103eb046e0cc8866d588a0 --- Ringtoets/Integration/src/Ringtoets.Integration.Data/AssessmentSection.cs (.../AssessmentSection.cs) (revision 5c1a60942a2effc207d546054d4832f4aabe8ba5) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/AssessmentSection.cs (.../AssessmentSection.cs) (revision 9f22d388df3a8fb1ca103eb046e0cc8866d588a0) @@ -23,7 +23,6 @@ using System.ComponentModel; using Core.Common.Base; using Core.Common.Base.Geometry; -using Core.Common.Utils.Reflection; using Ringtoets.ClosingStructures.Data; using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; @@ -48,8 +47,8 @@ /// public sealed class AssessmentSection : Observable, IAssessmentSection { - private ReferenceLine referenceLine; private const RingtoetsWellKnownTileSource defaultWellKnownTileSource = RingtoetsWellKnownTileSource.BingAerial; + private ReferenceLine referenceLine; /// /// Initializes a new instance of the class. @@ -63,8 +62,7 @@ BackgroundData = new BackgroundData(new WellKnownBackgroundDataConfiguration(defaultWellKnownTileSource)) { - IsVisible = true, - Name = "Bing Maps - Satelliet" + Name = defaultWellKnownTileSource.GetDisplayName() }; PipingFailureMechanism = new PipingFailureMechanism();