Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Factories/DuneErosionMapDataFeaturesFactory.cs =================================================================== diff -u -r3b8dc050a41cd078c3e7309ac5467d485949fc1c -rd59ca522f9ee649512998572c7635bf27ed0d1c3 --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Factories/DuneErosionMapDataFeaturesFactory.cs (.../DuneErosionMapDataFeaturesFactory.cs) (revision 3b8dc050a41cd078c3e7309ac5467d485949fc1c) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Factories/DuneErosionMapDataFeaturesFactory.cs (.../DuneErosionMapDataFeaturesFactory.cs) (revision d59ca522f9ee649512998572c7635bf27ed0d1c3) @@ -36,50 +36,12 @@ namespace Ringtoets.DuneErosion.Forms.Factories { /// - /// Factory for creating arrays of for the + /// Factory for creating collections of for the /// to use in (created via ). /// internal static class DuneErosionMapDataFeaturesFactory { /// - /// Create dune location features based on the provided . - /// - /// The array of - /// to create the location features for. - /// An array of features or an empty array when - /// is empty. - /// Thrown when is null. - public static MapFeature[] CreateDuneLocationFeatures(DuneLocation[] duneLocations) - { - if (duneLocations == null) - { - throw new ArgumentNullException(nameof(duneLocations)); - } - - var features = new MapFeature[duneLocations.Length]; - - for (var i = 0; i < duneLocations.Length; i++) - { - DuneLocation location = duneLocations[i]; - - MapFeature feature = RingtoetsMapDataFeaturesFactoryHelper.CreateSinglePointMapFeature(location.Location); - feature.MetaData[RingtoetsCommonUtilResources.MetaData_ID] = location.Id; - feature.MetaData[RingtoetsCommonUtilResources.MetaData_Name] = location.Name; - feature.MetaData[Resources.MetaData_CoastalAreaId] = location.CoastalAreaId; - feature.MetaData[Resources.MetaData_Offset] = location.Offset.ToString(RingtoetsDuneErosionDataResources.DuneLocation_Offset_format, - CultureInfo.InvariantCulture); - feature.MetaData[Resources.MetaData_WaterLevel] = location.Calculation.Output?.WaterLevel ?? double.NaN; - feature.MetaData[Resources.MetaData_WaveHeight] = location.Calculation.Output?.WaveHeight ?? double.NaN; - feature.MetaData[Resources.MetaData_WavePeriod] = location.Calculation.Output?.WavePeriod ?? double.NaN; - feature.MetaData[Resources.MetaData_D50] = location.D50; - - features[i] = feature; - } - - return features; - } - - /// /// Create dune location features based on the provided . /// /// The to create the location features for. Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r3b8dc050a41cd078c3e7309ac5467d485949fc1c -rd59ca522f9ee649512998572c7635bf27ed0d1c3 --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 3b8dc050a41cd078c3e7309ac5467d485949fc1c) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision d59ca522f9ee649512998572c7635bf27ed0d1c3) @@ -238,15 +238,6 @@ } /// - /// Looks up a localized string similar to Rekenwaarde waterstand. - /// - internal static string MetaData_WaterLevel { - get { - return ResourceManager.GetString("MetaData_WaterLevel", resourceCulture); - } - } - - /// /// Looks up a localized string similar to Rekenwaarde h(Vv->VIv). /// internal static string MetaData_WaterLevelForFactorizedLowerLimitNorm { @@ -292,15 +283,6 @@ } /// - /// Looks up a localized string similar to Rekenwaarde Hs. - /// - internal static string MetaData_WaveHeight { - get { - return ResourceManager.GetString("MetaData_WaveHeight", resourceCulture); - } - } - - /// /// Looks up a localized string similar to Rekenwaarde Hs(Vv->VIv). /// internal static string MetaData_WaveHeightForFactorizedLowerLimitNorm { @@ -346,15 +328,6 @@ } /// - /// Looks up a localized string similar to Rekenwaarde Tp. - /// - internal static string MetaData_WavePeriod { - get { - return ResourceManager.GetString("MetaData_WavePeriod", resourceCulture); - } - } - - /// /// Looks up a localized string similar to Rekenwaarde Tp(Vv->VIv). /// internal static string MetaData_WavePeriodForFactorizedLowerLimitNorm { Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Properties/Resources.resx =================================================================== diff -u -r3b8dc050a41cd078c3e7309ac5467d485949fc1c -rd59ca522f9ee649512998572c7635bf27ed0d1c3 --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Properties/Resources.resx (.../Resources.resx) (revision 3b8dc050a41cd078c3e7309ac5467d485949fc1c) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Properties/Resources.resx (.../Resources.resx) (revision d59ca522f9ee649512998572c7635bf27ed0d1c3) @@ -170,15 +170,6 @@ Metrering - - Rekenwaarde waterstand - - - Rekenwaarde Hs - - - Rekenwaarde Tp - Rekenwaarde h(Iv->IIv) Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Factories/DuneErosionMapDataFeaturesFactoryTest.cs =================================================================== diff -u -r89931b99566016e46b0f5389b0d92168d303b1c1 -rd59ca522f9ee649512998572c7635bf27ed0d1c3 --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Factories/DuneErosionMapDataFeaturesFactoryTest.cs (.../DuneErosionMapDataFeaturesFactoryTest.cs) (revision 89931b99566016e46b0f5389b0d92168d303b1c1) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Factories/DuneErosionMapDataFeaturesFactoryTest.cs (.../DuneErosionMapDataFeaturesFactoryTest.cs) (revision d59ca522f9ee649512998572c7635bf27ed0d1c3) @@ -21,13 +21,9 @@ using System; using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using Core.Common.Base.Data; using Core.Common.Base.Geometry; using Core.Components.Gis.Features; using NUnit.Framework; -using Ringtoets.Common.Data.TestUtil; using Ringtoets.DuneErosion.Data; using Ringtoets.DuneErosion.Data.TestUtil; using Ringtoets.DuneErosion.Forms.Factories; @@ -39,106 +35,10 @@ public class DuneErosionMapDataFeaturesFactoryTest { [Test] - public void CreateDuneLocationFeatures_DuneLocationsNull_ThrowsArgumentNullException() - { - // Call - TestDelegate call = () => DuneErosionMapDataFeaturesFactory.CreateDuneLocationFeatures((DuneLocation[]) null); - - // Assert - string paramName = Assert.Throws(call).ParamName; - Assert.AreEqual("duneLocations", paramName); - } - - [Test] - public void CreateDuneLocationFeatures_DuneLocationsArrayEmpty_ReturnsEmptyFeaturesArray() - { - // Call - MapFeature[] features = DuneErosionMapDataFeaturesFactory.CreateDuneLocationFeatures(new DuneLocation[0]); - - // Assert - CollectionAssert.IsEmpty(features); - } - - [Test] - public void CreateDuneLocationFeatures_DuneLocationsWithOutput_ReturnsLocationFeaturesArray() - { - // Setup - var points = new[] - { - new Point2D(1.2, 2.3), - new Point2D(2.7, 2.0) - }; - DuneLocation[] locations = points.Select(p => new ValidDuneLocation(p) - { - Calculation = - { - Output = new TestDuneLocationCalculationOutput() - } - }).Cast().ToArray(); - - // Call - MapFeature[] features = DuneErosionMapDataFeaturesFactory.CreateDuneLocationFeatures(locations); - - // Assert - Assert.AreEqual(locations.Length, features.Length); - for (var i = 0; i < locations.Length; i++) - { - Assert.AreEqual(locations[i].Id, features[i].MetaData["ID"]); - Assert.AreEqual(locations[i].Name, features[i].MetaData["Naam"]); - Assert.AreEqual(locations[i].CoastalAreaId, features[i].MetaData["Kustvaknummer"]); - Assert.AreEqual(locations[i].Offset.ToString("0.#", CultureInfo.InvariantCulture), features[i].MetaData["Metrering"]); - Assert.AreEqual(locations[i].Calculation.Output.WaterLevel, (double) features[i].MetaData["Rekenwaarde waterstand"], - locations[i].Calculation.Output.WaterLevel.GetAccuracy()); - Assert.AreEqual(locations[i].Calculation.Output.WaveHeight, (double) features[i].MetaData["Rekenwaarde Hs"], - locations[i].Calculation.Output.WaveHeight.GetAccuracy()); - Assert.AreEqual(locations[i].Calculation.Output.WavePeriod, (double) features[i].MetaData["Rekenwaarde Tp"], - locations[i].Calculation.Output.WavePeriod.GetAccuracy()); - Assert.AreEqual(locations[i].D50, (RoundedDouble) features[i].MetaData["Rekenwaarde d50"], - locations[i].D50.GetAccuracy()); - Assert.AreEqual(8, features[i].MetaData.Keys.Count); - } - - AssertEqualFeatureCollections(points, features); - } - - [Test] - public void CreateDuneLocationFeatures_DuneLocationsWithoutOutput_ReturnsLocationFeaturesArray() - { - // Setup - var points = new[] - { - new Point2D(1.2, 2.3), - new Point2D(2.7, 2.0) - }; - DuneLocation[] locations = points.Select(p => new ValidDuneLocation(p)).Cast().ToArray(); - - // Call - MapFeature[] features = DuneErosionMapDataFeaturesFactory.CreateDuneLocationFeatures(locations); - - // Assert - Assert.AreEqual(locations.Length, features.Length); - for (var i = 0; i < locations.Length; i++) - { - Assert.AreEqual(locations[i].Id, features[i].MetaData["ID"]); - Assert.AreEqual(locations[i].Name, features[i].MetaData["Naam"]); - Assert.AreEqual(locations[i].CoastalAreaId, features[i].MetaData["Kustvaknummer"]); - Assert.AreEqual(locations[i].Offset.ToString("0.#", CultureInfo.InvariantCulture), features[i].MetaData["Metrering"]); - Assert.AreEqual(double.NaN, features[i].MetaData["Rekenwaarde waterstand"]); - Assert.AreEqual(double.NaN, features[i].MetaData["Rekenwaarde Hs"]); - Assert.AreEqual(double.NaN, features[i].MetaData["Rekenwaarde Tp"]); - Assert.AreEqual(locations[i].D50, (RoundedDouble) features[i].MetaData["Rekenwaarde d50"], - locations[i].D50.GetAccuracy()); - Assert.AreEqual(8, features[i].MetaData.Keys.Count); - } - - AssertEqualFeatureCollections(points, features); - } - - [Test] public void CreateDuneLocationsFeatures_FailureMechanismNull_ThrowsArgumentNullException() { // Call - TestDelegate call = () => DuneErosionMapDataFeaturesFactory.CreateDuneLocationFeatures((DuneErosionFailureMechanism) null); + TestDelegate call = () => DuneErosionMapDataFeaturesFactory.CreateDuneLocationFeatures(null); // Assert var exception = Assert.Throws(call); @@ -194,22 +94,5 @@ Offset = random.NextDouble() }); } - - private class ValidDuneLocation : DuneLocation - { - public ValidDuneLocation(Point2D location) : base(0, "", location, new ConstructionProperties()) {} - } - - private static void AssertEqualFeatureCollections(Point2D[] points, MapFeature[] features) - { - Assert.AreEqual(points.Length, features.Length); - for (var i = 0; i < points.Length; i++) - { - CollectionAssert.AreEqual(new[] - { - points[i] - }, features[i].MapGeometries.First().PointCollections.First()); - } - } } } \ No newline at end of file