Index: Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil.Test/MapDataTestHelperTest.cs =================================================================== diff -u -rf175dc84c19a1ed1f974a80bf6c38c2f8fb001c0 -r048b1d235b217310417c6b9367deffe030d30572 --- Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil.Test/MapDataTestHelperTest.cs (.../MapDataTestHelperTest.cs) (revision f175dc84c19a1ed1f974a80bf6c38c2f8fb001c0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil.Test/MapDataTestHelperTest.cs (.../MapDataTestHelperTest.cs) (revision 048b1d235b217310417c6b9367deffe030d30572) @@ -19,12 +19,10 @@ // 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.Common.Base.Geometry; -using Core.Common.TestUtil; using Core.Components.Gis.Data; using Core.Components.Gis.Features; using Core.Components.Gis.Geometries; @@ -297,189 +295,6 @@ Assert.DoesNotThrow(test); } - [Test] - [TestCaseSource(nameof(GetHydraulicBoundaryLocationUnequalOutputMapFeatures))] - public void AssertHydraulicBoundaryLocationOutputsMapData_MapDataOutputFeaturesNotSameAsLocations_ThrowAssertionException( - IEnumerable mapFeatures) - { - // Setup - IEnumerable hydraulicBoundaryLocations = new[] - { - new HydraulicBoundaryLocation(1, "test1", 1, 0) - }; - - var mapData = new MapPointData("Hydraulische randvoorwaarden") - { - Features = mapFeatures - }; - - // Call - TestDelegate test = () => MapDataTestHelper.AssertHydraulicBoundaryLocationOutputsMapData(hydraulicBoundaryLocations, mapData); - - // Assert - Assert.Throws(test); - } - - [Test] - [TestCaseSource(nameof(GetHydraulicBoundaryLocationEqualOutputMapFeatures))] - public void AssertHydraulicBoundaryLocationOutputsMapData_MapDataOutputFeaturesSameAsLocations_DoesNotThrowAssertionException( - HydraulicBoundaryLocation location, - MapFeature mapFeature) - { - IEnumerable hydraulicBoundaryLocations = new[] - { - location - }; - - var mapData = new MapPointData("Hydraulische randvoorwaarden") - { - Features = new[] - { - mapFeature - } - }; - - // Call - TestDelegate test = () => MapDataTestHelper.AssertHydraulicBoundaryLocationOutputsMapData(hydraulicBoundaryLocations, mapData); - - // Assert - Assert.DoesNotThrow(test); - } - - private static IEnumerable GetHydraulicBoundaryLocationUnequalOutputMapFeatures() - { - var random = new Random(21); - var mapGeometry = new MapGeometry(new[] - { - new[] - { - new Point2D(1, 0) - } - }); - - var differentWaveHeightMapFeature = new MapFeature(new[] - { - mapGeometry - }); - differentWaveHeightMapFeature.MetaData["h(A+->A)"] = random.NextRoundedDouble(); - differentWaveHeightMapFeature.MetaData["h(A->B)"] = RoundedDouble.NaN; - differentWaveHeightMapFeature.MetaData["h(B->C)"] = RoundedDouble.NaN; - differentWaveHeightMapFeature.MetaData["h(C->D)"] = RoundedDouble.NaN; - differentWaveHeightMapFeature.MetaData["Hs(A+->A)"] = RoundedDouble.NaN; - differentWaveHeightMapFeature.MetaData["Hs(A->B)"] = RoundedDouble.NaN; - differentWaveHeightMapFeature.MetaData["Hs(B->C)"] = RoundedDouble.NaN; - differentWaveHeightMapFeature.MetaData["Hs(C->D)"] = RoundedDouble.NaN; - var mapFeatures = new List - { - differentWaveHeightMapFeature - }; - yield return new TestCaseData(mapFeatures) - .SetName("Different WaveHeight"); - - var differentDesignWaterLevelMapFeature = new MapFeature(new[] - { - mapGeometry - }); - differentDesignWaterLevelMapFeature.MetaData["h(A+->A)"] = RoundedDouble.NaN; - differentDesignWaterLevelMapFeature.MetaData["h(A->B)"] = RoundedDouble.NaN; - differentDesignWaterLevelMapFeature.MetaData["h(B->C)"] = RoundedDouble.NaN; - differentDesignWaterLevelMapFeature.MetaData["h(C->D)"] = RoundedDouble.NaN; - differentDesignWaterLevelMapFeature.MetaData["Hs(A+->A)"] = random.NextRoundedDouble(); - differentDesignWaterLevelMapFeature.MetaData["Hs(A->B)"] = RoundedDouble.NaN; - differentDesignWaterLevelMapFeature.MetaData["Hs(B->C)"] = RoundedDouble.NaN; - differentDesignWaterLevelMapFeature.MetaData["Hs(C->D)"] = RoundedDouble.NaN; - mapFeatures = new List - { - differentDesignWaterLevelMapFeature - }; - yield return new TestCaseData(mapFeatures) - .SetName("Different DesignWaterLevel"); - - var mapFeatureOne = new MapFeature(new[] - { - mapGeometry - }); - mapFeatureOne.MetaData["h(A+->A)"] = random.NextRoundedDouble(); - mapFeatureOne.MetaData["h(A->B)"] = RoundedDouble.NaN; - mapFeatureOne.MetaData["h(B->C)"] = RoundedDouble.NaN; - mapFeatureOne.MetaData["h(C->D)"] = RoundedDouble.NaN; - mapFeatureOne.MetaData["Hs(A+->A)"] = RoundedDouble.NaN; - mapFeatureOne.MetaData["Hs(A->B)"] = RoundedDouble.NaN; - mapFeatureOne.MetaData["Hs(B->C)"] = RoundedDouble.NaN; - mapFeatureOne.MetaData["Hs(C->D)"] = RoundedDouble.NaN; - var mapFeatureTwo = new MapFeature(new[] - { - mapGeometry - }); - mapFeatureTwo.MetaData["h(A+->A)"] = random.NextRoundedDouble(); - mapFeatureTwo.MetaData["h(A->B)"] = RoundedDouble.NaN; - mapFeatureTwo.MetaData["h(B->C)"] = RoundedDouble.NaN; - mapFeatureTwo.MetaData["h(C->D)"] = RoundedDouble.NaN; - mapFeatureTwo.MetaData["Hs(A+->A)"] = RoundedDouble.NaN; - mapFeatureTwo.MetaData["Hs(A->B)"] = RoundedDouble.NaN; - mapFeatureTwo.MetaData["Hs(B->C)"] = RoundedDouble.NaN; - mapFeatureTwo.MetaData["Hs(C->D)"] = RoundedDouble.NaN; - mapFeatures = new List - { - mapFeatureOne, - mapFeatureTwo - }; - yield return new TestCaseData(mapFeatures) - .SetName("Different MapFeaturesCount"); - } - - private static IEnumerable GetHydraulicBoundaryLocationEqualOutputMapFeatures() - { - var location = new HydraulicBoundaryLocation(1, "test1", 1, 0); - var mapGeometry = new MapGeometry(new[] - { - new[] - { - new Point2D(1, 0) - } - }); - - var mapFeatureNoOutput = new MapFeature(new[] - { - mapGeometry - }); - mapFeatureNoOutput.MetaData["h(A+->A)"] = RoundedDouble.NaN; - mapFeatureNoOutput.MetaData["h(A->B)"] = RoundedDouble.NaN; - mapFeatureNoOutput.MetaData["h(B->C)"] = RoundedDouble.NaN; - mapFeatureNoOutput.MetaData["h(C->D)"] = RoundedDouble.NaN; - mapFeatureNoOutput.MetaData["Hs(A+->A)"] = RoundedDouble.NaN; - mapFeatureNoOutput.MetaData["Hs(A->B)"] = RoundedDouble.NaN; - mapFeatureNoOutput.MetaData["Hs(B->C)"] = RoundedDouble.NaN; - mapFeatureNoOutput.MetaData["Hs(C->D)"] = RoundedDouble.NaN; - yield return new TestCaseData(location, mapFeatureNoOutput) - .SetName("LocationWithoutOutput"); - - var random = new Random(21); - location = new HydraulicBoundaryLocation(1, "test1", 1, 0); - location.DesignWaterLevelCalculation1.Output = new TestHydraulicBoundaryLocationOutput(random.NextDouble()); - location.DesignWaterLevelCalculation2.Output = new TestHydraulicBoundaryLocationOutput(random.NextDouble()); - location.DesignWaterLevelCalculation3.Output = new TestHydraulicBoundaryLocationOutput(random.NextDouble()); - location.DesignWaterLevelCalculation4.Output = new TestHydraulicBoundaryLocationOutput(random.NextDouble()); - location.WaveHeightCalculation1.Output = new TestHydraulicBoundaryLocationOutput(random.NextDouble()); - location.WaveHeightCalculation2.Output = new TestHydraulicBoundaryLocationOutput(random.NextDouble()); - location.WaveHeightCalculation3.Output = new TestHydraulicBoundaryLocationOutput(random.NextDouble()); - location.WaveHeightCalculation4.Output = new TestHydraulicBoundaryLocationOutput(random.NextDouble()); - var mapFeatureWithOutput = new MapFeature(new[] - { - mapGeometry - }); - mapFeatureWithOutput.MetaData["h(A+->A)"] = location.DesignWaterLevelCalculation1.Output.Result; - mapFeatureWithOutput.MetaData["h(A->B)"] = location.DesignWaterLevelCalculation2.Output.Result; - mapFeatureWithOutput.MetaData["h(B->C)"] = location.DesignWaterLevelCalculation3.Output.Result; - mapFeatureWithOutput.MetaData["h(C->D)"] = location.DesignWaterLevelCalculation4.Output.Result; - mapFeatureWithOutput.MetaData["Hs(A+->A)"] = location.WaveHeightCalculation1.Output.Result; - mapFeatureWithOutput.MetaData["Hs(A->B)"] = location.WaveHeightCalculation2.Output.Result; - mapFeatureWithOutput.MetaData["Hs(B->C)"] = location.WaveHeightCalculation3.Output.Result; - mapFeatureWithOutput.MetaData["Hs(C->D)"] = location.WaveHeightCalculation4.Output.Result; - yield return new TestCaseData(location, mapFeatureWithOutput) - .SetName("LocationWithOutput"); - } - #endregion #region AssertReferenceLineMapData Index: Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/MapDataTestHelper.cs =================================================================== diff -u -r64426c8cf80aaac466ddd1112888f4d6a4b7e4ef -r048b1d235b217310417c6b9367deffe030d30572 --- Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/MapDataTestHelper.cs (.../MapDataTestHelper.cs) (revision 64426c8cf80aaac466ddd1112888f4d6a4b7e4ef) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/MapDataTestHelper.cs (.../MapDataTestHelper.cs) (revision 048b1d235b217310417c6b9367deffe030d30572) @@ -99,62 +99,6 @@ } /// - /// Asserts whether the contains the data that is representative for the output of - /// . - /// - /// The hydraulic boundary locations that contain the original data. - /// The that needs to be asserted. - /// Thrown when: - /// - /// is not ; - /// the number of hydraulic boundary locations and features in are not the same; - /// the wave height or the design water level calculation results of a hydraulic boundary location and the - /// respective outputs of a corresponding feature are not the same. - /// - /// - public static void AssertHydraulicBoundaryLocationOutputsMapData(IEnumerable hydraulicBoundaryLocations, MapData mapData) - { - Assert.IsInstanceOf(mapData); - var hydraulicLocationsMapData = (MapPointData) mapData; - - HydraulicBoundaryLocation[] hydraulicBoundaryLocationsArray = hydraulicBoundaryLocations.ToArray(); - int expectedNrOfFeatures = hydraulicBoundaryLocationsArray.Length; - Assert.AreEqual(expectedNrOfFeatures, hydraulicLocationsMapData.Features.Count()); - - for (var i = 0; i < expectedNrOfFeatures; i++) - { - HydraulicBoundaryLocation hydraulicBoundaryLocation = hydraulicBoundaryLocationsArray[i]; - MapFeature mapFeature = hydraulicLocationsMapData.Features.ElementAt(i); - - MapFeaturesTestHelper.AssertHydraulicBoundaryLocationOutputMetaData(hydraulicBoundaryLocation.DesignWaterLevelCalculation1, - mapFeature, - "h(A+->A)"); - MapFeaturesTestHelper.AssertHydraulicBoundaryLocationOutputMetaData(hydraulicBoundaryLocation.DesignWaterLevelCalculation2, - mapFeature, - "h(A->B)"); - MapFeaturesTestHelper.AssertHydraulicBoundaryLocationOutputMetaData(hydraulicBoundaryLocation.DesignWaterLevelCalculation3, - mapFeature, - "h(B->C)"); - MapFeaturesTestHelper.AssertHydraulicBoundaryLocationOutputMetaData(hydraulicBoundaryLocation.DesignWaterLevelCalculation4, - mapFeature, - "h(C->D)"); - - MapFeaturesTestHelper.AssertHydraulicBoundaryLocationOutputMetaData(hydraulicBoundaryLocation.WaveHeightCalculation1, - mapFeature, - "Hs(A+->A)"); - MapFeaturesTestHelper.AssertHydraulicBoundaryLocationOutputMetaData(hydraulicBoundaryLocation.WaveHeightCalculation2, - mapFeature, - "Hs(A->B)"); - MapFeaturesTestHelper.AssertHydraulicBoundaryLocationOutputMetaData(hydraulicBoundaryLocation.WaveHeightCalculation3, - mapFeature, - "Hs(B->C)"); - MapFeaturesTestHelper.AssertHydraulicBoundaryLocationOutputMetaData(hydraulicBoundaryLocation.WaveHeightCalculation4, - mapFeature, - "Hs(C->D)"); - } - } - - /// /// Asserts whether the contains the data that is representative for the data of /// hydraulic boundary locations and calculations in . /// Index: Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/MapFeaturesTestHelper.cs =================================================================== diff -u -r754f8c5d8f6f14784dc5d4faee80ed7884f69be3 -r048b1d235b217310417c6b9367deffe030d30572 --- Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/MapFeaturesTestHelper.cs (.../MapFeaturesTestHelper.cs) (revision 754f8c5d8f6f14784dc5d4faee80ed7884f69be3) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/MapFeaturesTestHelper.cs (.../MapFeaturesTestHelper.cs) (revision 048b1d235b217310417c6b9367deffe030d30572) @@ -34,33 +34,6 @@ /// public static class MapFeaturesTestHelper { - /// - /// Asserts whether the meta data for in - /// contains the correct output data for . - /// - /// The - /// to assert against. - /// The to be asserted. - /// The name of the meta data element to retrieve the data from. - /// Thrown when the meta data of does not - /// contain a with as key. - /// Thrown when the wave height or the design water level of a - /// hydraulic boundary location and the respective meta data value associated with - /// are not the same. - /// - public static void AssertHydraulicBoundaryLocationOutputMetaData(HydraulicBoundaryLocationCalculation calculation, - MapFeature feature, - string key) - { - RoundedDouble expectedValue = RoundedDouble.NaN; - if (calculation.Output != null) - { - expectedValue = calculation.Output.Result; - } - - Assert.AreEqual(expectedValue, feature.MetaData[key]); - } - public static void AssertHydraulicBoundaryFeaturesData(IAssessmentSection assessmentSection, IEnumerable features) { HydraulicBoundaryLocation[] hydraulicBoundaryLocationsArray = assessmentSection.HydraulicBoundaryDatabase.Locations.ToArray();