Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsChartDataFactory.cs =================================================================== diff -u -r117a54dfd9b5972086a1f3386923edda2e7a334b -ra2226e0827c68aa2434d4f390cde53de1d410fbf --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsChartDataFactory.cs (.../MacroStabilityInwardsChartDataFactory.cs) (revision 117a54dfd9b5972086a1f3386923edda2e7a334b) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsChartDataFactory.cs (.../MacroStabilityInwardsChartDataFactory.cs) (revision a2226e0827c68aa2434d4f390cde53de1d410fbf) @@ -62,7 +62,7 @@ /// public static ChartDataCollection CreateSliceParametersChartDataCollection() { - return new ChartDataCollection(Resources.SliceParameters); + return new ChartDataCollection(Resources.SliceParameters_DisplayName); } /// Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsChartDataPointsFactory.cs =================================================================== diff -u -r117a54dfd9b5972086a1f3386923edda2e7a334b -ra2226e0827c68aa2434d4f390cde53de1d410fbf --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsChartDataPointsFactory.cs (.../MacroStabilityInwardsChartDataPointsFactory.cs) (revision 117a54dfd9b5972086a1f3386923edda2e7a334b) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsChartDataPointsFactory.cs (.../MacroStabilityInwardsChartDataPointsFactory.cs) (revision a2226e0827c68aa2434d4f390cde53de1d410fbf) @@ -22,7 +22,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Reflection; using Core.Common.Base.Data; using Core.Common.Base.Geometry; using Core.Components.Chart.Data; @@ -32,7 +31,7 @@ namespace Ringtoets.MacroStabilityInwards.Forms.Factories { /// - /// Factory for creating arrays of to use in + /// Factory for creating collections of points in 2D space to use in /// (created via ). /// internal static class MacroStabilityInwardsChartDataPointsFactory @@ -41,8 +40,8 @@ /// Create surface line points in 2D space based on the provided . /// /// The to create the surface line points for. - /// An array of points in 2D space or an empty array when is null. - public static Point2D[] CreateSurfaceLinePoints(MacroStabilityInwardsSurfaceLine surfaceLine) + /// A collection of points in 2D space or an empty collection when is null. + public static IEnumerable CreateSurfaceLinePoints(MacroStabilityInwardsSurfaceLine surfaceLine) { return surfaceLine?.LocalGeometry.ToArray() ?? new Point2D[0]; } @@ -51,13 +50,13 @@ /// Create a surface level outside point in 2D space based on the provided . /// /// The surface line to create the surface level outside point for. - /// An array with a surface level outside point in 2D space or an empty array when: + /// A collection with a surface level outside point in 2D space or an empty collection when: /// /// is null; /// the surface level outside point in is null. /// /// - public static Point2D[] CreateSurfaceLevelOutsidePoint(MacroStabilityInwardsSurfaceLine surfaceLine) + public static IEnumerable CreateSurfaceLevelOutsidePoint(MacroStabilityInwardsSurfaceLine surfaceLine) { return GetLocalPointsFromGeometry(surfaceLine, surfaceLine?.SurfaceLevelOutside); } @@ -66,13 +65,13 @@ /// Create a dike top at river point in 2D space based on the provided . /// /// The surface line to create the dike top at river point for. - /// An array with a dike top at river point in 2D space or an empty array when: + /// A collection with a dike top at river point in 2D space or an empty collection when: /// /// is null; /// the dike top at river point in is null. /// /// - public static Point2D[] CreateDikeTopAtRiverPoint(MacroStabilityInwardsSurfaceLine surfaceLine) + public static IEnumerable CreateDikeTopAtRiverPoint(MacroStabilityInwardsSurfaceLine surfaceLine) { return GetLocalPointsFromGeometry(surfaceLine, surfaceLine?.DikeTopAtRiver); } @@ -81,13 +80,13 @@ /// Create a dike toe at river point in 2D space based on the provided . /// /// The surface line to create the dike toe at river point for. - /// An array with a dike toe at river point in 2D space or an empty array when: + /// A collection with a dike toe at river point in 2D space or an empty collection when: /// /// is null; /// the dike toe at river point in is null. /// /// - public static Point2D[] CreateDikeToeAtRiverPoint(MacroStabilityInwardsSurfaceLine surfaceLine) + public static IEnumerable CreateDikeToeAtRiverPoint(MacroStabilityInwardsSurfaceLine surfaceLine) { return GetLocalPointsFromGeometry(surfaceLine, surfaceLine?.DikeToeAtRiver); } @@ -96,13 +95,13 @@ /// Create a dike top at polder point in 2D space based on the provided . /// /// The surface line to create the dike top at polder point for. - /// An array with a dike top at polder point in 2D space or an empty array when: + /// A collection with a dike top at polder point in 2D space or an empty collection when: /// /// is null; /// the dike top at polder point in is null. /// /// - public static Point2D[] CreateDikeTopAtPolderPoint(MacroStabilityInwardsSurfaceLine surfaceLine) + public static IEnumerable CreateDikeTopAtPolderPoint(MacroStabilityInwardsSurfaceLine surfaceLine) { return GetLocalPointsFromGeometry(surfaceLine, surfaceLine?.DikeTopAtPolder); } @@ -111,13 +110,13 @@ /// Create a shoulder base inside point in 2D space based on the provided . /// /// The surface line to create the shoulder base inside point for. - /// An array with a shoulder base inside point in 2D space or an empty array when: + /// A collection with a shoulder base inside point in 2D space or an empty collection when: /// /// is null; /// the shoulder base inside point in is null. /// /// - public static Point2D[] CreateShoulderBaseInsidePoint(MacroStabilityInwardsSurfaceLine surfaceLine) + public static IEnumerable CreateShoulderBaseInsidePoint(MacroStabilityInwardsSurfaceLine surfaceLine) { return GetLocalPointsFromGeometry(surfaceLine, surfaceLine?.ShoulderBaseInside); } @@ -126,13 +125,13 @@ /// Create a shoulder top inside point in 2D space based on the provided . /// /// The surface line to create the shoulder top inside point for. - /// An array with a shoulder top inside point in 2D space or an empty array when: + /// A collection with a shoulder top inside point in 2D space or an empty collection when: /// /// is null; /// the shoulder top inside point in is null. /// /// - public static Point2D[] CreateShoulderTopInsidePoint(MacroStabilityInwardsSurfaceLine surfaceLine) + public static IEnumerable CreateShoulderTopInsidePoint(MacroStabilityInwardsSurfaceLine surfaceLine) { return GetLocalPointsFromGeometry(surfaceLine, surfaceLine?.ShoulderTopInside); } @@ -141,13 +140,13 @@ /// Create a dike toe at polder point in 2D space based on the provided . /// /// The surface line to create the dike toe at polder point for. - /// An array with a dike toe at polder point in 2D space or an empty array when: + /// A collection with a dike toe at polder point in 2D space or an empty collection when: /// /// is null; /// the dike toe at polder point in is null. /// /// - public static Point2D[] CreateDikeToeAtPolderPoint(MacroStabilityInwardsSurfaceLine surfaceLine) + public static IEnumerable CreateDikeToeAtPolderPoint(MacroStabilityInwardsSurfaceLine surfaceLine) { return GetLocalPointsFromGeometry(surfaceLine, surfaceLine?.DikeToeAtPolder); } @@ -156,13 +155,13 @@ /// Create a ditch dike side point in 2D space based on the provided . /// /// The surface line to create the ditch dike side point for. - /// An array with a ditch dike side point in 2D space or an empty array when: + /// A collection with a ditch dike side point in 2D space or an empty collection when: /// /// is null; /// the ditch dike side point in is null. /// /// - public static Point2D[] CreateDitchDikeSidePoint(MacroStabilityInwardsSurfaceLine surfaceLine) + public static IEnumerable CreateDitchDikeSidePoint(MacroStabilityInwardsSurfaceLine surfaceLine) { return GetLocalPointsFromGeometry(surfaceLine, surfaceLine?.DitchDikeSide); } @@ -171,13 +170,13 @@ /// Create a bottom ditch dike side point in 2D space based on the provided . /// /// The surface line to create the bottom ditch dike side point for. - /// An array with a bottom ditch dike side point in 2D space or an empty array when: + /// A collection with a bottom ditch dike side point in 2D space or an empty collection when: /// /// is null; /// the bottom ditch dike side point in is null. /// /// - public static Point2D[] CreateBottomDitchDikeSidePoint(MacroStabilityInwardsSurfaceLine surfaceLine) + public static IEnumerable CreateBottomDitchDikeSidePoint(MacroStabilityInwardsSurfaceLine surfaceLine) { return GetLocalPointsFromGeometry(surfaceLine, surfaceLine?.BottomDitchDikeSide); } @@ -186,13 +185,13 @@ /// Create a bottom ditch polder side point in 2D space based on the provided . /// /// The surface line to create the bottom ditch polder side point for. - /// An array with a bottom ditch polder side point in 2D space or an empty array when: + /// A collection with a bottom ditch polder side point in 2D space or an empty collection when: /// /// is null; /// the bottom ditch polder side point in is null. /// /// - public static Point2D[] CreateBottomDitchPolderSidePoint(MacroStabilityInwardsSurfaceLine surfaceLine) + public static IEnumerable CreateBottomDitchPolderSidePoint(MacroStabilityInwardsSurfaceLine surfaceLine) { return GetLocalPointsFromGeometry(surfaceLine, surfaceLine?.BottomDitchPolderSide); } @@ -201,13 +200,13 @@ /// Create a surface level inside point in 2D space based on the provided . /// /// The surface line to create the surface level inside point for. - /// An array with a surface level inside point in 2D space or an empty array when: + /// A collection with a surface level inside point in 2D space or an empty collection when: /// /// is null; /// the surface level inside point in is null. /// /// - public static Point2D[] CreateSurfaceLevelInsidePoint(MacroStabilityInwardsSurfaceLine surfaceLine) + public static IEnumerable CreateSurfaceLevelInsidePoint(MacroStabilityInwardsSurfaceLine surfaceLine) { return GetLocalPointsFromGeometry(surfaceLine, surfaceLine?.SurfaceLevelInside); } @@ -216,13 +215,13 @@ /// Create a ditch polder side point in 2D space based on the provided . /// /// The surface line to create the ditch polder side point for. - /// An array with a ditch polder side point in 2D space or an empty array when: + /// A collection with a ditch polder side point in 2D space or an empty collection when: /// /// is null; /// the ditch polder side point in is null. /// /// - public static Point2D[] CreateDitchPolderSidePoint(MacroStabilityInwardsSurfaceLine surfaceLine) + public static IEnumerable CreateDitchPolderSidePoint(MacroStabilityInwardsSurfaceLine surfaceLine) { return GetLocalPointsFromGeometry(surfaceLine, surfaceLine?.DitchPolderSide); } @@ -231,25 +230,25 @@ /// Create an area of the outer ring in 2D space based on the provided . /// /// The soil layer to create the outer ring for. - /// A collection containing a single array of points in 2D space + /// A collection containing a single collection of points in 2D space /// or an empty collection when is null. - public static IEnumerable CreateOuterRingArea(MacroStabilityInwardsSoilLayer2D soilLayer) + public static IEnumerable> CreateOuterRingArea(MacroStabilityInwardsSoilLayer2D soilLayer) { return soilLayer != null - ? new List + ? new List> { soilLayer.OuterRing.Points.ToArray() } - : Enumerable.Empty(); + : Enumerable.Empty>(); } /// /// Create points of the phreatic line in 2D space based on the provided . /// /// The phreatic line to create the points for. - /// An array of points in 2D space or an empty array when + /// A collection of points in 2D space or an empty collection when /// is null. - public static Point2D[] CreatePhreaticLinePoints(MacroStabilityInwardsPhreaticLine phreaticLine) + public static IEnumerable CreatePhreaticLinePoints(MacroStabilityInwardsPhreaticLine phreaticLine) { return phreaticLine?.Geometry.ToArray() ?? new Point2D[0]; } @@ -261,26 +260,26 @@ /// The that may intersect with /// the and by doing that restricts the /// drawn height of it. - /// An array of points in 2D space or an empty array when: + /// A collection of points in 2D space or an empty collection when: /// /// is null; /// is null; /// The geometry of the is empty; /// The geometry of the is empty. /// /// - public static IEnumerable CreateWaternetZonePoints(MacroStabilityInwardsWaternetLine waternetLine, - MacroStabilityInwardsSurfaceLine surfaceLine) + public static IEnumerable> CreateWaternetZonePoints(MacroStabilityInwardsWaternetLine waternetLine, + MacroStabilityInwardsSurfaceLine surfaceLine) { if (waternetLine == null || surfaceLine == null || !waternetLine.Geometry.Any() || !waternetLine.PhreaticLine.Geometry.Any()) { return new Point2D[0][]; } - Point2D[] surfaceLineLocalGeometry = surfaceLine.LocalGeometry.ToArray(); - Point2D[] phreaticLineGeometry = new RoundedPoint2DCollection(2, waternetLine.PhreaticLine.Geometry).ToArray(); - Point2D[] waternetLineGeometry = new RoundedPoint2DCollection(2, waternetLine.Geometry).ToArray(); + IEnumerable surfaceLineLocalGeometry = surfaceLine.LocalGeometry.ToArray(); + IEnumerable phreaticLineGeometry = new RoundedPoint2DCollection(2, waternetLine.PhreaticLine.Geometry).ToArray(); + IEnumerable waternetLineGeometry = new RoundedPoint2DCollection(2, waternetLine.Geometry).ToArray(); return IsSurfaceLineAboveWaternetZone(surfaceLineLocalGeometry, waternetLineGeometry, phreaticLineGeometry) ? CreateZoneAreas(waternetLineGeometry, phreaticLineGeometry).ToArray() @@ -292,15 +291,15 @@ /// /// The grid to create the grid points for. /// The grid determination type. - /// An array of interpolated points in 2D space based on the provided - /// or an empty array when: + /// A collection of interpolated points in 2D space based on the provided + /// or an empty collection when: /// /// is null; /// is ; /// The grid boundaries are . /// /// - public static Point2D[] CreateGridPoints(MacroStabilityInwardsGrid grid, MacroStabilityInwardsGridDeterminationType gridDeterminationType) + public static IEnumerable CreateGridPoints(MacroStabilityInwardsGrid grid, MacroStabilityInwardsGridDeterminationType gridDeterminationType) { return gridDeterminationType == MacroStabilityInwardsGridDeterminationType.Automatic ? new Point2D[0] @@ -311,14 +310,14 @@ /// Creates grid points in 2D space based on the provided . /// /// The grid to create the grid points for. - /// An array of interpolated points in 2D space based on the provided - /// or an empty array when: + /// A collection of interpolated points in 2D space based on the provided + /// or an empty collection when: /// /// is null; /// The grid boundaries are . /// /// - public static Point2D[] CreateGridPoints(MacroStabilityInwardsGrid grid) + public static IEnumerable CreateGridPoints(MacroStabilityInwardsGrid grid) { if (grid == null || !AreGridSettingsValid(grid)) { @@ -344,9 +343,9 @@ /// Create points of the slip plane in 2D space based on the provided . /// /// The sliding curve to create the points for. - /// An array of points in 2D space or an empty array when + /// A collection of points in 2D space or an empty collection when /// is null or doesn't contain any slices. - public static Point2D[] CreateSlipPlanePoints(MacroStabilityInwardsSlidingCurve slidingCurve) + public static IEnumerable CreateSlipPlanePoints(MacroStabilityInwardsSlidingCurve slidingCurve) { if (slidingCurve == null || !slidingCurve.Slices.Any()) { @@ -363,9 +362,9 @@ /// Create points of the left circle radius in 2D space based on the provided . /// /// The sliding curve to create the points for. - /// An array of points in 2D space or an empty array when + /// A collection of points in 2D space or an empty collection when /// is null or doesn't contain any slices. - public static Point2D[] CreateLeftCircleRadiusPoints(MacroStabilityInwardsSlidingCurve slidingCurve) + public static IEnumerable CreateLeftCircleRadiusPoints(MacroStabilityInwardsSlidingCurve slidingCurve) { if (slidingCurve == null || !slidingCurve.Slices.Any()) { @@ -383,9 +382,9 @@ /// Create points of the right circle radius in 2D space based on the provided . /// /// The sliding curve to create the points for. - /// An array of points in 2D space or an empty array when + /// A collection of points in 2D space or an empty collection when /// is null or doesn't contain any slices. - public static Point2D[] CreateRightCircleRadiusPoints(MacroStabilityInwardsSlidingCurve slidingCurve) + public static IEnumerable CreateRightCircleRadiusPoints(MacroStabilityInwardsSlidingCurve slidingCurve) { if (slidingCurve == null || !slidingCurve.Slices.Any()) { @@ -406,14 +405,14 @@ /// The tangent line Z-coordinates. /// The surface line that determines the horizontal boundaries /// of the tangent lines. - /// A collection of arrays of points in 2D space or an empty collection when + /// A collection of collections of points in 2D space or an empty collection when /// or is null. - public static IEnumerable CreateTangentLines(IEnumerable tangentLines, - MacroStabilityInwardsSurfaceLine surfaceLine) + public static IEnumerable> CreateTangentLines(IEnumerable tangentLines, + MacroStabilityInwardsSurfaceLine surfaceLine) { if (surfaceLine == null || tangentLines == null) { - return Enumerable.Empty(); + return Enumerable.Empty>(); } return tangentLines.Select(tangentLine => new[] @@ -435,7 +434,7 @@ /// The amount of tangent lines to display. /// The surface line that determines the horizontal boundaries /// of the tangent lines. - /// A collection of arrays of points in 2D space or an empty collection when: + /// A collection of collections of points in 2D space or an empty collection when: /// /// is ; /// is ; @@ -444,12 +443,12 @@ /// is or infinity. /// /// - public static IEnumerable CreateTangentLines(MacroStabilityInwardsGridDeterminationType gridDeterminationType, - MacroStabilityInwardsTangentLineDeterminationType tangentLineDeterminationType, - RoundedDouble tangentLineBottom, - RoundedDouble tangentLineTop, - int tangentLineNumber, - MacroStabilityInwardsSurfaceLine surfaceLine) + public static IEnumerable> CreateTangentLines(MacroStabilityInwardsGridDeterminationType gridDeterminationType, + MacroStabilityInwardsTangentLineDeterminationType tangentLineDeterminationType, + RoundedDouble tangentLineBottom, + RoundedDouble tangentLineTop, + int tangentLineNumber, + MacroStabilityInwardsSurfaceLine surfaceLine) { if (gridDeterminationType == MacroStabilityInwardsGridDeterminationType.Automatic || tangentLineDeterminationType == MacroStabilityInwardsTangentLineDeterminationType.LayerSeparated @@ -458,89 +457,13 @@ || double.IsNaN(tangentLineTop) || double.IsInfinity(tangentLineTop)) { - return Enumerable.Empty(); + return Enumerable.Empty>(); } return CreateTangentLines(GetInterPolatedVerticalPositions(tangentLineTop, tangentLineBottom, tangentLineNumber), surfaceLine); } - /// - /// Create lines of the slices based on the provided . - /// - /// The slices to create the areas for. - /// A collection of arrays of points in 2D space or an empty collection when - /// is null. - public static IEnumerable CreateSliceAreas(IEnumerable slices) - { - if (slices == null) - { - return Enumerable.Empty(); - } - - return slices.Select(slice => new[] - { - slice.TopLeftPoint, - slice.TopRightPoint, - slice.BottomRightPoint, - slice.BottomLeftPoint - }); - } - - /// - /// Creates the areas for a parameter in the slices present - /// in . - /// - /// The sliding curve to get the slices from. - /// The name of the property in . - /// The factor to decrease the parameter value by when determining - /// the bar height. - /// A collection of containing areas representing the - /// slice output values, or an empty collection when: - /// - /// or is null; - /// The property with the name does not exist on the - /// . - /// - /// - /// Thrown when more than one property is found with - /// the specified name. - public static IEnumerable CreateSliceParameterAreas(MacroStabilityInwardsSlidingCurve slidingCurve, - string parameterName, - int scaleFactor) - { - if (slidingCurve == null || parameterName == null) - { - return Enumerable.Empty(); - } - - var areas = new List(); - foreach (MacroStabilityInwardsSlice slice in slidingCurve.Slices) - { - var value = (RoundedDouble?) slice.GetType().GetProperty(parameterName)?.GetValue(slice, null); - if (value.HasValue) - { - double offset = value.Value / scaleFactor; - double xLength = slice.BottomLeftPoint.X - slice.BottomRightPoint.X; - double yLength = slice.BottomLeftPoint.Y - slice.BottomRightPoint.Y; - - double length = Math.Sqrt(Math.Pow(xLength, 2) + - Math.Pow(yLength, 2)); - - areas.Add(new[] - { - slice.BottomLeftPoint, - slice.BottomRightPoint, - new Point2D(slice.BottomRightPoint.X + offset * -yLength / length, - slice.BottomRightPoint.Y + offset * xLength / length), - new Point2D(slice.BottomLeftPoint.X + offset * -yLength / length, - slice.BottomLeftPoint.Y + offset * xLength / length) - }); - } - } - return areas; - } - #region General Helpers private static IEnumerable GetInterPolatedVerticalPositions(RoundedDouble startPoint, @@ -574,8 +497,8 @@ #region SoilLayers and Surface Line Helpers - private static Point2D[] GetLocalPointsFromGeometry(MacroStabilityInwardsSurfaceLine surfaceLine, - Point3D worldCoordinate) + private static IEnumerable GetLocalPointsFromGeometry(MacroStabilityInwardsSurfaceLine surfaceLine, + Point3D worldCoordinate) { if (surfaceLine == null || worldCoordinate == null) { @@ -632,23 +555,23 @@ #region Waternet Helpers - private static IEnumerable GetWaternetZoneWithSurfaceLineIntersection(Point2D[] surfaceLineLocalGeometry, - Point2D[] waternetLineGeometry, - Point2D[] phreaticLineGeometry) + private static IEnumerable> GetWaternetZoneWithSurfaceLineIntersection(IEnumerable surfaceLineLocalGeometry, + IEnumerable waternetLineGeometry, + IEnumerable phreaticLineGeometry) { - IEnumerable waternetZoneAsPolygons = CreateZoneAreas(waternetLineGeometry, phreaticLineGeometry); + IEnumerable> waternetZoneAsPolygons = CreateZoneAreas(waternetLineGeometry, phreaticLineGeometry); - foreach (Point2D[] waternetZoneAsPolygon in waternetZoneAsPolygons) + foreach (IEnumerable waternetZoneAsPolygon in waternetZoneAsPolygons) { - Point2D[] areaPoints = ClipWaternetZoneToSurfaceLine(surfaceLineLocalGeometry, waternetZoneAsPolygon); + IEnumerable areaPoints = ClipWaternetZoneToSurfaceLine(surfaceLineLocalGeometry, waternetZoneAsPolygon); if (areaPoints.Any()) { yield return areaPoints; } } } - private static Point2D[] ClipWaternetZoneToSurfaceLine(Point2D[] surfaceLineLocalGeometry, Point2D[] waternetZoneAsPolygon) + private static IEnumerable ClipWaternetZoneToSurfaceLine(IEnumerable surfaceLineLocalGeometry, IEnumerable waternetZoneAsPolygon) { double leftX = waternetZoneAsPolygon.Min(p => p.X); double rightX = waternetZoneAsPolygon.Max(p => p.X); @@ -684,7 +607,7 @@ foreach (double xCoordinate in allXCoordinates) { Point2D surfaceLineIntersection = Math2D.SegmentsIntersectionWithVerticalLine(surfaceLineSegments, xCoordinate).First(); - Point2D[] waternetZoneIntersection = Math2D.SegmentsIntersectionWithVerticalLine(waternetZoneSegments, xCoordinate).Distinct().ToArray(); + IEnumerable waternetZoneIntersection = Math2D.SegmentsIntersectionWithVerticalLine(waternetZoneSegments, xCoordinate).Distinct().ToArray(); if (waternetZoneIntersection.Any()) { @@ -727,27 +650,26 @@ return area.ToArray(); } - private static bool AreaIsNotFlatLine(List topLine, List bottomLine) + private static bool AreaIsNotFlatLine(IEnumerable topLine, IEnumerable bottomLine) { - Point2D[] topLineCoordinates = topLine.ToArray(); - Point2D[] bottomLineCoordinates = bottomLine.ToArray(); - - return topLineCoordinates.Length != bottomLineCoordinates.Length - || topLineCoordinates.Where((t, i) => !(Math.Abs(t.X - bottomLineCoordinates[i].X) < 1e-6) - || !(Math.Abs(t.Y - bottomLineCoordinates[i].Y) < 1e-6)).Any(); + return topLine.Count() != bottomLine.Count() + || topLine.Where((t, i) => !(Math.Abs(t.X - bottomLine.ElementAt(i).X) < 1e-6) + || !(Math.Abs(t.Y - bottomLine.ElementAt(i).Y) < 1e-6)).Any(); } - private static bool IsSurfaceLineAboveWaternetZone(Point2D[] surfaceLineLocalGeometry, Point2D[] waternetLineGeometry, Point2D[] phreaticLineGeometry) + private static bool IsSurfaceLineAboveWaternetZone(IEnumerable surfaceLineLocalGeometry, + IEnumerable waternetLineGeometry, + IEnumerable phreaticLineGeometry) { double surfaceLineLowestPointY = surfaceLineLocalGeometry.Min(p => p.Y); double waternetZoneHeighestPointY = Math.Max(waternetLineGeometry.Max(p => p.Y), phreaticLineGeometry.Max(p => p.Y)); return surfaceLineLowestPointY >= waternetZoneHeighestPointY; } - private static IEnumerable CreateZoneAreas(Point2D[] waternetLineGeometry, Point2D[] phreaticLineGeometry) + private static IEnumerable> CreateZoneAreas(IEnumerable waternetLineGeometry, IEnumerable phreaticLineGeometry) { - var areas = new List(); + var areas = new List>(); Segment2D[] phreaticLineSegments = Math2D.ConvertLinePointsToLineSegments(phreaticLineGeometry).ToArray(); Segment2D[] waternetLineSegments = Math2D.ConvertLinePointsToLineSegments(waternetLineGeometry).ToArray(); Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsSliceChartDataPointsFactory.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsSliceChartDataPointsFactory.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsSliceChartDataPointsFactory.cs (revision a2226e0827c68aa2434d4f390cde53de1d410fbf) @@ -0,0 +1,291 @@ +// Copyright (C) Stichting Deltares 2017. 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 System.Linq; +using Core.Common.Base.Data; +using Core.Common.Base.Geometry; +using Core.Components.Chart.Data; +using Ringtoets.MacroStabilityInwards.Data; + +namespace Ringtoets.MacroStabilityInwards.Forms.Factories +{ + /// + /// Factory for creating collections of points in 2D space for a collection of + /// to use in . + /// (created via ). + /// + internal static class MacroStabilityInwardsSliceChartDataPointsFactory + { + /// + /// Create lines of the slices based on the provided . + /// + /// The containing the slices + /// to create the areas for. + /// A collection of collections of points in 2D space or an empty collection when + /// is null. + public static IEnumerable> CreateSliceAreas(MacroStabilityInwardsSlidingCurve slidingCurve) + { + if (slidingCurve == null) + { + return Enumerable.Empty(); + } + + return slidingCurve.Slices.Select(slice => new[] + { + slice.TopLeftPoint, + slice.TopRightPoint, + slice.BottomRightPoint, + slice.BottomLeftPoint + }); + } + + /// + /// Creates the areas for + /// values in . + /// + /// The to + /// get the slices from. + /// A collection of collections of points in 2D space containing areas representing the + /// slice output values, or an empty collection when is null. + /// + public static IEnumerable> CreateCohesionAreas(MacroStabilityInwardsSlidingCurve slidingCurve) + { + return CreateParameterAreas(slidingCurve?.Slices, slice => slice.Cohesion, 0.125); + } + + /// + /// Creates the areas for + /// values in . + /// + /// The to + /// get the slices from. + /// A collection of collections of points in 2D space containing areas representing the + /// slice output values, or an empty collection when is null. + /// + public static IEnumerable> CreateEffectiveStressAreas(MacroStabilityInwardsSlidingCurve slidingCurve) + { + return CreateParameterAreas(slidingCurve?.Slices, slice => slice.EffectiveStress, 0.125); + } + + /// + /// Creates the areas for + /// values in . + /// + /// The to + /// get the slices from. + /// A collection of collections of points in 2D space containing areas representing the + /// slice output values, or an empty collection when is null. + /// + public static IEnumerable> CreateEffectiveStressDailyAreas(MacroStabilityInwardsSlidingCurve slidingCurve) + { + return CreateParameterAreas(slidingCurve?.Slices, slice => slice.EffectiveStressDaily, 0.125); + } + + /// + /// Creates the areas for + /// values in . + /// + /// The to + /// get the slices from. + /// A collection of collections of points in 2D space containing areas representing the + /// slice output values, or an empty collection when is null. + /// + public static IEnumerable> CreateTotalPorePressureAreas(MacroStabilityInwardsSlidingCurve slidingCurve) + { + return CreateParameterAreas(slidingCurve?.Slices, slice => slice.TotalPorePressure, 0.125); + } + + /// + /// Creates the areas for + /// values in . + /// + /// The to + /// get the slices from. + /// A collection of collections of points in 2D space containing areas representing the + /// slice output values, or an empty collection when is null. + /// + public static IEnumerable> CreateWeightAreas(MacroStabilityInwardsSlidingCurve slidingCurve) + { + return CreateParameterAreas(slidingCurve?.Slices, slice => slice.Weight, 0.125); + } + + /// + /// Creates the areas for + /// values in . + /// + /// The to + /// get the slices from. + /// A collection of collections of points in 2D space containing areas representing the + /// slice output values, or an empty collection when is null. + /// + public static IEnumerable> CreatePiezometricPorePressureAreas(MacroStabilityInwardsSlidingCurve slidingCurve) + { + return CreateParameterAreas(slidingCurve?.Slices, slice => slice.PiezometricPorePressure, 0.125); + } + + /// + /// Creates the areas for + /// values in . + /// + /// The to + /// get the slices from. + /// A collection of collections of points in 2D space containing areas representing the + /// slice output values, or an empty collection when is null. + /// + public static IEnumerable> CreatePorePressureAreas(MacroStabilityInwardsSlidingCurve slidingCurve) + { + return CreateParameterAreas(slidingCurve?.Slices, slice => slice.PorePressure, 0.125); + } + + /// + /// Creates the areas for + /// values in . + /// + /// The to + /// get the slices from. + /// A collection of collections of points in 2D space containing areas representing the + /// slice output values, or an empty collection when is null. + /// + public static IEnumerable> CreateVerticalPorePressureAreas(MacroStabilityInwardsSlidingCurve slidingCurve) + { + return CreateParameterAreas(slidingCurve?.Slices, slice => slice.VerticalPorePressure, 0.125); + } + + /// + /// Creates the areas for + /// values in . + /// + /// The to + /// get the slices from. + /// A collection of collections of points in 2D space containing areas representing the + /// slice output values, or an empty collection when is null. + /// + public static IEnumerable> CreateHorizontalPorePressureAreas(MacroStabilityInwardsSlidingCurve slidingCurve) + { + return CreateParameterAreas(slidingCurve?.Slices, slice => slice.HorizontalPorePressure, 0.125); + } + + /// + /// Creates the areas for + /// values in . + /// + /// The to + /// get the slices from. + /// A collection of collections of points in 2D space containing areas representing the + /// slice output values, or an empty collection when is null. + /// + public static IEnumerable> CreateOverConsolidationRatioAreas(MacroStabilityInwardsSlidingCurve slidingCurve) + { + return CreateParameterAreas(slidingCurve?.Slices, slice => slice.OverConsolidationRatio, 0.05); + } + + /// + /// Creates the areas for + /// values in . + /// + /// The to + /// get the slices from. + /// A collection of collections of points in 2D space containing areas representing the + /// slice output values, or an empty collection when is null. + /// + public static IEnumerable> CreatePopAreas(MacroStabilityInwardsSlidingCurve slidingCurve) + { + return CreateParameterAreas(slidingCurve?.Slices, slice => slice.Pop, 0.125); + } + + /// + /// Creates the areas for + /// values in . + /// + /// The to + /// get the slices from. + /// A collection of collections of points in 2D space containing areas representing the + /// slice output values, or an empty collection when is null. + /// + public static IEnumerable> CreateNormalStressAreas(MacroStabilityInwardsSlidingCurve slidingCurve) + { + return CreateParameterAreas(slidingCurve?.Slices, slice => slice.NormalStress, 0.125); + } + + /// + /// Creates the areas for + /// values in . + /// + /// The to + /// get the slices from. + /// A collection of collections of points in 2D space containing areas representing the + /// slice output values, or an empty collection when is null. + /// + public static IEnumerable> CreateShearStressAreas(MacroStabilityInwardsSlidingCurve slidingCurve) + { + return CreateParameterAreas(slidingCurve?.Slices, slice => slice.ShearStress, 0.125); + } + + /// + /// Creates the areas for + /// values in . + /// + /// The to + /// get the slices from. + /// A collection of collections of points in 2D space containing areas representing the + /// slice output values, or an empty collection when is null. + /// + public static IEnumerable> CreateLoadStressAreas(MacroStabilityInwardsSlidingCurve slidingCurve) + { + return CreateParameterAreas(slidingCurve?.Slices, slice => slice.LoadStress, 0.125); + } + + private static IEnumerable> CreateParameterAreas(IEnumerable slices, + Func getParameterFunc, + double scaleFactor) + { + if (slices == null || getParameterFunc == null) + { + return Enumerable.Empty(); + } + + var areas = new List(); + foreach (MacroStabilityInwardsSlice slice in slices) + { + RoundedDouble value = getParameterFunc.Invoke(slice); + double offset = value.Value * scaleFactor; + double deltaX = slice.BottomLeftPoint.X - slice.BottomRightPoint.X; + double deltaY = slice.BottomLeftPoint.Y - slice.BottomRightPoint.Y; + + double length = Math.Sqrt(Math.Pow(deltaX, 2) + + Math.Pow(deltaY, 2)); + + areas.Add(new[] + { + slice.BottomLeftPoint, + slice.BottomRightPoint, + new Point2D(slice.BottomRightPoint.X + offset * -deltaY / length, + slice.BottomRightPoint.Y + offset * deltaX / length), + new Point2D(slice.BottomLeftPoint.X + offset * -deltaY / length, + slice.BottomLeftPoint.Y + offset * deltaX / length) + }); + } + return areas; + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r117a54dfd9b5972086a1f3386923edda2e7a334b -ra2226e0827c68aa2434d4f390cde53de1d410fbf --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 117a54dfd9b5972086a1f3386923edda2e7a334b) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision a2226e0827c68aa2434d4f390cde53de1d410fbf) @@ -1373,9 +1373,9 @@ /// /// Looks up a localized string similar to Uitvoer per lamel. /// - public static string SliceParameters { + public static string SliceParameters_DisplayName { get { - return ResourceManager.GetString("SliceParameters", resourceCulture); + return ResourceManager.GetString("SliceParameters_DisplayName", resourceCulture); } } Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.resx =================================================================== diff -u -r117a54dfd9b5972086a1f3386923edda2e7a334b -ra2226e0827c68aa2434d4f390cde53de1d410fbf --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.resx (.../Resources.resx) (revision 117a54dfd9b5972086a1f3386923edda2e7a334b) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.resx (.../Resources.resx) (revision a2226e0827c68aa2434d4f390cde53de1d410fbf) @@ -736,7 +736,7 @@ Zoneringsgrens rechts - + Uitvoer per lamel Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Ringtoets.MacroStabilityInwards.Forms.csproj =================================================================== diff -u -r63fc151e9cf722527465c1eddfa6567a90feb5e6 -ra2226e0827c68aa2434d4f390cde53de1d410fbf --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Ringtoets.MacroStabilityInwards.Forms.csproj (.../Ringtoets.MacroStabilityInwards.Forms.csproj) (revision 63fc151e9cf722527465c1eddfa6567a90feb5e6) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Ringtoets.MacroStabilityInwards.Forms.csproj (.../Ringtoets.MacroStabilityInwards.Forms.csproj) (revision a2226e0827c68aa2434d4f390cde53de1d410fbf) @@ -17,6 +17,7 @@ + Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsOutputChartControl.cs =================================================================== diff -u -r117a54dfd9b5972086a1f3386923edda2e7a334b -ra2226e0827c68aa2434d4f390cde53de1d410fbf --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsOutputChartControl.cs (.../MacroStabilityInwardsOutputChartControl.cs) (revision 117a54dfd9b5972086a1f3386923edda2e7a334b) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsOutputChartControl.cs (.../MacroStabilityInwardsOutputChartControl.cs) (revision a2226e0827c68aa2434d4f390cde53de1d410fbf) @@ -255,56 +255,28 @@ slipPlaneChartData.Points = MacroStabilityInwardsChartDataPointsFactory.CreateSlipPlanePoints(output?.SlidingCurve); leftCircleRadiusChartData.Points = MacroStabilityInwardsChartDataPointsFactory.CreateLeftCircleRadiusPoints(output?.SlidingCurve); rightCircleRadiusChartData.Points = MacroStabilityInwardsChartDataPointsFactory.CreateRightCircleRadiusPoints(output?.SlidingCurve); - slicesChartData.Areas = MacroStabilityInwardsChartDataPointsFactory.CreateSliceAreas(output?.SlidingCurve.Slices); + slicesChartData.Areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateSliceAreas(output?.SlidingCurve); tangentLinesChartData.Lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines(output?.SlipPlane.TangentLines, data.InputParameters.SurfaceLine); - SetSliceParameterChartData(output); + SetSliceParameterChartData(output?.SlidingCurve); } - private void SetSliceParameterChartData(MacroStabilityInwardsOutput output) + private void SetSliceParameterChartData(MacroStabilityInwardsSlidingCurve slidingCurve) { - sliceCohesionChartData.Areas = - MacroStabilityInwardsChartDataPointsFactory.CreateSliceParameterAreas(output?.SlidingCurve, - nameof(MacroStabilityInwardsSlice.Cohesion), 8); - sliceEffectiveStressChartData.Areas = - MacroStabilityInwardsChartDataPointsFactory.CreateSliceParameterAreas(output?.SlidingCurve, - nameof(MacroStabilityInwardsSlice.EffectiveStress), 8); - sliceEffectiveStressDailyChartData.Areas = - MacroStabilityInwardsChartDataPointsFactory.CreateSliceParameterAreas(output?.SlidingCurve, - nameof(MacroStabilityInwardsSlice.EffectiveStressDaily), 8); - sliceTotalPorePressureChartData.Areas = - MacroStabilityInwardsChartDataPointsFactory.CreateSliceParameterAreas(output?.SlidingCurve, - nameof(MacroStabilityInwardsSlice.TotalPorePressure), 8); - sliceWeightChartData.Areas = - MacroStabilityInwardsChartDataPointsFactory.CreateSliceParameterAreas(output?.SlidingCurve, - nameof(MacroStabilityInwardsSlice.Weight), 8); - slicePiezometricPorePressureChartData.Areas = - MacroStabilityInwardsChartDataPointsFactory.CreateSliceParameterAreas(output?.SlidingCurve, - nameof(MacroStabilityInwardsSlice.PiezometricPorePressure), 8); - slicePorePressureChartData.Areas = - MacroStabilityInwardsChartDataPointsFactory.CreateSliceParameterAreas(output?.SlidingCurve, - nameof(MacroStabilityInwardsSlice.PorePressure), 8); - sliceVerticalPorePressureChartData.Areas = - MacroStabilityInwardsChartDataPointsFactory.CreateSliceParameterAreas(output?.SlidingCurve, - nameof(MacroStabilityInwardsSlice.VerticalPorePressure), 8); - sliceHorizontalPorePressureChartData.Areas = - MacroStabilityInwardsChartDataPointsFactory.CreateSliceParameterAreas(output?.SlidingCurve, - nameof(MacroStabilityInwardsSlice.HorizontalPorePressure), 8); - sliceOverConsolidationRatioChartData.Areas = - MacroStabilityInwardsChartDataPointsFactory.CreateSliceParameterAreas(output?.SlidingCurve, - nameof(MacroStabilityInwardsSlice.OverConsolidationRatio), 20); - slicePopChartData.Areas = - MacroStabilityInwardsChartDataPointsFactory.CreateSliceParameterAreas(output?.SlidingCurve, - nameof(MacroStabilityInwardsSlice.Pop), 8); - sliceNormalStressChartData.Areas = - MacroStabilityInwardsChartDataPointsFactory.CreateSliceParameterAreas(output?.SlidingCurve, - nameof(MacroStabilityInwardsSlice.NormalStress), 8); - sliceShearStressChartData.Areas = - MacroStabilityInwardsChartDataPointsFactory.CreateSliceParameterAreas(output?.SlidingCurve, - nameof(MacroStabilityInwardsSlice.ShearStress), 8); - sliceLoadStressChartData.Areas = - MacroStabilityInwardsChartDataPointsFactory.CreateSliceParameterAreas(output?.SlidingCurve, - nameof(MacroStabilityInwardsSlice.LoadStress), 8); + sliceCohesionChartData.Areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateCohesionAreas(slidingCurve); + sliceEffectiveStressChartData.Areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateEffectiveStressAreas(slidingCurve); + sliceEffectiveStressDailyChartData.Areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateEffectiveStressDailyAreas(slidingCurve); + sliceTotalPorePressureChartData.Areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateTotalPorePressureAreas(slidingCurve); + sliceWeightChartData.Areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateWeightAreas(slidingCurve); + slicePiezometricPorePressureChartData.Areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreatePiezometricPorePressureAreas(slidingCurve); + slicePorePressureChartData.Areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreatePorePressureAreas(slidingCurve); + sliceVerticalPorePressureChartData.Areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateVerticalPorePressureAreas(slidingCurve); + sliceHorizontalPorePressureChartData.Areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateHorizontalPorePressureAreas(slidingCurve); + sliceOverConsolidationRatioChartData.Areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateOverConsolidationRatioAreas(slidingCurve); + slicePopChartData.Areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreatePopAreas(slidingCurve); + sliceNormalStressChartData.Areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateNormalStressAreas(slidingCurve); + sliceShearStressChartData.Areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateShearStressAreas(slidingCurve); + sliceLoadStressChartData.Areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateLoadStressAreas(slidingCurve); } private void UpdateInputChartData() Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Factories/MacroStabilityInwardsChartDataPointsFactoryTest.cs =================================================================== diff -u -r117a54dfd9b5972086a1f3386923edda2e7a334b -ra2226e0827c68aa2434d4f390cde53de1d410fbf --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Factories/MacroStabilityInwardsChartDataPointsFactoryTest.cs (.../MacroStabilityInwardsChartDataPointsFactoryTest.cs) (revision 117a54dfd9b5972086a1f3386923edda2e7a334b) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Factories/MacroStabilityInwardsChartDataPointsFactoryTest.cs (.../MacroStabilityInwardsChartDataPointsFactoryTest.cs) (revision a2226e0827c68aa2434d4f390cde53de1d410fbf) @@ -38,53 +38,53 @@ public class MacroStabilityInwardsChartDataPointsFactoryTest { [Test] - public void CreateSurfaceLinePoints_SurfaceLineNull_ReturnsEmptyPointsArray() + public void CreateSurfaceLinePoints_SurfaceLineNull_ReturnsEmptyPointsCollection() { // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateSurfaceLinePoints(null); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateSurfaceLinePoints(null); // Assert CollectionAssert.IsEmpty(points); } [Test] - public void CreateSurfaceLinePoints_GivenSurfaceLine_ReturnsSurfaceLinePointsArray() + public void CreateSurfaceLinePoints_GivenSurfaceLine_ReturnsSurfaceLinePointsCollection() { // Setup MacroStabilityInwardsSurfaceLine surfaceLine = GetSurfaceLineWithGeometry(); // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateSurfaceLinePoints(surfaceLine); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateSurfaceLinePoints(surfaceLine); // Assert AssertEqualPointCollection(surfaceLine.LocalGeometry, points); } [Test] - public void CreateSurfaceLevelOutsidePoint_SurfaceLineNull_ReturnsEmptyPointsArray() + public void CreateSurfaceLevelOutsidePoint_SurfaceLineNull_ReturnsEmptyPointsCollection() { // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateSurfaceLevelOutsidePoint(null); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateSurfaceLevelOutsidePoint(null); // Assert CollectionAssert.IsEmpty(points); } [Test] - public void CreateSurfaceLevelOutsidePoint_SurfaceLevelOutsideNull_ReturnsEmptyPointsArray() + public void CreateSurfaceLevelOutsidePoint_SurfaceLevelOutsideNull_ReturnsEmptyPointsCollection() { // Setup MacroStabilityInwardsSurfaceLine surfaceLine = GetSurfaceLineWithGeometry(); // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateSurfaceLevelOutsidePoint(surfaceLine); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateSurfaceLevelOutsidePoint(surfaceLine); // Assert CollectionAssert.IsEmpty(points); } [Test] - public void CreateSurfaceLevelOutsidePoint_GivenSurfaceLineWithSurfaceLevelOutside_ReturnsSurfaceLevelOutsideArray() + public void CreateSurfaceLevelOutsidePoint_GivenSurfaceLineWithSurfaceLevelOutside_ReturnsSurfaceLevelOutsideCollection() { // Setup var surfaceLevelOutside = new Point3D(1.2, 2.3, 4.0); @@ -93,37 +93,37 @@ surfaceLine.SetSurfaceLevelOutsideAt(surfaceLevelOutside); // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateSurfaceLevelOutsidePoint(surfaceLine); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateSurfaceLevelOutsidePoint(surfaceLine); // Assert AssertEqualLocalPointCollection(surfaceLevelOutside, surfaceLine, points); } [Test] - public void CreateDikeToeAtRiverPoint_SurfaceLineNull_ReturnsEmptyPointsArray() + public void CreateDikeToeAtRiverPoint_SurfaceLineNull_ReturnsEmptyPointsCollection() { // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateDikeToeAtRiverPoint(null); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateDikeToeAtRiverPoint(null); // Assert CollectionAssert.IsEmpty(points); } [Test] - public void CreateDikeToeAtRiverPoint_SurfaceLevelOutsideNull_ReturnsEmptyPointsArray() + public void CreateDikeToeAtRiverPoint_SurfaceLevelOutsideNull_ReturnsEmptyPointsCollection() { // Setup MacroStabilityInwardsSurfaceLine surfaceLine = GetSurfaceLineWithGeometry(); // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateDikeToeAtRiverPoint(surfaceLine); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateDikeToeAtRiverPoint(surfaceLine); // Assert CollectionAssert.IsEmpty(points); } [Test] - public void CreateDikeToeAtRiverPoint_GivenSurfaceLineWithDikeToeAtRiver_ReturnsDikeToeAtRiverPointsArray() + public void CreateDikeToeAtRiverPoint_GivenSurfaceLineWithDikeToeAtRiver_ReturnsDikeToeAtRiverPointsCollection() { // Setup var dikeToeAtRiver = new Point3D(1.2, 2.3, 4.0); @@ -132,37 +132,37 @@ surfaceLine.SetDikeToeAtRiverAt(dikeToeAtRiver); // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateDikeToeAtRiverPoint(surfaceLine); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateDikeToeAtRiverPoint(surfaceLine); // Assert AssertEqualLocalPointCollection(dikeToeAtRiver, surfaceLine, points); } [Test] - public void CreateDikeTopAtPolderPoint_SurfaceLineNull_ReturnsEmptyPointsArray() + public void CreateDikeTopAtPolderPoint_SurfaceLineNull_ReturnsEmptyPointsCollection() { // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateDikeTopAtPolderPoint(null); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateDikeTopAtPolderPoint(null); // Assert CollectionAssert.IsEmpty(points); } [Test] - public void CreateDikeTopAtPolderPoint_DikeTopAtPolderNull_ReturnsEmptyPointsArray() + public void CreateDikeTopAtPolderPoint_DikeTopAtPolderNull_ReturnsEmptyPointsCollection() { // Setup MacroStabilityInwardsSurfaceLine surfaceLine = GetSurfaceLineWithGeometry(); // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateDikeTopAtPolderPoint(surfaceLine); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateDikeTopAtPolderPoint(surfaceLine); // Assert CollectionAssert.IsEmpty(points); } [Test] - public void CreateDikeTopAtPolderPoint_GivenSurfaceLineWithDikeTopAtPolder_ReturnsDikeTopAtPolderPointsArray() + public void CreateDikeTopAtPolderPoint_GivenSurfaceLineWithDikeTopAtPolder_ReturnsDikeTopAtPolderPointsCollection() { // Setup var dikeTopAtPolder = new Point3D(1.2, 2.3, 4.0); @@ -171,37 +171,37 @@ surfaceLine.SetDikeTopAtPolderAt(dikeTopAtPolder); // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateDikeTopAtPolderPoint(surfaceLine); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateDikeTopAtPolderPoint(surfaceLine); // Assert AssertEqualLocalPointCollection(dikeTopAtPolder, surfaceLine, points); } [Test] - public void CreateShoulderBaseInsidePoint_SurfaceLineNull_ReturnsEmptyPointsArray() + public void CreateShoulderBaseInsidePoint_SurfaceLineNull_ReturnsEmptyPointsCollection() { // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateShoulderBaseInsidePoint(null); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateShoulderBaseInsidePoint(null); // Assert CollectionAssert.IsEmpty(points); } [Test] - public void CreateShoulderBaseInsidePoint_ShoulderBaseInsideNull_ReturnsEmptyPointsArray() + public void CreateShoulderBaseInsidePoint_ShoulderBaseInsideNull_ReturnsEmptyPointsCollection() { // Setup MacroStabilityInwardsSurfaceLine surfaceLine = GetSurfaceLineWithGeometry(); // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateShoulderBaseInsidePoint(surfaceLine); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateShoulderBaseInsidePoint(surfaceLine); // Assert CollectionAssert.IsEmpty(points); } [Test] - public void CreateShoulderBaseInsidePoint_GivenSurfaceLineWithShoulderBaseInside_ReturnsShoulderBaseInsidePointsArray() + public void CreateShoulderBaseInsidePoint_GivenSurfaceLineWithShoulderBaseInside_ReturnsShoulderBaseInsidePointsCollection() { // Setup var shoulderBaseInside = new Point3D(1.2, 2.3, 4.0); @@ -210,37 +210,37 @@ surfaceLine.SetShoulderBaseInsideAt(shoulderBaseInside); // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateShoulderBaseInsidePoint(surfaceLine); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateShoulderBaseInsidePoint(surfaceLine); // Assert AssertEqualLocalPointCollection(shoulderBaseInside, surfaceLine, points); } [Test] - public void CreateShoulderTopInsidePoint_SurfaceLineNull_ReturnsEmptyPointsArray() + public void CreateShoulderTopInsidePoint_SurfaceLineNull_ReturnsEmptyPointsCollection() { // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateShoulderTopInsidePoint(null); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateShoulderTopInsidePoint(null); // Assert CollectionAssert.IsEmpty(points); } [Test] - public void CreateShoulderTopInsidePoint_ShoulderTopInsideNull_ReturnsEmptyPointsArray() + public void CreateShoulderTopInsidePoint_ShoulderTopInsideNull_ReturnsEmptyPointsCollection() { // Setup MacroStabilityInwardsSurfaceLine surfaceLine = GetSurfaceLineWithGeometry(); // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateShoulderTopInsidePoint(surfaceLine); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateShoulderTopInsidePoint(surfaceLine); // Assert CollectionAssert.IsEmpty(points); } [Test] - public void CreateShoulderTopInsidePoint_GivenSurfaceLineWithShoulderTopInside_ReturnsShoulderTopInsidePointsArray() + public void CreateShoulderTopInsidePoint_GivenSurfaceLineWithShoulderTopInside_ReturnsShoulderTopInsidePointsCollection() { // Setup var shoulderTopInside = new Point3D(1.2, 2.3, 4.0); @@ -249,37 +249,37 @@ surfaceLine.SetShoulderTopInsideAt(shoulderTopInside); // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateShoulderTopInsidePoint(surfaceLine); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateShoulderTopInsidePoint(surfaceLine); // Assert AssertEqualLocalPointCollection(shoulderTopInside, surfaceLine, points); } [Test] - public void CreateDikeToeAtPolderPoint_SurfaceLineNull_ReturnsEmptyPointsArray() + public void CreateDikeToeAtPolderPoint_SurfaceLineNull_ReturnsEmptyPointsCollection() { // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateDikeToeAtPolderPoint(null); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateDikeToeAtPolderPoint(null); // Assert CollectionAssert.IsEmpty(points); } [Test] - public void CreateDikeToeAtPolderPoint_DikeToeAtPolderNull_ReturnsEmptyPointsArray() + public void CreateDikeToeAtPolderPoint_DikeToeAtPolderNull_ReturnsEmptyPointsCollection() { // Setup MacroStabilityInwardsSurfaceLine surfaceLine = GetSurfaceLineWithGeometry(); // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateDikeToeAtPolderPoint(surfaceLine); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateDikeToeAtPolderPoint(surfaceLine); // Assert CollectionAssert.IsEmpty(points); } [Test] - public void CreateDikeToeAtPolderPoint_GivenSurfaceLineWithDikeToeAtPolder_ReturnsDikeToeAtPolderPointsArray() + public void CreateDikeToeAtPolderPoint_GivenSurfaceLineWithDikeToeAtPolder_ReturnsDikeToeAtPolderPointsCollection() { // Setup var dikeToeAtPolder = new Point3D(1.2, 2.3, 4.0); @@ -288,37 +288,37 @@ surfaceLine.SetDikeToeAtPolderAt(dikeToeAtPolder); // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateDikeToeAtPolderPoint(surfaceLine); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateDikeToeAtPolderPoint(surfaceLine); // Assert AssertEqualLocalPointCollection(dikeToeAtPolder, surfaceLine, points); } [Test] - public void CreateDikeTopAtRiverPoint_SurfaceLineNull_ReturnsEmptyPointsArray() + public void CreateDikeTopAtRiverPoint_SurfaceLineNull_ReturnsEmptyPointsCollection() { // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateDikeTopAtRiverPoint(null); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateDikeTopAtRiverPoint(null); // Assert CollectionAssert.IsEmpty(points); } [Test] - public void CreateDikeTopAtRiverPoint_DikeTopAtRiverNull_ReturnsEmptyPointsArray() + public void CreateDikeTopAtRiverPoint_DikeTopAtRiverNull_ReturnsEmptyPointsCollection() { // Setup MacroStabilityInwardsSurfaceLine surfaceLine = GetSurfaceLineWithGeometry(); // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateDikeTopAtRiverPoint(surfaceLine); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateDikeTopAtRiverPoint(surfaceLine); // Assert CollectionAssert.IsEmpty(points); } [Test] - public void CreateDikeTopAtRiverPoint_GivenSurfaceLineWithDikeTopAtRiver_ReturnsDikeTopAtRiverPointsArray() + public void CreateDikeTopAtRiverPoint_GivenSurfaceLineWithDikeTopAtRiver_ReturnsDikeTopAtRiverPointsCollection() { // Setup var dikeTopAtRiver = new Point3D(1.2, 2.3, 4.0); @@ -327,37 +327,37 @@ surfaceLine.SetDikeTopAtRiverAt(dikeTopAtRiver); // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateDikeTopAtRiverPoint(surfaceLine); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateDikeTopAtRiverPoint(surfaceLine); // Assert AssertEqualLocalPointCollection(dikeTopAtRiver, surfaceLine, points); } [Test] - public void CreateDitchDikeSidePoint_SurfaceLineNull_ReturnsEmptyPointsArray() + public void CreateDitchDikeSidePoint_SurfaceLineNull_ReturnsEmptyPointsCollection() { // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateDitchDikeSidePoint(null); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateDitchDikeSidePoint(null); // Assert CollectionAssert.IsEmpty(points); } [Test] - public void CreateDitchDikeSidePoint_DitchDikeSideNull_ReturnsEmptyPointsArray() + public void CreateDitchDikeSidePoint_DitchDikeSideNull_ReturnsEmptyPointsCollection() { // Setup MacroStabilityInwardsSurfaceLine surfaceLine = GetSurfaceLineWithGeometry(); // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateDitchDikeSidePoint(surfaceLine); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateDitchDikeSidePoint(surfaceLine); // Assert CollectionAssert.IsEmpty(points); } [Test] - public void CreateDitchDikeSidePoint_GivenSurfaceLineWithDitchDikeSide_ReturnsDitchDikeSidePointsArray() + public void CreateDitchDikeSidePoint_GivenSurfaceLineWithDitchDikeSide_ReturnsDitchDikeSidePointsCollection() { // Setup var ditchDikeSide = new Point3D(1.2, 2.3, 4.0); @@ -366,37 +366,37 @@ surfaceLine.SetDitchDikeSideAt(ditchDikeSide); // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateDitchDikeSidePoint(surfaceLine); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateDitchDikeSidePoint(surfaceLine); // Assert AssertEqualLocalPointCollection(ditchDikeSide, surfaceLine, points); } [Test] - public void CreateBottomDitchDikeSidePoint_SurfaceLineNull_ReturnsEmptyPointsArray() + public void CreateBottomDitchDikeSidePoint_SurfaceLineNull_ReturnsEmptyPointsCollection() { // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateBottomDitchDikeSidePoint(null); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateBottomDitchDikeSidePoint(null); // Assert CollectionAssert.IsEmpty(points); } [Test] - public void CreateBottomDitchDikeSidePoint_BottomDitchDikeSideNull_ReturnsEmptyPointsArray() + public void CreateBottomDitchDikeSidePoint_BottomDitchDikeSideNull_ReturnsEmptyPointsCollection() { // Setup MacroStabilityInwardsSurfaceLine surfaceLine = GetSurfaceLineWithGeometry(); // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateBottomDitchDikeSidePoint(surfaceLine); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateBottomDitchDikeSidePoint(surfaceLine); // Assert CollectionAssert.IsEmpty(points); } [Test] - public void CreateBottomDitchDikeSidePoint_GivenSurfaceLineWithBottomDitchDikeSide_ReturnsBottomDitchDikeSidePointsArray() + public void CreateBottomDitchDikeSidePoint_GivenSurfaceLineWithBottomDitchDikeSide_ReturnsBottomDitchDikeSidePointsCollection() { // Setup var bottomDitchDikeSide = new Point3D(1.2, 2.3, 4.0); @@ -405,37 +405,37 @@ surfaceLine.SetBottomDitchDikeSideAt(bottomDitchDikeSide); // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateBottomDitchDikeSidePoint(surfaceLine); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateBottomDitchDikeSidePoint(surfaceLine); // Assert AssertEqualLocalPointCollection(bottomDitchDikeSide, surfaceLine, points); } [Test] - public void CreateBottomDitchPolderSidePoint_SurfaceLineNull_ReturnsEmptyPointsArray() + public void CreateBottomDitchPolderSidePoint_SurfaceLineNull_ReturnsEmptyPointsCollection() { // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateBottomDitchPolderSidePoint(null); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateBottomDitchPolderSidePoint(null); // Assert CollectionAssert.IsEmpty(points); } [Test] - public void CreateBottomDitchPolderSidePoint_BottomDitchPolderSideNull_ReturnsEmptyPointsArray() + public void CreateBottomDitchPolderSidePoint_BottomDitchPolderSideNull_ReturnsEmptyPointsCollection() { // Setup MacroStabilityInwardsSurfaceLine surfaceLine = GetSurfaceLineWithGeometry(); // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateBottomDitchPolderSidePoint(surfaceLine); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateBottomDitchPolderSidePoint(surfaceLine); // Assert CollectionAssert.IsEmpty(points); } [Test] - public void CreateBottomDitchPolderSidePoint_GivenSurfaceLineWithBottomDitchPolderSide_ReturnsBottomDitchPolderSidePointsArray() + public void CreateBottomDitchPolderSidePoint_GivenSurfaceLineWithBottomDitchPolderSide_ReturnsBottomDitchPolderSidePointsCollection() { // Setup var bottomDitchPolderSide = new Point3D(1.2, 2.3, 4.0); @@ -444,37 +444,37 @@ surfaceLine.SetBottomDitchPolderSideAt(bottomDitchPolderSide); // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateBottomDitchPolderSidePoint(surfaceLine); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateBottomDitchPolderSidePoint(surfaceLine); // Assert AssertEqualLocalPointCollection(bottomDitchPolderSide, surfaceLine, points); } [Test] - public void CreateDitchPolderSidePoint_SurfaceLineNull_ReturnsEmptyPointsArray() + public void CreateDitchPolderSidePoint_SurfaceLineNull_ReturnsEmptyPointsCollection() { // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateDitchPolderSidePoint(null); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateDitchPolderSidePoint(null); // Assert CollectionAssert.IsEmpty(points); } [Test] - public void CreateDitchPolderSidePoint_DitchPolderSideNull_ReturnsEmptyPointsArray() + public void CreateDitchPolderSidePoint_DitchPolderSideNull_ReturnsEmptyPointsCollection() { // Setup MacroStabilityInwardsSurfaceLine surfaceLine = GetSurfaceLineWithGeometry(); // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateDitchPolderSidePoint(surfaceLine); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateDitchPolderSidePoint(surfaceLine); // Assert CollectionAssert.IsEmpty(points); } [Test] - public void CreateDitchPolderSidePoint_GivenSurfaceLineWithDitchPolderSide_ReturnsDitchPolderSidePointsArray() + public void CreateDitchPolderSidePoint_GivenSurfaceLineWithDitchPolderSide_ReturnsDitchPolderSidePointsCollection() { // Setup var ditchPolderSide = new Point3D(1.2, 2.3, 4.0); @@ -483,37 +483,37 @@ surfaceLine.SetDitchPolderSideAt(ditchPolderSide); // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateDitchPolderSidePoint(surfaceLine); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateDitchPolderSidePoint(surfaceLine); // Assert AssertEqualLocalPointCollection(ditchPolderSide, surfaceLine, points); } [Test] - public void CreateSurfaceLevelInsidePoint_SurfaceLineNull_ReturnsEmptyPointsArray() + public void CreateSurfaceLevelInsidePoint_SurfaceLineNull_ReturnsEmptyPointsCollection() { // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateSurfaceLevelInsidePoint(null); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateSurfaceLevelInsidePoint(null); // Assert CollectionAssert.IsEmpty(points); } [Test] - public void CreateSurfaceLevelInsidePoint_SurfaceLevelInsideNull_ReturnsEmptyPointsArray() + public void CreateSurfaceLevelInsidePoint_SurfaceLevelInsideNull_ReturnsEmptyPointsCollection() { // Setup MacroStabilityInwardsSurfaceLine surfaceLine = GetSurfaceLineWithGeometry(); // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateSurfaceLevelInsidePoint(surfaceLine); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateSurfaceLevelInsidePoint(surfaceLine); // Assert CollectionAssert.IsEmpty(points); } [Test] - public void CreateSurfaceLevelInsidePoint_GivenSurfaceLineWithSurfaceLevelInside_ReturnsSurfaceLevelInsidePointsArray() + public void CreateSurfaceLevelInsidePoint_GivenSurfaceLineWithSurfaceLevelInside_ReturnsSurfaceLevelInsidePointsCollection() { // Setup var surfaceLevelInside = new Point3D(1.2, 2.3, 4.0); @@ -522,7 +522,7 @@ surfaceLine.SetSurfaceLevelInsideAt(surfaceLevelInside); // Call - Point2D[] points = MacroStabilityInwardsChartDataPointsFactory.CreateSurfaceLevelInsidePoint(surfaceLine); + IEnumerable points = MacroStabilityInwardsChartDataPointsFactory.CreateSurfaceLevelInsidePoint(surfaceLine); // Assert AssertEqualLocalPointCollection(surfaceLevelInside, surfaceLine, points); @@ -532,7 +532,7 @@ public void CreateGridPointsWithGridDeterminationType_MacroStabilityInwardsGridNull_ReturnsEmptyPoints() { // Call - Point2D[] gridPoints = MacroStabilityInwardsChartDataPointsFactory.CreateGridPoints(null, MacroStabilityInwardsGridDeterminationType.Manual); + IEnumerable gridPoints = MacroStabilityInwardsChartDataPointsFactory.CreateGridPoints(null, MacroStabilityInwardsGridDeterminationType.Manual); // Assert CollectionAssert.IsEmpty(gridPoints); @@ -553,7 +553,7 @@ }; // Call - Point2D[] gridPoints = MacroStabilityInwardsChartDataPointsFactory.CreateGridPoints(grid, MacroStabilityInwardsGridDeterminationType.Automatic); + IEnumerable gridPoints = MacroStabilityInwardsChartDataPointsFactory.CreateGridPoints(grid, MacroStabilityInwardsGridDeterminationType.Automatic); // Assert CollectionAssert.IsEmpty(gridPoints); @@ -567,7 +567,7 @@ public void CreateGridPointsWithGridDeterminationType_MacroStabilityInwardsGridNumberOfPointsNoGrid_ReturnsEmptyPoints(MacroStabilityInwardsGrid grid) { // Call - Point2D[] gridPoints = MacroStabilityInwardsChartDataPointsFactory.CreateGridPoints(grid, MacroStabilityInwardsGridDeterminationType.Manual); + IEnumerable gridPoints = MacroStabilityInwardsChartDataPointsFactory.CreateGridPoints(grid, MacroStabilityInwardsGridDeterminationType.Manual); // Assert CollectionAssert.IsEmpty(gridPoints); @@ -582,7 +582,7 @@ MacroStabilityInwardsGrid grid) { // Call - Point2D[] gridPoints = MacroStabilityInwardsChartDataPointsFactory.CreateGridPoints(grid, MacroStabilityInwardsGridDeterminationType.Manual); + IEnumerable gridPoints = MacroStabilityInwardsChartDataPointsFactory.CreateGridPoints(grid, MacroStabilityInwardsGridDeterminationType.Manual); // Assert AssertEqualPointCollection(new[] @@ -597,10 +597,10 @@ "CreateGridPointsWithGridDeterminationType" })] public void CreateGridPointsWithGridDeterminationType_MacroStabilityInwardsGridSettingsOnlyHorizontalPoints_ReturnsGridPointsAtBottomSide( - MacroStabilityInwardsGrid grid, Point2D[] expectedPoints) + MacroStabilityInwardsGrid grid, IEnumerable expectedPoints) { // Call - Point2D[] gridPoints = MacroStabilityInwardsChartDataPointsFactory.CreateGridPoints(grid, MacroStabilityInwardsGridDeterminationType.Manual); + IEnumerable gridPoints = MacroStabilityInwardsChartDataPointsFactory.CreateGridPoints(grid, MacroStabilityInwardsGridDeterminationType.Manual); // Assert AssertEqualPointCollection(expectedPoints, gridPoints); @@ -612,10 +612,10 @@ "CreateGridPointsWithGridDeterminationType" })] public void CreateGridPointsWithGridDeterminationType_CreateGridPoints_MacroStabilityInwardsGridSettingsOnlyVerticallPoints_ReturnsGridPointsAtLeftSide - (MacroStabilityInwardsGrid grid, Point2D[] expectedPoints) + (MacroStabilityInwardsGrid grid, IEnumerable expectedPoints) { // Call - Point2D[] gridPoints = MacroStabilityInwardsChartDataPointsFactory.CreateGridPoints(grid, MacroStabilityInwardsGridDeterminationType.Manual); + IEnumerable gridPoints = MacroStabilityInwardsChartDataPointsFactory.CreateGridPoints(grid, MacroStabilityInwardsGridDeterminationType.Manual); // Assert AssertEqualPointCollection(expectedPoints, gridPoints); @@ -627,10 +627,10 @@ "CreateGridPointsWithGridDeterminationType" })] public void CreateGridPointsWithGridDeterminationType_MacroStabilityInwardsWellDefinedGrid_ReturnsExpectedGridPoints( - MacroStabilityInwardsGrid grid, Point2D[] expectedPoints) + MacroStabilityInwardsGrid grid, IEnumerable expectedPoints) { // Call - Point2D[] gridPoints = MacroStabilityInwardsChartDataPointsFactory.CreateGridPoints(grid, MacroStabilityInwardsGridDeterminationType.Manual); + IEnumerable gridPoints = MacroStabilityInwardsChartDataPointsFactory.CreateGridPoints(grid, MacroStabilityInwardsGridDeterminationType.Manual); // Assert AssertEqualPointCollection(expectedPoints, gridPoints); @@ -640,7 +640,7 @@ public void CreateGridPoints_MacroStabilityInwardsGridNull_ReturnsEmptyPoints() { // Call - Point2D[] gridPoints = MacroStabilityInwardsChartDataPointsFactory.CreateGridPoints(null); + IEnumerable gridPoints = MacroStabilityInwardsChartDataPointsFactory.CreateGridPoints(null); // Assert CollectionAssert.IsEmpty(gridPoints); @@ -654,7 +654,7 @@ public void CreateGridPoints_MacroStabilityInwardsGridNumberOfPointsNoGrid_ReturnsEmptyPoints(MacroStabilityInwardsGrid grid) { // Call - Point2D[] gridPoints = MacroStabilityInwardsChartDataPointsFactory.CreateGridPoints(grid); + IEnumerable gridPoints = MacroStabilityInwardsChartDataPointsFactory.CreateGridPoints(grid); // Assert CollectionAssert.IsEmpty(gridPoints); @@ -669,7 +669,7 @@ MacroStabilityInwardsGrid grid) { // Call - Point2D[] gridPoints = MacroStabilityInwardsChartDataPointsFactory.CreateGridPoints(grid); + IEnumerable gridPoints = MacroStabilityInwardsChartDataPointsFactory.CreateGridPoints(grid); // Assert AssertEqualPointCollection(new[] @@ -684,10 +684,10 @@ "CreateGridPoints" })] public void CreateGridPoints_MacroStabilityInwardsGridSettingsOnlyHorizontalPoints_ReturnsGridPointsAtBottomSide( - MacroStabilityInwardsGrid grid, Point2D[] expectedPoints) + MacroStabilityInwardsGrid grid, IEnumerable expectedPoints) { // Call - Point2D[] gridPoints = MacroStabilityInwardsChartDataPointsFactory.CreateGridPoints(grid); + IEnumerable gridPoints = MacroStabilityInwardsChartDataPointsFactory.CreateGridPoints(grid); // Assert AssertEqualPointCollection(expectedPoints, gridPoints); @@ -699,10 +699,10 @@ "CreateGridPoints" })] public void CreateGridPoints_CreateGridPoints_MacroStabilityInwardsGridSettingsOnlyVerticallPoints_ReturnsGridPointsAtLeftSide - (MacroStabilityInwardsGrid grid, Point2D[] expectedPoints) + (MacroStabilityInwardsGrid grid, IEnumerable expectedPoints) { // Call - Point2D[] gridPoints = MacroStabilityInwardsChartDataPointsFactory.CreateGridPoints(grid); + IEnumerable gridPoints = MacroStabilityInwardsChartDataPointsFactory.CreateGridPoints(grid); // Assert AssertEqualPointCollection(expectedPoints, gridPoints); @@ -714,10 +714,10 @@ "CreateGridPoints" })] public void CreateGridPoints_MacroStabilityInwardsWellDefinedGrid_ReturnsExpectedGridPoints( - MacroStabilityInwardsGrid grid, Point2D[] expectedPoints) + MacroStabilityInwardsGrid grid, IEnumerable expectedPoints) { // Call - Point2D[] gridPoints = MacroStabilityInwardsChartDataPointsFactory.CreateGridPoints(grid); + IEnumerable gridPoints = MacroStabilityInwardsChartDataPointsFactory.CreateGridPoints(grid); // Assert AssertEqualPointCollection(expectedPoints, gridPoints); @@ -727,7 +727,7 @@ public void CreateOuterRingArea_SoilLayerNull_ReturnsEmptyAreaCollection() { // Call - IEnumerable outerRing = MacroStabilityInwardsChartDataPointsFactory.CreateOuterRingArea(null); + IEnumerable> outerRing = MacroStabilityInwardsChartDataPointsFactory.CreateOuterRingArea(null); // Assert CollectionAssert.IsEmpty(outerRing); @@ -747,7 +747,7 @@ var layer = new MacroStabilityInwardsSoilLayer2D(outerRing); // Call - IEnumerable outerRingChartData = MacroStabilityInwardsChartDataPointsFactory.CreateOuterRingArea(layer); + IEnumerable> outerRingChartData = MacroStabilityInwardsChartDataPointsFactory.CreateOuterRingArea(layer); // Assert CollectionAssert.AreEqual(new[] @@ -757,17 +757,17 @@ } [Test] - public void CreatePhreaticLinePoints_PhreaticLineNull_ReturnsEmptyPointsArray() + public void CreatePhreaticLinePoints_PhreaticLineNull_ReturnsEmptyPointsCollection() { // Call - Point2D[] line = MacroStabilityInwardsChartDataPointsFactory.CreatePhreaticLinePoints(null); + IEnumerable line = MacroStabilityInwardsChartDataPointsFactory.CreatePhreaticLinePoints(null); // Assert CollectionAssert.IsEmpty(line); } [Test] - public void CreatePhreaticLinePoints_WithPhreaticLine_ReturnsPointsArray() + public void CreatePhreaticLinePoints_WithPhreaticLine_ReturnsPointsCollection() { // Setup var points = new[] @@ -778,41 +778,41 @@ }; // Call - Point2D[] line = MacroStabilityInwardsChartDataPointsFactory.CreatePhreaticLinePoints(new MacroStabilityInwardsPhreaticLine("Test", - points)); + IEnumerable line = MacroStabilityInwardsChartDataPointsFactory.CreatePhreaticLinePoints(new MacroStabilityInwardsPhreaticLine("Test", + points)); // Assert CollectionAssert.AreEqual(points, line); } [Test] - public void CreateWaternetZonePoints_WaternetLineNull_ReturnsEmptyPointsArray() + public void CreateWaternetZonePoints_WaternetLineNull_ReturnsEmptyPointsCollection() { // Setup MacroStabilityInwardsSurfaceLine surfaceLine = GetSurfaceLineWithGeometry(); // Call - IEnumerable zone = MacroStabilityInwardsChartDataPointsFactory.CreateWaternetZonePoints(null, surfaceLine); + IEnumerable> zone = MacroStabilityInwardsChartDataPointsFactory.CreateWaternetZonePoints(null, surfaceLine); // Assert CollectionAssert.IsEmpty(zone); } [Test] - public void CreateWaternetZonePoints_SurfaceLineNull_ReturnsEmptyPointsArray() + public void CreateWaternetZonePoints_SurfaceLineNull_ReturnsEmptyPointsCollection() { // Setup var waternetLine = new TestMacroStabilityInwardsWaternetLine(); // Call - IEnumerable zone = MacroStabilityInwardsChartDataPointsFactory.CreateWaternetZonePoints(waternetLine, null); + IEnumerable> zone = MacroStabilityInwardsChartDataPointsFactory.CreateWaternetZonePoints(waternetLine, null); // Assert CollectionAssert.IsEmpty(zone); } [Test] - public void CreateWaternetZonePoints_WaternetLineGeometryEmpty_ReturnsEmptyPointsArray() + public void CreateWaternetZonePoints_WaternetLineGeometryEmpty_ReturnsEmptyPointsCollection() { // Setup var phreaticLineGeometry = new[] @@ -834,14 +834,14 @@ }); // Call - Point2D[][] zones = MacroStabilityInwardsChartDataPointsFactory.CreateWaternetZonePoints(waternetLine, surfaceLine).ToArray(); + IEnumerable> zones = MacroStabilityInwardsChartDataPointsFactory.CreateWaternetZonePoints(waternetLine, surfaceLine); // Assert CollectionAssert.IsEmpty(zones); } [Test] - public void CreateWaternetZonePoints_PhreaticLineGeometryEmpty_ReturnsEmptyPointsArray() + public void CreateWaternetZonePoints_PhreaticLineGeometryEmpty_ReturnsEmptyPointsCollection() { // Setup var waternetLineGeometry = new[] @@ -863,32 +863,32 @@ }); // Call - Point2D[][] zones = MacroStabilityInwardsChartDataPointsFactory.CreateWaternetZonePoints(waternetLine, surfaceLine).ToArray(); + IEnumerable> zones = MacroStabilityInwardsChartDataPointsFactory.CreateWaternetZonePoints(waternetLine, surfaceLine); // Assert CollectionAssert.IsEmpty(zones); } [Test] [TestCaseSource(nameof(GetPhreaticLineAndWaternetLineConfigurationsBelowSurfaceLine))] - public void CreateWaternetZonePoints_DifferentWaternetLineAndPhreaticLineBelowSurfaceLineConfigurations_ReturnsPointsArray( + public void CreateWaternetZonePoints_DifferentWaternetLineAndPhreaticLineBelowSurfaceLineConfigurations_ReturnsPointsCollection( MacroStabilityInwardsSurfaceLine surfaceLine, MacroStabilityInwardsWaternetLine waternetLine, - Point2D[][] expectedZones) + IEnumerable> expectedZones) { // Call - Point2D[][] zones = MacroStabilityInwardsChartDataPointsFactory.CreateWaternetZonePoints(waternetLine, surfaceLine).ToArray(); + IEnumerable> zones = MacroStabilityInwardsChartDataPointsFactory.CreateWaternetZonePoints(waternetLine, surfaceLine); // Assert - Assert.AreEqual(expectedZones.Length, zones.Length); - for (var i = 0; i < expectedZones.Length; i++) + Assert.AreEqual(expectedZones.Count(), zones.Count()); + for (var i = 0; i < expectedZones.Count(); i++) { - CollectionAssert.AreEqual(expectedZones[i], zones[i]); + CollectionAssert.AreEqual(expectedZones.ElementAt(i), zones.ElementAt(i)); } } [Test] - public void CreateWaternetZonePoints_PhreaticLineAboveSurfaceLineBeforeIntersectionPointWithSurfaceLine_ReturnsPointsArray() + public void CreateWaternetZonePoints_PhreaticLineAboveSurfaceLineBeforeIntersectionPointWithSurfaceLine_ReturnsPointsCollection() { // Setup var phreaticLineGeometry = new[] @@ -915,10 +915,9 @@ }); // Call - Point2D[][] zones = MacroStabilityInwardsChartDataPointsFactory.CreateWaternetZonePoints(waternetLine, surfaceLine).ToArray(); + IEnumerable> zones = MacroStabilityInwardsChartDataPointsFactory.CreateWaternetZonePoints(waternetLine, surfaceLine); // Assert - Assert.AreEqual(1, zones.Length); CollectionAssert.AreEqual(new[] { new Point2D(0, 2), @@ -934,11 +933,11 @@ new Point2D(1.09, -2), new Point2D(0, -2), new Point2D(0, 2) - }, zones[0], new Point2DComparerWithTolerance(1e-2)); + }, zones.Single(), new Point2DComparerWithTolerance(1e-2)); } [Test] - public void CreateWaternetZonePoints_PhreaticLineBelowSurfaceLineBeforeIntersectionPointWithSurfaceLine_ReturnsPointsArray() + public void CreateWaternetZonePoints_PhreaticLineBelowSurfaceLineBeforeIntersectionPointWithSurfaceLine_ReturnsPointsCollection() { // Setup var waternetLineGeometry = new[] @@ -964,10 +963,9 @@ }); // Call - Point2D[][] zones = MacroStabilityInwardsChartDataPointsFactory.CreateWaternetZonePoints(waternetLine, surfaceLine).ToArray(); + IEnumerable> zones = MacroStabilityInwardsChartDataPointsFactory.CreateWaternetZonePoints(waternetLine, surfaceLine); // Assert - Assert.AreEqual(1, zones.Length); CollectionAssert.AreEqual(new[] { new Point2D(0, 2), @@ -979,11 +977,11 @@ new Point2D(3, -2), new Point2D(0, -2), new Point2D(0, 2) - }, zones[0], new Point2DComparerWithTolerance(1e-2)); + }, zones.Single(), new Point2DComparerWithTolerance(1e-2)); } [Test] - public void CreateWaternetZonePoints_WaternetAndPhreaticLinesIntersectSurfaceLine_ReturnsPointsArray() + public void CreateWaternetZonePoints_WaternetAndPhreaticLinesIntersectSurfaceLine_ReturnsPointsCollection() { // Setup var waternetLineGeometry = new[] @@ -1008,11 +1006,9 @@ MacroStabilityInwardsWaternetLine waternetLine = CreateWaternetLine(phreaticLineGeometry, waternetLineGeometry); // Call - Point2D[][] zones = MacroStabilityInwardsChartDataPointsFactory.CreateWaternetZonePoints(waternetLine, surfaceLine).ToArray(); + IEnumerable> zones = MacroStabilityInwardsChartDataPointsFactory.CreateWaternetZonePoints(waternetLine, surfaceLine); // Assert - Assert.AreEqual(1, zones.Length); - CollectionAssert.AreEqual(new[] { new Point2D(3.125, 7), @@ -1022,11 +1018,11 @@ new Point2D(5, 5), new Point2D(3.125, 5), new Point2D(3.125, 7) - }, zones[0]); + }, zones.Single()); } [Test] - public void CreateWaternetZonePoints_PhreaticLineIntersectsSurfaceLineAtMultiplePoints_ReturnsPointsArray() + public void CreateWaternetZonePoints_PhreaticLineIntersectsSurfaceLineAtMultiplePoints_ReturnsPointsCollection() { // Setup var waternetLineGeometry = new[] @@ -1052,10 +1048,9 @@ MacroStabilityInwardsWaternetLine waternetLine = CreateWaternetLine(phreaticLineGeometry, waternetLineGeometry); // Call - Point2D[][] zones = MacroStabilityInwardsChartDataPointsFactory.CreateWaternetZonePoints(waternetLine, surfaceLine).ToArray(); + IEnumerable> zones = MacroStabilityInwardsChartDataPointsFactory.CreateWaternetZonePoints(waternetLine, surfaceLine); // Assert - Assert.AreEqual(1, zones.Length); CollectionAssert.AreEqual(new[] { new Point2D(0, 2), @@ -1073,11 +1068,11 @@ new Point2D(3.125, -2), new Point2D(0, -2), new Point2D(0, 2) - }, zones[0]); + }, zones.Single()); } [Test] - public void CreateWaternetZonePoints_PhreaticLineIntersectsSurfaceLineAtMultiplePointsAndIntersectsWaternetLine_ReturnsPointsArray() + public void CreateWaternetZonePoints_PhreaticLineIntersectsSurfaceLineAtMultiplePointsAndIntersectsWaternetLine_ReturnsPointsCollection() { // Setup var waternetLineGeometry = new[] @@ -1104,10 +1099,10 @@ MacroStabilityInwardsWaternetLine waternetLine = CreateWaternetLine(phreaticLineGeometry, waternetLineGeometry); // Call - Point2D[][] zones = MacroStabilityInwardsChartDataPointsFactory.CreateWaternetZonePoints(waternetLine, surfaceLine).ToArray(); + IEnumerable> zones = MacroStabilityInwardsChartDataPointsFactory.CreateWaternetZonePoints(waternetLine, surfaceLine); // Assert - Assert.AreEqual(2, zones.Length); + Assert.AreEqual(2, zones.Count()); CollectionAssert.AreEqual(new[] { new Point2D(0, 2), @@ -1125,7 +1120,7 @@ new Point2D(3.125, -2), new Point2D(0, -2), new Point2D(0, 2) - }, zones[0], new Point2DComparerWithTolerance(1e-2)); + }, zones.ElementAt(0), new Point2DComparerWithTolerance(1e-2)); CollectionAssert.AreEqual(new[] { @@ -1134,12 +1129,12 @@ new Point2D(15, -8), new Point2D(13, -2), new Point2D(13, -2) - }, zones[1], new Point2DComparerWithTolerance(1e-2)); + }, zones.ElementAt(1), new Point2DComparerWithTolerance(1e-2)); } [Test] [TestCaseSource(nameof(GetPhreaticLineAndWaternetLineWithDifferentLengths))] - public void CreateWaternetZonePoints_PhreaticLineNotSameLength_ReturnsPointArray(IEnumerable waternetLineGeometry, + public void CreateWaternetZonePoints_PhreaticLineNotSameLength_ReturnsPointCollection(IEnumerable waternetLineGeometry, IEnumerable phreaticLineGeometry) { // Setup @@ -1153,18 +1148,17 @@ MacroStabilityInwardsWaternetLine waternetLine = CreateWaternetLine(waternetLineGeometry, phreaticLineGeometry); // Call - Point2D[][] zones = MacroStabilityInwardsChartDataPointsFactory.CreateWaternetZonePoints(waternetLine, surfaceLine).ToArray(); + IEnumerable> zones = MacroStabilityInwardsChartDataPointsFactory.CreateWaternetZonePoints(waternetLine, surfaceLine); // Assert - Assert.AreEqual(1, zones.Length); CollectionAssert.AreEqual(new[] { new Point2D(0, 0), new Point2D(5, 0), new Point2D(5, -2), new Point2D(0, -2), new Point2D(0, 0) - }, zones[0], new Point2DComparerWithTolerance(1e-2)); + }, zones.Single(), new Point2DComparerWithTolerance(1e-2)); } [Test] @@ -1197,32 +1191,31 @@ MacroStabilityInwardsWaternetLine waternetLine = CreateWaternetLine(phreaticLineGeometry, waternetLineGeometry); // Call - Point2D[][] zones = MacroStabilityInwardsChartDataPointsFactory.CreateWaternetZonePoints(waternetLine, surfaceLine).ToArray(); + IEnumerable> zones = MacroStabilityInwardsChartDataPointsFactory.CreateWaternetZonePoints(waternetLine, surfaceLine); // Assert - Assert.AreEqual(1, zones.Length); CollectionAssert.AreEqual(new[] { new Point2D(11.18, 7), new Point2D(15, 8.97), new Point2D(15, -8), new Point2D(11.18, 3.46), new Point2D(11.18, 7) - }, zones[0], new Point2DComparerWithTolerance(1e-2)); + }, zones.Single(), new Point2DComparerWithTolerance(1e-2)); } [Test] - public void CreateSlipPlanePoints_SlidingCurveNull_ReturnsEmptyPointsArray() + public void CreateSlipPlanePoints_SlidingCurveNull_ReturnsEmptyPointsCollection() { // Call - Point2D[] line = MacroStabilityInwardsChartDataPointsFactory.CreateSlipPlanePoints(null); + IEnumerable line = MacroStabilityInwardsChartDataPointsFactory.CreateSlipPlanePoints(null); // Assert CollectionAssert.IsEmpty(line); } [Test] - public void CreateSlipPlanePoints_SlidingCurveEmptySlices_ReturnsEmptyPointsArray() + public void CreateSlipPlanePoints_SlidingCurveEmptySlices_ReturnsEmptyPointsCollection() { // Setup var slidingCurve = new MacroStabilityInwardsSlidingCurve( @@ -1233,14 +1226,14 @@ 0.0); // Call - Point2D[] line = MacroStabilityInwardsChartDataPointsFactory.CreateSlipPlanePoints(slidingCurve); + IEnumerable line = MacroStabilityInwardsChartDataPointsFactory.CreateSlipPlanePoints(slidingCurve); // Assert CollectionAssert.IsEmpty(line); } [Test] - public void CreateSlipPlanePoints_WithSlidingCurve_ReturnsPointsArray() + public void CreateSlipPlanePoints_WithSlidingCurve_ReturnsPointsCollection() { // Setup var points = new[] @@ -1276,24 +1269,24 @@ 0.0); // Call - Point2D[] line = MacroStabilityInwardsChartDataPointsFactory.CreateSlipPlanePoints(slidingCurve); + IEnumerable line = MacroStabilityInwardsChartDataPointsFactory.CreateSlipPlanePoints(slidingCurve); // Assert CollectionAssert.AreEqual(points, line); } [Test] - public void CreateLeftCircleRadiusPoints_SlidingCurveNull_ReturnsEmptyPointsArray() + public void CreateLeftCircleRadiusPoints_SlidingCurveNull_ReturnsEmptyPointsCollection() { // Call - Point2D[] line = MacroStabilityInwardsChartDataPointsFactory.CreateLeftCircleRadiusPoints(null); + IEnumerable line = MacroStabilityInwardsChartDataPointsFactory.CreateLeftCircleRadiusPoints(null); // Assert CollectionAssert.IsEmpty(line); } [Test] - public void CreateLeftCircleRadiusPoints_SlidingCurveEmptySlices_ReturnsEmptyPointsArray() + public void CreateLeftCircleRadiusPoints_SlidingCurveEmptySlices_ReturnsEmptyPointsCollection() { // Setup var slidingCurve = new MacroStabilityInwardsSlidingCurve( @@ -1304,14 +1297,14 @@ 0.0); // Call - Point2D[] line = MacroStabilityInwardsChartDataPointsFactory.CreateLeftCircleRadiusPoints(slidingCurve); + IEnumerable line = MacroStabilityInwardsChartDataPointsFactory.CreateLeftCircleRadiusPoints(slidingCurve); // Assert CollectionAssert.IsEmpty(line); } [Test] - public void CreateLeftCircleRadiusPoints_WithSlidingCurve_ReturnsPointsArray() + public void CreateLeftCircleRadiusPoints_WithSlidingCurve_ReturnsPointsCollection() { // Setup var points = new[] @@ -1335,24 +1328,24 @@ 0.0); // Call - Point2D[] line = MacroStabilityInwardsChartDataPointsFactory.CreateLeftCircleRadiusPoints(slidingCurve); + IEnumerable line = MacroStabilityInwardsChartDataPointsFactory.CreateLeftCircleRadiusPoints(slidingCurve); // Assert CollectionAssert.AreEqual(points, line); } [Test] - public void CreateRightCircleRadiusPoints_SlidingCurveNull_ReturnsEmptyPointsArray() + public void CreateRightCircleRadiusPoints_SlidingCurveNull_ReturnsEmptyPointsCollection() { // Call - Point2D[] line = MacroStabilityInwardsChartDataPointsFactory.CreateRightCircleRadiusPoints(null); + IEnumerable line = MacroStabilityInwardsChartDataPointsFactory.CreateRightCircleRadiusPoints(null); // Assert CollectionAssert.IsEmpty(line); } [Test] - public void CreateRightCircleRadiusPoints_SlidingCurveEmptySlices_ReturnsEmptyPointsArray() + public void CreateRightCircleRadiusPoints_SlidingCurveEmptySlices_ReturnsEmptyPointsCollection() { // Setup var slidingCurve = new MacroStabilityInwardsSlidingCurve( @@ -1363,14 +1356,14 @@ 0.0); // Call - Point2D[] line = MacroStabilityInwardsChartDataPointsFactory.CreateRightCircleRadiusPoints(slidingCurve); + IEnumerable line = MacroStabilityInwardsChartDataPointsFactory.CreateRightCircleRadiusPoints(slidingCurve); // Assert CollectionAssert.IsEmpty(line); } [Test] - public void CreateRightCircleRadiusPoints_WithSlidingCurve_ReturnsPointsArray() + public void CreateRightCircleRadiusPoints_WithSlidingCurve_ReturnsPointsCollection() { // Setup var points = new[] @@ -1394,69 +1387,17 @@ 0.0); // Call - Point2D[] line = MacroStabilityInwardsChartDataPointsFactory.CreateRightCircleRadiusPoints(slidingCurve); + IEnumerable line = MacroStabilityInwardsChartDataPointsFactory.CreateRightCircleRadiusPoints(slidingCurve); // Assert CollectionAssert.AreEqual(points, line); } [Test] - public void CreateSliceAreas_SlicesNull_ReturnsEmptyCollection() - { - // Call - IEnumerable areas = MacroStabilityInwardsChartDataPointsFactory.CreateSliceAreas(null); - - // Assert - CollectionAssert.IsEmpty(areas); - } - - [Test] - public void CreateSliceAreas_WithSlices_ReturnsAreas() - { - // Setup - var slices = - new[] - { - new MacroStabilityInwardsSlice(new Point2D(0, 1), - new Point2D(1, 1), - new Point2D(0, 0), - new Point2D(1, 0), - new MacroStabilityInwardsSlice.ConstructionProperties()), - new MacroStabilityInwardsSlice(new Point2D(3, 4), - new Point2D(4, 4), - new Point2D(3, 3), - new Point2D(4, 3), - new MacroStabilityInwardsSlice.ConstructionProperties()) - }; - - // Call - IEnumerable areas = MacroStabilityInwardsChartDataPointsFactory.CreateSliceAreas(slices); - - // Assert - CollectionAssert.AreEqual(new[] - { - new[] - { - new Point2D(0, 1), - new Point2D(1, 1), - new Point2D(1, 0), - new Point2D(0, 0) - }, - new[] - { - new Point2D(3, 4), - new Point2D(4, 4), - new Point2D(4, 3), - new Point2D(3, 3) - } - }, areas); - } - - [Test] public void CreateTangentLines_TangentLinesNull_ReturnsEmptyCollection() { // Call - IEnumerable lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines(null, new MacroStabilityInwardsSurfaceLine("line")); + IEnumerable> lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines(null, new MacroStabilityInwardsSurfaceLine("line")); // Assert CollectionAssert.IsEmpty(lines); @@ -1466,7 +1407,7 @@ public void CreateTangentLines_SurfaceLineNull_ReturnsEmptyCollection() { // Call - IEnumerable lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines(Enumerable.Empty(), null); + IEnumerable> lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines(Enumerable.Empty(), null); // Assert CollectionAssert.IsEmpty(lines); @@ -1484,7 +1425,7 @@ }); // Call - IEnumerable lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines(new[] + IEnumerable> lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines(new[] { (RoundedDouble) 2.5, (RoundedDouble) 5.8 @@ -1510,7 +1451,7 @@ public void CreateTangentLines_WithBoundaryParametersSurfaceLineNull_ReturnsEmptyCollection() { // Call - IEnumerable lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines( + IEnumerable> lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines( MacroStabilityInwardsGridDeterminationType.Manual, MacroStabilityInwardsTangentLineDeterminationType.Specified, (RoundedDouble) 0.0, @@ -1532,7 +1473,7 @@ public void CreateTangentLines_WithInvalidBoundaryParameters_ReturnsEmptyCollection(double bottom, double top) { // Call - IEnumerable lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines( + IEnumerable> lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines( MacroStabilityInwardsGridDeterminationType.Manual, MacroStabilityInwardsTangentLineDeterminationType.Specified, (RoundedDouble) bottom, @@ -1553,7 +1494,7 @@ MacroStabilityInwardsTangentLineDeterminationType tangentLineDeterminationType) { // Call - IEnumerable lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines( + IEnumerable> lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines( gridDeterminationType, tangentLineDeterminationType, (RoundedDouble) 10.0, @@ -1577,7 +1518,7 @@ }); // Call - IEnumerable lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines( + IEnumerable> lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines( MacroStabilityInwardsGridDeterminationType.Manual, MacroStabilityInwardsTangentLineDeterminationType.Specified, (RoundedDouble) 10.0, @@ -1608,7 +1549,7 @@ }); // Call - IEnumerable lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines( + IEnumerable> lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines( MacroStabilityInwardsGridDeterminationType.Manual, MacroStabilityInwardsTangentLineDeterminationType.Specified, (RoundedDouble) 10.0, @@ -1649,7 +1590,7 @@ }); // Call - IEnumerable lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines( + IEnumerable> lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines( MacroStabilityInwardsGridDeterminationType.Manual, MacroStabilityInwardsTangentLineDeterminationType.Specified, (RoundedDouble) 10.0, @@ -1690,7 +1631,7 @@ }); // Call - IEnumerable lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines( + IEnumerable> lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines( MacroStabilityInwardsGridDeterminationType.Manual, MacroStabilityInwardsTangentLineDeterminationType.Specified, (RoundedDouble) 10.0, @@ -1709,126 +1650,6 @@ }, lines); } - [Test] - public void CreateSliceParameterAreas_SlidingCurveNull_ReturnsEmptyCollection() - { - // Call - IEnumerable areas = MacroStabilityInwardsChartDataPointsFactory.CreateSliceParameterAreas(null, - "parameter", - new Random(39).Next()); - - // Assert - CollectionAssert.IsEmpty(areas); - } - - [Test] - public void CreateSliceParameterAreas_PropertyNameNull_ReturnsEmptyCollection() - { - // Setup - var slidingCurve = new MacroStabilityInwardsSlidingCurve( - new MacroStabilityInwardsSlidingCircle(new Point2D(10, 10), 0.0, true, 0.0, 0.0, 0.0, 0.0), - MacroStabilityInwardsSlidingCircleTestFactory.Create(), - new[] - { - new MacroStabilityInwardsSlice(new Point2D(0, 1), - new Point2D(1, 1), - new Point2D(0, 0), - new Point2D(1, 0), - new MacroStabilityInwardsSlice.ConstructionProperties()) - }, - 0.0, - 0.0); - - // Call - IEnumerable areas = MacroStabilityInwardsChartDataPointsFactory.CreateSliceParameterAreas(slidingCurve, - null, - new Random(39).Next()); - - // Assert - CollectionAssert.IsEmpty(areas); - } - - [Test] - public void CreateSliceParameterAreas_PropertyNameDoesNotExist_ReturnsEmptyCollection() - { - // Setup - var slidingCurve = new MacroStabilityInwardsSlidingCurve( - new MacroStabilityInwardsSlidingCircle(new Point2D(10, 10), 0.0, true, 0.0, 0.0, 0.0, 0.0), - MacroStabilityInwardsSlidingCircleTestFactory.Create(), - new[] - { - new MacroStabilityInwardsSlice(new Point2D(0, 1), - new Point2D(1, 1), - new Point2D(0, 0), - new Point2D(1, 0), - new MacroStabilityInwardsSlice.ConstructionProperties()) - }, - 0.0, - 0.0); - - // Call - IEnumerable areas = MacroStabilityInwardsChartDataPointsFactory.CreateSliceParameterAreas(slidingCurve, - "property that does not exist", - new Random(39).Next()); - - // Assert - CollectionAssert.IsEmpty(areas); - } - - [Test] - public void CreateSliceParameterAreas_ValidParameters_ReturnsExpectedAreas() - { - // Setup - var slidingCurve = new MacroStabilityInwardsSlidingCurve( - new MacroStabilityInwardsSlidingCircle(new Point2D(10, 10), 0.0, true, 0.0, 0.0, 0.0, 0.0), - MacroStabilityInwardsSlidingCircleTestFactory.Create(), - new[] - { - new MacroStabilityInwardsSlice(new Point2D(0, 1), - new Point2D(1, 1), - new Point2D(0, 0), - new Point2D(1, 0), - new MacroStabilityInwardsSlice.ConstructionProperties - { - Cohesion = 30.0 - }), - new MacroStabilityInwardsSlice(new Point2D(1, 2), - new Point2D(2, 2), - new Point2D(1, 1), - new Point2D(2, 1), - new MacroStabilityInwardsSlice.ConstructionProperties - { - Cohesion = 60.0 - }) - }, - 0.0, - 0.0); - - // Call - IEnumerable areas = MacroStabilityInwardsChartDataPointsFactory.CreateSliceParameterAreas(slidingCurve, - nameof(MacroStabilityInwardsSlice.Cohesion), - 3); - - // Assert - CollectionAssert.AreEqual(new[] - { - new[] - { - new Point2D(0, 0), - new Point2D(1, 0), - new Point2D(1, -10), - new Point2D(0, -10) - }, - new[] - { - new Point2D(1, 1), - new Point2D(2, 1), - new Point2D(2, -19), - new Point2D(1, -19) - } - }, areas); - } - private static MacroStabilityInwardsWaternetLine CreateWaternetLine(IEnumerable waternetLineGeometry, IEnumerable phreaticLineGeometry) { Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Factories/MacroStabilityInwardsSliceChartDataPointsFactoryTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Factories/MacroStabilityInwardsSliceChartDataPointsFactoryTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Factories/MacroStabilityInwardsSliceChartDataPointsFactoryTest.cs (revision a2226e0827c68aa2434d4f390cde53de1d410fbf) @@ -0,0 +1,831 @@ +// Copyright (C) Stichting Deltares 2017. 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.Base.Geometry; +using Core.Common.Base.TestUtil.Geometry; +using NUnit.Framework; +using Ringtoets.MacroStabilityInwards.Data; +using Ringtoets.MacroStabilityInwards.Data.TestUtil; +using Ringtoets.MacroStabilityInwards.Forms.Factories; + +namespace Ringtoets.MacroStabilityInwards.Forms.Test.Factories +{ + [TestFixture] + public class MacroStabilityInwardsSliceChartDataPointsFactoryTest + { + [Test] + public void CreateSliceAreas_SlicesNull_ReturnsEmptyCollection() + { + // Call + IEnumerable> areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateSliceAreas(null); + + // Assert + CollectionAssert.IsEmpty(areas); + } + + [Test] + public void CreateSliceAreas_WithSlices_ReturnsAreas() + { + // Setup + var slices = new MacroStabilityInwardsSlidingCurve( + MacroStabilityInwardsSlidingCircleTestFactory.Create(), + MacroStabilityInwardsSlidingCircleTestFactory.Create(), + new[] + { + new MacroStabilityInwardsSlice(new Point2D(0, 1), + new Point2D(1, 1), + new Point2D(0, 0), + new Point2D(1, 0), + new MacroStabilityInwardsSlice.ConstructionProperties()), + new MacroStabilityInwardsSlice(new Point2D(3, 4), + new Point2D(4, 4), + new Point2D(3, 3), + new Point2D(4, 3), + new MacroStabilityInwardsSlice.ConstructionProperties()) + }, + 0.0, + 0.0); + + // Call + IEnumerable> areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateSliceAreas(slices); + + // Assert + CollectionAssert.AreEqual(new[] + { + new[] + { + new Point2D(0, 1), + new Point2D(1, 1), + new Point2D(1, 0), + new Point2D(0, 0) + }, + new[] + { + new Point2D(3, 4), + new Point2D(4, 4), + new Point2D(4, 3), + new Point2D(3, 3) + } + }, areas); + } + + [Test] + public void CreateCohesionAreas_SlicesNull_ReturnsEmptyCollection() + { + // Call + IEnumerable> areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateCohesionAreas(null); + + // Assert + CollectionAssert.IsEmpty(areas); + } + + [Test] + public void CreateCohesionAreas_ValidParameters_ReturnsExpectedAreas() + { + // Setup + var constructionProperties = new MacroStabilityInwardsSlice.ConstructionProperties + { + Cohesion = 30.0 + }; + + MacroStabilityInwardsSlidingCurve slices = CreateSlidingCurve(constructionProperties); + + // Call + IEnumerable> areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateCohesionAreas(slices); + + // Assert + CollectionAssert.AreEqual(new[] + { + new[] + { + new Point2D(0, 0), + new Point2D(1, 0), + new Point2D(1, -3.75), + new Point2D(0, -3.75) + }, + new[] + { + new Point2D(1, 0), + new Point2D(1, 1), + new Point2D(4.75, 1), + new Point2D(4.75, 0) + }, + new[] + { + new Point2D(1, 0), + new Point2D(2, 1), + new Point2D(4.65165, -1.65165), + new Point2D(3.65165, -2.65165) + } + }, areas, new Point2DComparerWithTolerance(1e-6)); + } + + [Test] + public void CreateEffectiveStressAreas_SlicesNull_ReturnsEmptyCollection() + { + // Call + IEnumerable> areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateEffectiveStressAreas(null); + + // Assert + CollectionAssert.IsEmpty(areas); + } + + [Test] + public void CreateEffectiveStressAreas_ValidParameters_ReturnsExpectedAreas() + { + // Setup + var constructionProperties = new MacroStabilityInwardsSlice.ConstructionProperties + { + EffectiveStress = 40.0 + }; + + MacroStabilityInwardsSlidingCurve slices = CreateSlidingCurve(constructionProperties); + + // Call + IEnumerable> areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateEffectiveStressAreas(slices); + + // Assert + CollectionAssert.AreEqual(new[] + { + new[] + { + new Point2D(0, 0), + new Point2D(1, 0), + new Point2D(1, -5), + new Point2D(0, -5) + }, + new[] + { + new Point2D(1, 0), + new Point2D(1, 1), + new Point2D(6, 1), + new Point2D(6, 0) + }, + new[] + { + new Point2D(1, 0), + new Point2D(2, 1), + new Point2D(5.535534, -2.535534), + new Point2D(4.535534, -3.535534) + } + }, areas, new Point2DComparerWithTolerance(1e-6)); + } + + [Test] + public void CreateEffectiveStressDailyAreas_SlicesNull_ReturnsEmptyCollection() + { + // Call + IEnumerable> areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateEffectiveStressDailyAreas(null); + + // Assert + CollectionAssert.IsEmpty(areas); + } + + [Test] + public void CreateEffectiveStressDailyAreas_ValidParameters_ReturnsExpectedAreas() + { + // Setup + var constructionProperties = new MacroStabilityInwardsSlice.ConstructionProperties + { + EffectiveStressDaily = 50.0 + }; + + MacroStabilityInwardsSlidingCurve slices = CreateSlidingCurve(constructionProperties); + + // Call + IEnumerable> areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateEffectiveStressDailyAreas(slices); + + // Assert + CollectionAssert.AreEqual(new[] + { + new[] + { + new Point2D(0, 0), + new Point2D(1, 0), + new Point2D(1, -6.25), + new Point2D(0, -6.25) + }, + new[] + { + new Point2D(1, 0), + new Point2D(1, 1), + new Point2D(7.25, 1), + new Point2D(7.25, 0) + }, + new[] + { + new Point2D(1, 0), + new Point2D(2, 1), + new Point2D(6.419417, -3.419417), + new Point2D(5.419417, -4.419417) + } + }, areas, new Point2DComparerWithTolerance(1e-6)); + } + + [Test] + public void CreateTotalPorePressureAreas_SlicesNull_ReturnsEmptyCollection() + { + // Call + IEnumerable> areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateTotalPorePressureAreas(null); + + // Assert + CollectionAssert.IsEmpty(areas); + } + + [Test] + public void CreateTotalPorePressureAreas_ValidParameters_ReturnsExpectedAreas() + { + // Setup + var constructionProperties = new MacroStabilityInwardsSlice.ConstructionProperties + { + TotalPorePressure = 60.0 + }; + + MacroStabilityInwardsSlidingCurve slices = CreateSlidingCurve(constructionProperties); + + // Call + IEnumerable> areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateTotalPorePressureAreas(slices); + + // Assert + CollectionAssert.AreEqual(new[] + { + new[] + { + new Point2D(0, 0), + new Point2D(1, 0), + new Point2D(1, -7.5), + new Point2D(0, -7.5) + }, + new[] + { + new Point2D(1, 0), + new Point2D(1, 1), + new Point2D(8.5, 1), + new Point2D(8.5, 0) + }, + new[] + { + new Point2D(1, 0), + new Point2D(2, 1), + new Point2D(7.303301, -4.303301), + new Point2D(6.303301, -5.303301) + } + }, areas, new Point2DComparerWithTolerance(1e-6)); + } + + [Test] + public void CreateWeightAreas_SlicesNull_ReturnsEmptyCollection() + { + // Call + IEnumerable> areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateWeightAreas(null); + + // Assert + CollectionAssert.IsEmpty(areas); + } + + [Test] + public void CreateWeightAreas_ValidParameters_ReturnsExpectedAreas() + { + // Setup + var constructionProperties = new MacroStabilityInwardsSlice.ConstructionProperties + { + Weight = 70.0 + }; + + MacroStabilityInwardsSlidingCurve slices = CreateSlidingCurve(constructionProperties); + + // Call + IEnumerable> areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateWeightAreas(slices); + + // Assert + CollectionAssert.AreEqual(new[] + { + new[] + { + new Point2D(0, 0), + new Point2D(1, 0), + new Point2D(1, -8.75), + new Point2D(0, -8.75) + }, + new[] + { + new Point2D(1, 0), + new Point2D(1, 1), + new Point2D(9.75, 1), + new Point2D(9.75, 0) + }, + new[] + { + new Point2D(1, 0), + new Point2D(2, 1), + new Point2D(8.187184, -5.187184), + new Point2D(7.187184, -6.187184) + } + }, areas, new Point2DComparerWithTolerance(1e-6)); + } + + [Test] + public void CreatePiezometricPorePressureAreas_SlicesNull_ReturnsEmptyCollection() + { + // Call + IEnumerable> areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreatePiezometricPorePressureAreas(null); + + // Assert + CollectionAssert.IsEmpty(areas); + } + + [Test] + public void CreatePiezometricPorePressureAreas_ValidParameters_ReturnsExpectedAreas() + { + // Setup + var constructionProperties = new MacroStabilityInwardsSlice.ConstructionProperties + { + PiezometricPorePressure = 80.0 + }; + + MacroStabilityInwardsSlidingCurve slices = CreateSlidingCurve(constructionProperties); + + // Call + IEnumerable> areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreatePiezometricPorePressureAreas(slices); + + // Assert + CollectionAssert.AreEqual(new[] + { + new[] + { + new Point2D(0, 0), + new Point2D(1, 0), + new Point2D(1, -10), + new Point2D(0, -10) + }, + new[] + { + new Point2D(1, 0), + new Point2D(1, 1), + new Point2D(11, 1), + new Point2D(11, 0) + }, + new[] + { + new Point2D(1, 0), + new Point2D(2, 1), + new Point2D(9.071068, -6.071068), + new Point2D(8.071068, -7.071068) + } + }, areas, new Point2DComparerWithTolerance(1e-6)); + } + + [Test] + public void CreatePorePressureAreas_SlicesNull_ReturnsEmptyCollection() + { + // Call + IEnumerable> areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreatePorePressureAreas(null); + + // Assert + CollectionAssert.IsEmpty(areas); + } + + [Test] + public void CreatePorePressureAreas_ValidParameters_ReturnsExpectedAreas() + { + // Setup + var constructionProperties = new MacroStabilityInwardsSlice.ConstructionProperties + { + PorePressure = 90.0 + }; + + MacroStabilityInwardsSlidingCurve slices = CreateSlidingCurve(constructionProperties); + + // Call + IEnumerable> areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreatePorePressureAreas(slices); + + // Assert + CollectionAssert.AreEqual(new[] + { + new[] + { + new Point2D(0, 0), + new Point2D(1, 0), + new Point2D(1, -11.25), + new Point2D(0, -11.25) + }, + new[] + { + new Point2D(1, 0), + new Point2D(1, 1), + new Point2D(12.25, 1), + new Point2D(12.25, 0) + }, + new[] + { + new Point2D(1, 0), + new Point2D(2, 1), + new Point2D(9.954951, -6.954951), + new Point2D(8.954951, -7.954951) + } + }, areas, new Point2DComparerWithTolerance(1e-6)); + } + + [Test] + public void CreateVerticalPorePressureAreas_SlicesNull_ReturnsEmptyCollection() + { + // Call + IEnumerable> areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateVerticalPorePressureAreas(null); + + // Assert + CollectionAssert.IsEmpty(areas); + } + + [Test] + public void CreateVerticalPorePressureAreas_ValidParameters_ReturnsExpectedAreas() + { + // Setup + var constructionProperties = new MacroStabilityInwardsSlice.ConstructionProperties + { + VerticalPorePressure = 100.0 + }; + + MacroStabilityInwardsSlidingCurve slices = CreateSlidingCurve(constructionProperties); + + // Call + IEnumerable> areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateVerticalPorePressureAreas(slices); + + // Assert + CollectionAssert.AreEqual(new[] + { + new[] + { + new Point2D(0, 0), + new Point2D(1, 0), + new Point2D(1, -12.5), + new Point2D(0, -12.5) + }, + new[] + { + new Point2D(1, 0), + new Point2D(1, 1), + new Point2D(13.5, 1), + new Point2D(13.5, 0) + }, + new[] + { + new Point2D(1, 0), + new Point2D(2, 1), + new Point2D(10.838835, -7.838835), + new Point2D(9.838835, -8.838835) + } + }, areas, new Point2DComparerWithTolerance(1e-6)); + } + + [Test] + public void CreateHorizontalPorePressureAreas_SlicesNull_ReturnsEmptyCollection() + { + // Call + IEnumerable> areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateHorizontalPorePressureAreas(null); + + // Assert + CollectionAssert.IsEmpty(areas); + } + + [Test] + public void CreateHorizontalPorePressureAreas_ValidParameters_ReturnsExpectedAreas() + { + // Setup + var constructionProperties = new MacroStabilityInwardsSlice.ConstructionProperties + { + HorizontalPorePressure = 110.0 + }; + + MacroStabilityInwardsSlidingCurve slices = CreateSlidingCurve(constructionProperties); + + // Call + IEnumerable> areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateHorizontalPorePressureAreas(slices); + + // Assert + CollectionAssert.AreEqual(new[] + { + new[] + { + new Point2D(0, 0), + new Point2D(1, 0), + new Point2D(1, -13.75), + new Point2D(0, -13.75) + }, + new[] + { + new Point2D(1, 0), + new Point2D(1, 1), + new Point2D(14.75, 1), + new Point2D(14.75, 0) + }, + new[] + { + new Point2D(1, 0), + new Point2D(2, 1), + new Point2D(11.722718, -8.722718), + new Point2D(10.722718, -9.722718) + } + }, areas, new Point2DComparerWithTolerance(1e-6)); + } + + [Test] + public void CreateOverConsolidationRatioAreas_SlicesNull_ReturnsEmptyCollection() + { + // Call + IEnumerable> areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateOverConsolidationRatioAreas(null); + + // Assert + CollectionAssert.IsEmpty(areas); + } + + [Test] + public void CreateOverConsolidationRatioAreas_ValidParameters_ReturnsExpectedAreas() + { + // Setup + var constructionProperties = new MacroStabilityInwardsSlice.ConstructionProperties + { + OverConsolidationRatio = 40.0 + }; + + MacroStabilityInwardsSlidingCurve slices = CreateSlidingCurve(constructionProperties); + + // Call + IEnumerable> areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateOverConsolidationRatioAreas(slices); + + // Assert + CollectionAssert.AreEqual(new[] + { + new[] + { + new Point2D(0, 0), + new Point2D(1, 0), + new Point2D(1, -2), + new Point2D(0, -2) + }, + new[] + { + new Point2D(1, 0), + new Point2D(1, 1), + new Point2D(3, 1), + new Point2D(3, 0) + }, + new[] + { + new Point2D(1, 0), + new Point2D(2, 1), + new Point2D(3.414213, -0.414213), + new Point2D(2.414213, -1.414213) + } + }, areas, new Point2DComparerWithTolerance(1e-6)); + } + + [Test] + public void CreatePopAreas_SlicesNull_ReturnsEmptyCollection() + { + // Call + IEnumerable> areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreatePopAreas(null); + + // Assert + CollectionAssert.IsEmpty(areas); + } + + [Test] + public void CreatePopAreas_ValidParameters_ReturnsExpectedAreas() + { + // Setup + var constructionProperties = new MacroStabilityInwardsSlice.ConstructionProperties + { + Pop = 120.0 + }; + + MacroStabilityInwardsSlidingCurve slices = CreateSlidingCurve(constructionProperties); + + // Call + IEnumerable> areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreatePopAreas(slices); + + // Assert + CollectionAssert.AreEqual(new[] + { + new[] + { + new Point2D(0, 0), + new Point2D(1, 0), + new Point2D(1, -15), + new Point2D(0, -15) + }, + new[] + { + new Point2D(1, 0), + new Point2D(1, 1), + new Point2D(16, 1), + new Point2D(16, 0) + }, + new[] + { + new Point2D(1, 0), + new Point2D(2, 1), + new Point2D(12.606602, -9.606602), + new Point2D(11.606602, -10.606602) + } + }, areas, new Point2DComparerWithTolerance(1e-6)); + } + + [Test] + public void CreateNormalStressAreas_SlicesNull_ReturnsEmptyCollection() + { + // Call + IEnumerable> areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateNormalStressAreas(null); + + // Assert + CollectionAssert.IsEmpty(areas); + } + + [Test] + public void CreateNormalStressAreas_ValidParameters_ReturnsExpectedAreas() + { + // Setup + var constructionProperties = new MacroStabilityInwardsSlice.ConstructionProperties + { + NormalStress = 130.0 + }; + + MacroStabilityInwardsSlidingCurve slices = CreateSlidingCurve(constructionProperties); + + // Call + IEnumerable> areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateNormalStressAreas(slices); + + // Assert + CollectionAssert.AreEqual(new[] + { + new[] + { + new Point2D(0, 0), + new Point2D(1, 0), + new Point2D(1, -16.25), + new Point2D(0, -16.25) + }, + new[] + { + new Point2D(1, 0), + new Point2D(1, 1), + new Point2D(17.25, 1), + new Point2D(17.25, 0) + }, + new[] + { + new Point2D(1, 0), + new Point2D(2, 1), + new Point2D(13.490485, -10.490485), + new Point2D(12.490485, -11.490485) + } + }, areas, new Point2DComparerWithTolerance(1e-6)); + } + + [Test] + public void CreateShearStressAreas_SlicesNull_ReturnsEmptyCollection() + { + // Call + IEnumerable> areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateShearStressAreas(null); + + // Assert + CollectionAssert.IsEmpty(areas); + } + + [Test] + public void CreateShearStressAreas_ValidParameters_ReturnsExpectedAreas() + { + // Setup + var constructionProperties = new MacroStabilityInwardsSlice.ConstructionProperties + { + ShearStress = 150.0 + }; + + MacroStabilityInwardsSlidingCurve slices = CreateSlidingCurve(constructionProperties); + + // Call + IEnumerable> areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateShearStressAreas(slices); + + // Assert + CollectionAssert.AreEqual(new[] + { + new[] + { + new Point2D(0, 0), + new Point2D(1, 0), + new Point2D(1, -18.75), + new Point2D(0, -18.75) + }, + new[] + { + new Point2D(1, 0), + new Point2D(1, 1), + new Point2D(19.75, 1), + new Point2D(19.75, 0) + }, + new[] + { + new Point2D(1, 0), + new Point2D(2, 1), + new Point2D(15.258252, -12.258252), + new Point2D(14.258252, -13.258252) + } + }, areas, new Point2DComparerWithTolerance(1e-6)); + } + + [Test] + public void CreateLoadStressAreas_SlicesNull_ReturnsEmptyCollection() + { + // Call + IEnumerable> areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateLoadStressAreas(null); + + // Assert + CollectionAssert.IsEmpty(areas); + } + + [Test] + public void CreateLoadStressAreas_ValidParameters_ReturnsExpectedAreas() + { + // Setup + var constructionProperties = new MacroStabilityInwardsSlice.ConstructionProperties + { + LoadStress = 160.0 + }; + + MacroStabilityInwardsSlidingCurve slices = CreateSlidingCurve(constructionProperties); + + // Call + IEnumerable> areas = MacroStabilityInwardsSliceChartDataPointsFactory.CreateLoadStressAreas(slices); + + // Assert + CollectionAssert.AreEqual(new[] + { + new[] + { + new Point2D(0, 0), + new Point2D(1, 0), + new Point2D(1, -20), + new Point2D(0, -20) + }, + new[] + { + new Point2D(1, 0), + new Point2D(1, 1), + new Point2D(21, 1), + new Point2D(21, 0) + }, + new[] + { + new Point2D(1, 0), + new Point2D(2, 1), + new Point2D(16.142136, -13.142136), + new Point2D(15.142136, -14.142136) + } + }, areas, new Point2DComparerWithTolerance(1e-6)); + } + + private static MacroStabilityInwardsSlidingCurve CreateSlidingCurve(MacroStabilityInwardsSlice.ConstructionProperties constructionProperties) + { + return new MacroStabilityInwardsSlidingCurve( + MacroStabilityInwardsSlidingCircleTestFactory.Create(), + MacroStabilityInwardsSlidingCircleTestFactory.Create(), new[] + { + new MacroStabilityInwardsSlice(new Point2D(0, 1), + new Point2D(1, 1), + new Point2D(0, 0), + new Point2D(1, 0), + constructionProperties), + new MacroStabilityInwardsSlice(new Point2D(0, 0), + new Point2D(0, 1), + new Point2D(1, 0), + new Point2D(1, 1), + constructionProperties), + new MacroStabilityInwardsSlice(new Point2D(0, 1), + new Point2D(1, 2), + new Point2D(1, 0), + new Point2D(2, 1), + constructionProperties) + }, + 0.0, + 0.0); + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Ringtoets.MacroStabilityInwards.Forms.Test.csproj =================================================================== diff -u -r63fc151e9cf722527465c1eddfa6567a90feb5e6 -ra2226e0827c68aa2434d4f390cde53de1d410fbf --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Ringtoets.MacroStabilityInwards.Forms.Test.csproj (.../Ringtoets.MacroStabilityInwards.Forms.Test.csproj) (revision 63fc151e9cf722527465c1eddfa6567a90feb5e6) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Ringtoets.MacroStabilityInwards.Forms.Test.csproj (.../Ringtoets.MacroStabilityInwards.Forms.Test.csproj) (revision a2226e0827c68aa2434d4f390cde53de1d410fbf) @@ -24,6 +24,7 @@ + Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.TestUtil/MacroStabilityInwardsOutputViewChartDataAssert.cs =================================================================== diff -u -r117a54dfd9b5972086a1f3386923edda2e7a334b -ra2226e0827c68aa2434d4f390cde53de1d410fbf --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.TestUtil/MacroStabilityInwardsOutputViewChartDataAssert.cs (.../MacroStabilityInwardsOutputViewChartDataAssert.cs) (revision 117a54dfd9b5972086a1f3386923edda2e7a334b) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.TestUtil/MacroStabilityInwardsOutputViewChartDataAssert.cs (.../MacroStabilityInwardsOutputViewChartDataAssert.cs) (revision a2226e0827c68aa2434d4f390cde53de1d410fbf) @@ -251,38 +251,38 @@ /// The actual . /// Thrown when /// does not correspond to . - public static void AssertSliceParametersChartData(IEnumerable slices, ChartDataCollection actual) + private static void AssertSliceParametersChartData(IEnumerable slices, ChartDataCollection actual) { MacroStabilityInwardsSlice[] macroStabilityInwardsSlices = slices.ToArray(); CollectionAssert.IsNotEmpty(macroStabilityInwardsSlices); - CollectionAssert.AreEqual(CreateExpectedSliceParameterAreas(macroStabilityInwardsSlices, nameof(MacroStabilityInwardsSlice.Cohesion), 8), + CollectionAssert.AreEqual(CreateExpectedSliceParameterAreas(macroStabilityInwardsSlices, s => s.Cohesion, 0.125), ((ChartMultipleAreaData) actual.Collection.ElementAt(sliceParameterCohesionIndex)).Areas); - CollectionAssert.AreEqual(CreateExpectedSliceParameterAreas(macroStabilityInwardsSlices, nameof(MacroStabilityInwardsSlice.EffectiveStress), 8), + CollectionAssert.AreEqual(CreateExpectedSliceParameterAreas(macroStabilityInwardsSlices, s => s.EffectiveStress, 0.125), ((ChartMultipleAreaData) actual.Collection.ElementAt(sliceParameterEffectiveStressIndex)).Areas); - CollectionAssert.AreEqual(CreateExpectedSliceParameterAreas(macroStabilityInwardsSlices, nameof(MacroStabilityInwardsSlice.EffectiveStressDaily), 8), + CollectionAssert.AreEqual(CreateExpectedSliceParameterAreas(macroStabilityInwardsSlices, s => s.EffectiveStressDaily, 0.125), ((ChartMultipleAreaData) actual.Collection.ElementAt(sliceParameterEffectiveStressDailyIndex)).Areas); - CollectionAssert.AreEqual(CreateExpectedSliceParameterAreas(macroStabilityInwardsSlices, nameof(MacroStabilityInwardsSlice.TotalPorePressure), 8), + CollectionAssert.AreEqual(CreateExpectedSliceParameterAreas(macroStabilityInwardsSlices, s => s.TotalPorePressure, 0.125), ((ChartMultipleAreaData) actual.Collection.ElementAt(sliceParameterTotalPorePressureIndex)).Areas); - CollectionAssert.AreEqual(CreateExpectedSliceParameterAreas(macroStabilityInwardsSlices, nameof(MacroStabilityInwardsSlice.Weight), 8), + CollectionAssert.AreEqual(CreateExpectedSliceParameterAreas(macroStabilityInwardsSlices, s => s.Weight, 0.125), ((ChartMultipleAreaData) actual.Collection.ElementAt(sliceParameterWeightIndex)).Areas); - CollectionAssert.AreEqual(CreateExpectedSliceParameterAreas(macroStabilityInwardsSlices, nameof(MacroStabilityInwardsSlice.PiezometricPorePressure), 8), + CollectionAssert.AreEqual(CreateExpectedSliceParameterAreas(macroStabilityInwardsSlices, s => s.PiezometricPorePressure, 0.125), ((ChartMultipleAreaData) actual.Collection.ElementAt(sliceParameterPiezometricPorePressureIndex)).Areas); - CollectionAssert.AreEqual(CreateExpectedSliceParameterAreas(macroStabilityInwardsSlices, nameof(MacroStabilityInwardsSlice.PorePressure), 8), + CollectionAssert.AreEqual(CreateExpectedSliceParameterAreas(macroStabilityInwardsSlices, s => s.PorePressure, 0.125), ((ChartMultipleAreaData) actual.Collection.ElementAt(sliceParameterPorePressureIndex)).Areas); - CollectionAssert.AreEqual(CreateExpectedSliceParameterAreas(macroStabilityInwardsSlices, nameof(MacroStabilityInwardsSlice.VerticalPorePressure), 8), + CollectionAssert.AreEqual(CreateExpectedSliceParameterAreas(macroStabilityInwardsSlices, s => s.VerticalPorePressure, 0.125), ((ChartMultipleAreaData) actual.Collection.ElementAt(sliceParameterVerticalPorePressureIndex)).Areas); - CollectionAssert.AreEqual(CreateExpectedSliceParameterAreas(macroStabilityInwardsSlices, nameof(MacroStabilityInwardsSlice.HorizontalPorePressure), 8), + CollectionAssert.AreEqual(CreateExpectedSliceParameterAreas(macroStabilityInwardsSlices, s => s.HorizontalPorePressure, 0.125), ((ChartMultipleAreaData) actual.Collection.ElementAt(sliceParameterHorizontalPorePressureIndex)).Areas); - CollectionAssert.AreEqual(CreateExpectedSliceParameterAreas(macroStabilityInwardsSlices, nameof(MacroStabilityInwardsSlice.OverConsolidationRatio), 20), + CollectionAssert.AreEqual(CreateExpectedSliceParameterAreas(macroStabilityInwardsSlices, s => s.OverConsolidationRatio, 0.05), ((ChartMultipleAreaData) actual.Collection.ElementAt(sliceParameterOverConsolidationRatioIndex)).Areas); - CollectionAssert.AreEqual(CreateExpectedSliceParameterAreas(macroStabilityInwardsSlices, nameof(MacroStabilityInwardsSlice.Pop), 8), + CollectionAssert.AreEqual(CreateExpectedSliceParameterAreas(macroStabilityInwardsSlices, s => s.Pop, 0.125), ((ChartMultipleAreaData) actual.Collection.ElementAt(sliceParameterPopIndex)).Areas); - CollectionAssert.AreEqual(CreateExpectedSliceParameterAreas(macroStabilityInwardsSlices, nameof(MacroStabilityInwardsSlice.NormalStress), 8), + CollectionAssert.AreEqual(CreateExpectedSliceParameterAreas(macroStabilityInwardsSlices, s => s.NormalStress, 0.125), ((ChartMultipleAreaData) actual.Collection.ElementAt(sliceParameterNormalStressIndex)).Areas); - CollectionAssert.AreEqual(CreateExpectedSliceParameterAreas(macroStabilityInwardsSlices, nameof(MacroStabilityInwardsSlice.ShearStress), 8), + CollectionAssert.AreEqual(CreateExpectedSliceParameterAreas(macroStabilityInwardsSlices, s => s.ShearStress, 0.125), ((ChartMultipleAreaData) actual.Collection.ElementAt(sliceParameterShearStressIndex)).Areas); - CollectionAssert.AreEqual(CreateExpectedSliceParameterAreas(macroStabilityInwardsSlices, nameof(MacroStabilityInwardsSlice.LoadStress), 8), + CollectionAssert.AreEqual(CreateExpectedSliceParameterAreas(macroStabilityInwardsSlices, s => s.LoadStress, 0.125), ((ChartMultipleAreaData) actual.Collection.ElementAt(sliceParameterLoadStressIndex)).Areas); } @@ -313,6 +313,19 @@ var loadStressSliceData = (ChartMultipleAreaData) chartDataArray[sliceParameterLoadStressIndex]; CollectionAssert.IsEmpty(cohesionSliceData.Areas); + CollectionAssert.IsEmpty(effectiveStressSliceData.Areas); + CollectionAssert.IsEmpty(effectiveStressDailySliceData.Areas); + CollectionAssert.IsEmpty(totalPorePressureSliceData.Areas); + CollectionAssert.IsEmpty(weightSliceData.Areas); + CollectionAssert.IsEmpty(piezometricPorePressureSliceData.Areas); + CollectionAssert.IsEmpty(porePressureSliceData.Areas); + CollectionAssert.IsEmpty(verticalPorePressureSliceData.Areas); + CollectionAssert.IsEmpty(horizontalPorePressureSliceData.Areas); + CollectionAssert.IsEmpty(overConsolidationRatioSliceData.Areas); + CollectionAssert.IsEmpty(popSliceData.Areas); + CollectionAssert.IsEmpty(normalStressSliceData.Areas); + CollectionAssert.IsEmpty(shearStressSliceData.Areas); + CollectionAssert.IsEmpty(loadStressSliceData.Areas); Assert.AreEqual("Cohesie", cohesionSliceData.Name); Assert.AreEqual("Effectieve spanning", effectiveStressSliceData.Name); @@ -383,14 +396,14 @@ } private static IEnumerable CreateExpectedSliceParameterAreas(IEnumerable slices, - string propertyName, - int scaleFactor) + Func getParameterFunc, + double scaleFactor) { var areas = new List(); foreach (MacroStabilityInwardsSlice slice in slices) { - var value = (RoundedDouble?) slice.GetType().GetProperty(propertyName)?.GetValue(slice, null); - double offset = value.Value / scaleFactor; + RoundedDouble value = getParameterFunc.Invoke(slice); + double offset = value.Value * scaleFactor; double length = Math.Sqrt(Math.Pow(slice.BottomLeftPoint.X - slice.BottomRightPoint.X, 2) + Math.Pow(slice.BottomLeftPoint.Y - slice.BottomRightPoint.Y, 2));