Index: Ringtoets/Common/src/Ringtoets.Common.Data/AssessmentSection/AssessmentSectionExtensions.cs =================================================================== diff -u -r812934f2d315f3e88151a988cb621070cee72791 -r175cb39b49a146149811954e3800bebfc0819e3d --- Ringtoets/Common/src/Ringtoets.Common.Data/AssessmentSection/AssessmentSectionExtensions.cs (.../AssessmentSectionExtensions.cs) (revision 812934f2d315f3e88151a988cb621070cee72791) +++ Ringtoets/Common/src/Ringtoets.Common.Data/AssessmentSection/AssessmentSectionExtensions.cs (.../AssessmentSectionExtensions.cs) (revision 175cb39b49a146149811954e3800bebfc0819e3d) @@ -28,7 +28,7 @@ namespace Ringtoets.Common.Data.AssessmentSection { /// - /// Extension methods for . + /// Extension methods for . /// public static class AssessmentSectionExtensions { Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Factories/RingtoetsMapDataFeaturesFactory.cs =================================================================== diff -u -rf175dc84c19a1ed1f974a80bf6c38c2f8fb001c0 -r175cb39b49a146149811954e3800bebfc0819e3d --- Ringtoets/Common/src/Ringtoets.Common.Forms/Factories/RingtoetsMapDataFeaturesFactory.cs (.../RingtoetsMapDataFeaturesFactory.cs) (revision f175dc84c19a1ed1f974a80bf6c38c2f8fb001c0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Factories/RingtoetsMapDataFeaturesFactory.cs (.../RingtoetsMapDataFeaturesFactory.cs) (revision 175cb39b49a146149811954e3800bebfc0819e3d) @@ -137,53 +137,6 @@ } /// - /// Create hydraulic boundary location features based on the provided . - /// - /// The locations to create the features for. - /// The name of the design water level attribute. - /// The name of the wave height attribute. - /// A collection of features or an empty collection when - /// is empty. - /// Thrown when any input parameter is null. - public static IEnumerable CreateHydraulicBoundaryLocationFeatures(IEnumerable hydraulicBoundaryLocations, - string designWaterLevelAttributeName, - string waveHeightAttributeName) - { - if (hydraulicBoundaryLocations == null) - { - throw new ArgumentNullException(nameof(hydraulicBoundaryLocations)); - } - - if (designWaterLevelAttributeName == null) - { - throw new ArgumentNullException(nameof(designWaterLevelAttributeName)); - } - - if (waveHeightAttributeName == null) - { - throw new ArgumentNullException(nameof(waveHeightAttributeName)); - } - - int hydraulicBoundaryLocationsCount = hydraulicBoundaryLocations.Count(); - var features = new MapFeature[hydraulicBoundaryLocationsCount]; - - for (var i = 0; i < hydraulicBoundaryLocationsCount; i++) - { - HydraulicBoundaryLocation location = hydraulicBoundaryLocations.ElementAt(i); - - MapFeature feature = CreateSinglePointMapFeature(location.Location); - feature.MetaData[Resources.MetaData_ID] = location.Id; - feature.MetaData[Resources.MetaData_Name] = location.Name; - feature.MetaData[designWaterLevelAttributeName] = location.DesignWaterLevelCalculation1.Output?.Result ?? RoundedDouble.NaN; - feature.MetaData[waveHeightAttributeName] = location.WaveHeightCalculation1.Output?.Result ?? RoundedDouble.NaN; - - features[i] = feature; - } - - return features; - } - - /// /// Create section features based on the provided . /// /// The collection of to create Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Factories/RingtoetsMapDataFeaturesFactoryTest.cs =================================================================== diff -u -rbaaa82e648f24de96c3855f3be49afff8977544e -r175cb39b49a146149811954e3800bebfc0819e3d --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Factories/RingtoetsMapDataFeaturesFactoryTest.cs (.../RingtoetsMapDataFeaturesFactoryTest.cs) (revision baaa82e648f24de96c3855f3be49afff8977544e) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Factories/RingtoetsMapDataFeaturesFactoryTest.cs (.../RingtoetsMapDataFeaturesFactoryTest.cs) (revision 175cb39b49a146149811954e3800bebfc0819e3d) @@ -161,96 +161,6 @@ } [Test] - public void CreateHydraulicBoundaryLocationFeatures_HydraulicBoundaryLocationsArrayEmpty_ReturnsEmptyFeaturesCollection() - { - // Call - IEnumerable features = RingtoetsMapDataFeaturesFactory.CreateHydraulicBoundaryLocationFeatures( - new HydraulicBoundaryLocation[0], string.Empty, string.Empty); - - // Assert - CollectionAssert.IsEmpty(features); - } - - [Test] - public void CreateHydraulicBoundaryLocationFeatures_HydraulicBoundaryLocationsNull_ThrowArgumentNullException() - { - // Call - TestDelegate test = () => RingtoetsMapDataFeaturesFactory.CreateHydraulicBoundaryLocationFeatures( - null, string.Empty, string.Empty); - - // Assert - var exception = Assert.Throws(test); - Assert.AreEqual("hydraulicBoundaryLocations", exception.ParamName); - } - - [Test] - public void CreateHydraulicBoundaryLocationFeatures_DesignWaterLevelAttributeNameNull_ThrowArgumentNullException() - { - // Call - TestDelegate test = () => RingtoetsMapDataFeaturesFactory.CreateHydraulicBoundaryLocationFeatures( - new HydraulicBoundaryLocation[0], null, string.Empty); - - // Assert - var exception = Assert.Throws(test); - Assert.AreEqual("designWaterLevelAttributeName", exception.ParamName); - } - - [Test] - public void CreateHydraulicBoundaryLocationFeatures_WaveHeightAttributeNameNull_ThrowArgumentNullException() - { - // Call - TestDelegate test = () => RingtoetsMapDataFeaturesFactory.CreateHydraulicBoundaryLocationFeatures( - new HydraulicBoundaryLocation[0], string.Empty, null); - - // Assert - var exception = Assert.Throws(test); - Assert.AreEqual("waveHeightAttributeName", exception.ParamName); - } - - [Test] - public void CreateHydraulicBoundaryLocationFeatures_GivenHydraulicBoundaryLocations_ReturnsLocationFeaturesCollection() - { - // Setup - const string designWaterLevelAttributeName = "Toetspeil"; - const string waveheightAttributeName = "Golfhoogte"; - - var points = new[] - { - new Point2D(1.2, 2.3), - new Point2D(2.7, 2.0) - }; - var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); - hydraulicBoundaryDatabase.Locations.AddRange(points.Select(p => new HydraulicBoundaryLocation(0, "", p.X, p.Y))); - - // Call - IEnumerable features = RingtoetsMapDataFeaturesFactory.CreateHydraulicBoundaryLocationFeatures(hydraulicBoundaryDatabase.Locations, - designWaterLevelAttributeName, - waveheightAttributeName); - - // Assert - IEnumerable hydraulicBoundaryLocations = hydraulicBoundaryDatabase.Locations; - int expectedHydraulicBoundaryLocationsCount = hydraulicBoundaryLocations.Count(); - Assert.AreEqual(expectedHydraulicBoundaryLocationsCount, features.Count()); - for (var i = 0; i < expectedHydraulicBoundaryLocationsCount; i++) - { - MapFeature mapFeature = features.ElementAt(i); - HydraulicBoundaryLocation hydraulicBoundaryLocation = hydraulicBoundaryLocations.ElementAt(i); - - Assert.AreEqual(4, mapFeature.MetaData.Keys.Count); - Assert.AreEqual(hydraulicBoundaryLocation.Id, mapFeature.MetaData["ID"]); - Assert.AreEqual(hydraulicBoundaryLocation.Name, mapFeature.MetaData["Naam"]); - MapFeaturesTestHelper.AssertHydraulicBoundaryLocationOutputMetaData(hydraulicBoundaryLocation.DesignWaterLevelCalculation1, - mapFeature, - designWaterLevelAttributeName); - MapFeaturesTestHelper.AssertHydraulicBoundaryLocationOutputMetaData(hydraulicBoundaryLocation.WaveHeightCalculation1, - mapFeature, - waveheightAttributeName); - } - - AssertEqualFeatureCollections(points, features); - } - - [Test] public void CreateFailureMechanismSectionFeatures_SectionsNull_ReturnsEmptyFeaturesCollection() { // Call Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Factories/GrassCoverErosionOutwardsMapDataFeaturesFactory.cs =================================================================== diff -u -r709f2cb79a37470876740145cf9f2801893672d1 -r175cb39b49a146149811954e3800bebfc0819e3d --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Factories/GrassCoverErosionOutwardsMapDataFeaturesFactory.cs (.../GrassCoverErosionOutwardsMapDataFeaturesFactory.cs) (revision 709f2cb79a37470876740145cf9f2801893672d1) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Factories/GrassCoverErosionOutwardsMapDataFeaturesFactory.cs (.../GrassCoverErosionOutwardsMapDataFeaturesFactory.cs) (revision 175cb39b49a146149811954e3800bebfc0819e3d) @@ -19,15 +19,18 @@ // 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.Base.Data; using Core.Components.Gis.Data; using Core.Components.Gis.Features; using Ringtoets.Common.Data.Hydraulics; using Ringtoets.Common.Forms.Factories; using Ringtoets.Common.Forms.PresentationObjects; using Ringtoets.GrassCoverErosionOutwards.Data; using Ringtoets.GrassCoverErosionOutwards.Forms.Properties; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; namespace Ringtoets.GrassCoverErosionOutwards.Forms.Factories { @@ -70,13 +73,33 @@ /// /// The collection of /// to create the location features for. - /// A collection of features or an empty collection when - /// is null or empty. - public static IEnumerable CreateHydraulicBoundaryLocationFeatures(IEnumerable hydraulicBoundaryLocations) + /// A collection of features or an empty collection when is empty. + /// Thrown when is null. + public static IEnumerable CreateHydraulicBoundaryLocationsFeatures(IEnumerable hydraulicBoundaryLocations) { - return RingtoetsMapDataFeaturesFactory.CreateHydraulicBoundaryLocationFeatures(hydraulicBoundaryLocations ?? new HydraulicBoundaryLocation[0], - Resources.DesignWaterLevel_DisplayName, - Resources.MetaData_WaveHeight); + if (hydraulicBoundaryLocations == null) + { + throw new ArgumentNullException(nameof(hydraulicBoundaryLocations)); + } + + int hydraulicBoundaryLocationsCount = hydraulicBoundaryLocations.Count(); + var features = new MapFeature[hydraulicBoundaryLocationsCount]; + + for (var i = 0; i < hydraulicBoundaryLocationsCount; i++) + { + HydraulicBoundaryLocation location = hydraulicBoundaryLocations.ElementAt(i); + + MapFeature feature = RingtoetsMapDataFeaturesFactory.CreateSinglePointMapFeature(location.Location); + + feature.MetaData[RingtoetsCommonFormsResources.MetaData_ID] = location.Id; + feature.MetaData[RingtoetsCommonFormsResources.MetaData_Name] = location.Name; + feature.MetaData[Resources.DesignWaterLevel_DisplayName] = location.DesignWaterLevelCalculation1.Output?.Result ?? RoundedDouble.NaN; + feature.MetaData[Resources.MetaData_WaveHeight] = location.WaveHeightCalculation1.Output?.Result ?? RoundedDouble.NaN; + + features[i] = feature; + } + + return features; } } } \ No newline at end of file Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsFailureMechanismView.cs =================================================================== diff -u -rd7c8467b162e547048341f28cada904aaabdcf5a -r175cb39b49a146149811954e3800bebfc0819e3d --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsFailureMechanismView.cs (.../GrassCoverErosionOutwardsFailureMechanismView.cs) (revision d7c8467b162e547048341f28cada904aaabdcf5a) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsFailureMechanismView.cs (.../GrassCoverErosionOutwardsFailureMechanismView.cs) (revision 175cb39b49a146149811954e3800bebfc0819e3d) @@ -201,7 +201,7 @@ sectionsMapData.Features = RingtoetsMapDataFeaturesFactory.CreateFailureMechanismSectionFeatures(failureMechanismSections); sectionsStartPointMapData.Features = RingtoetsMapDataFeaturesFactory.CreateFailureMechanismSectionStartPointFeatures(failureMechanismSections); sectionsEndPointMapData.Features = RingtoetsMapDataFeaturesFactory.CreateFailureMechanismSectionEndPointFeatures(failureMechanismSections); - hydraulicBoundaryLocationsMapData.Features = GrassCoverErosionOutwardsMapDataFeaturesFactory.CreateHydraulicBoundaryLocationFeatures(hydraulicBoundaryLocations); + hydraulicBoundaryLocationsMapData.Features = GrassCoverErosionOutwardsMapDataFeaturesFactory.CreateHydraulicBoundaryLocationsFeatures(hydraulicBoundaryLocations); foreshoreProfilesMapData.Features = RingtoetsMapDataFeaturesFactory.CreateForeshoreProfilesFeatures(foreshoreProfiles); calculationsMapData.Features = GrassCoverErosionOutwardsMapDataFeaturesFactory.CreateCalculationFeatures(calculations); } Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Factories/GrassCoverErosionOutwardsMapDataFeaturesFactoryTest.cs =================================================================== diff -u -rbaaa82e648f24de96c3855f3be49afff8977544e -r175cb39b49a146149811954e3800bebfc0819e3d --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Factories/GrassCoverErosionOutwardsMapDataFeaturesFactoryTest.cs (.../GrassCoverErosionOutwardsMapDataFeaturesFactoryTest.cs) (revision baaa82e648f24de96c3855f3be49afff8977544e) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Factories/GrassCoverErosionOutwardsMapDataFeaturesFactoryTest.cs (.../GrassCoverErosionOutwardsMapDataFeaturesFactoryTest.cs) (revision 175cb39b49a146149811954e3800bebfc0819e3d) @@ -19,6 +19,7 @@ // 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.Base.Geometry; @@ -94,17 +95,28 @@ } [Test] - public void CreateHydraulicBoundaryLocationsFeatures_HydraulicBoundaryLocationsNull_ReturnsEmptyFeaturesCollection() + public void CreateHydraulicBoundaryLocationsFeatures_HydraulicBoundaryLocationsNull_ThrowArgumentNullException() { // Call - IEnumerable features = GrassCoverErosionOutwardsMapDataFeaturesFactory.CreateHydraulicBoundaryLocationFeatures(null); + TestDelegate test = () => GrassCoverErosionOutwardsMapDataFeaturesFactory.CreateHydraulicBoundaryLocationsFeatures(null); // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("hydraulicBoundaryLocations", exception.ParamName); + } + + [Test] + public void CreateHydraulicBoundaryLocationsFeatures_HydraulicBoundaryLocationsArrayEmpty_ReturnsEmptyFeaturesCollection() + { + // Call + IEnumerable features = GrassCoverErosionOutwardsMapDataFeaturesFactory.CreateHydraulicBoundaryLocationsFeatures(new HydraulicBoundaryLocation[0]); + + // Assert CollectionAssert.IsEmpty(features); } [Test] - public void CreateHydraulicBoundaryLocationFeatures_GivenHydraulicBoundaryLocations_ReturnsLocationFeaturesCollection() + public void CreateHydraulicBoundaryLocationsFeatures_GivenHydraulicBoundaryLocations_ReturnsLocationFeaturesCollection() { // Setup var points = new[] @@ -115,7 +127,7 @@ IEnumerable hydraulicBoundaryLocations = points.Select(p => new HydraulicBoundaryLocation(0, "", p.X, p.Y)).ToArray(); // Call - IEnumerable features = GrassCoverErosionOutwardsMapDataFeaturesFactory.CreateHydraulicBoundaryLocationFeatures(hydraulicBoundaryLocations); + IEnumerable features = GrassCoverErosionOutwardsMapDataFeaturesFactory.CreateHydraulicBoundaryLocationsFeatures(hydraulicBoundaryLocations); // Assert int expectedHydraulicBoundaryLocationsCount = hydraulicBoundaryLocations.Count();