Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj =================================================================== diff -u -r766487194eab00bc9205f5cd29f269c9af5f2ab8 -r33d6d1caf8f9c1a6234db7f4dc663f5a24715cfa --- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 766487194eab00bc9205f5cd29f269c9af5f2ab8) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 33d6d1caf8f9c1a6234db7f4dc663f5a24715cfa) @@ -89,6 +89,7 @@ FailureMechanismResultView.cs + @@ -113,6 +114,7 @@ {1d27f91f-4e62-4eaf-a0a8-a32708b9a9b1} Core.Common.Controls.TreeView + False {9a2d67e6-26ac-4d17-b11a-2b4372f2f572} @@ -122,6 +124,7 @@ {30e4c2ae-719e-4d70-9fa9-668a9767fbfa} Core.Common.Gui + False {F49BD8B2-332A-4C91-A196-8CCE0A2C7D98} @@ -138,6 +141,16 @@ Core.Components.Charting False + + {318BA582-88C9-4816-A54A-A7E431461DE3} + Core.Components.Gis + False + + + {70F8CC9C-5BC8-4FB2-B201-EAE7FA8088C2} + Ringtoets.HydraRing.Data + False + {d4200f43-3f72-4f42-af0a-8ced416a38ec} Ringtoets.Common.Data Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/MapDataFactory.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/MapDataFactory.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/MapDataFactory.cs (revision 33d6d1caf8f9c1a6234db7f4dc663f5a24715cfa) @@ -0,0 +1,117 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Linq; +using Core.Common.Base.Geometry; +using Core.Components.Gis.Data; +using Core.Components.Gis.Features; +using Core.Components.Gis.Geometries; +using Core.Components.Gis.Style; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.HydraRing.Data; +using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; + +namespace Ringtoets.Common.Forms.Views +{ + public static class MapDataFactory + { + /// + /// Create with default styling based on the . + /// + /// The for which to create . + /// based on the . + /// is null. + public static MapData Create(ReferenceLine referenceLine) + { + if (referenceLine == null) + { + throw new ArgumentNullException("referenceLine"); + } + var features = GetMapFeature(referenceLine.Points); + + return new MapLineData(features, RingtoetsCommonDataResources.ReferenceLine_DisplayName) + { + Style = new LineStyle(Color.Red, 3, DashStyle.Solid) + }; + } + + /// + /// Create with default styling based on the locations of . + /// + /// The for which to create . + /// based on the locations in the . + /// is null. + public static MapData Create(HydraulicBoundaryDatabase hydraulicBoundaryDatabase) + { + if (hydraulicBoundaryDatabase == null) + { + throw new ArgumentNullException("hydraulicBoundaryDatabase"); + } + + IEnumerable locations = hydraulicBoundaryDatabase.Locations.Select(h => h.Location).ToArray(); + + var features = GetMapFeature(locations); + + return new MapPointData(features, Common.Data.Properties.Resources.HydraulicBoundaryConditions_DisplayName) + { + Style = new PointStyle(Color.DarkBlue, 6, PointSymbol.Circle) + }; + } + + /// + /// Create a instance with a name, but without data. + /// + /// The name of the . + /// An empty object. + public static MapLineData CreateEmptyLineData(string name) + { + return new MapLineData(Enumerable.Empty(), name); + } + + /// + /// Create a instance with a name, but without data. + /// + /// The name of the . + /// An empty object. + public static MapPointData CreateEmptyPointData(string name) + { + return new MapPointData(Enumerable.Empty(), name); + } + + public static IEnumerable GetMapFeature(IEnumerable points) + { + return new[] + { + new MapFeature(new[] + { + new MapGeometry(new[] + { + points + }) + }) + }; + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj =================================================================== diff -u -r9d7a5bd6246ec71a14f1944516d21e06954243f7 -r33d6d1caf8f9c1a6234db7f4dc663f5a24715cfa --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 9d7a5bd6246ec71a14f1944516d21e06954243f7) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 33d6d1caf8f9c1a6234db7f4dc663f5a24715cfa) @@ -84,6 +84,7 @@ UserControl + @@ -115,6 +116,14 @@ {516EBC95-B8F2-428C-B7F6-733F01BF8FDD} Core.Components.Charting + + {318BA582-88C9-4816-A54A-A7E431461DE3} + Core.Components.Gis + + + {70F8CC9C-5BC8-4FB2-B201-EAE7FA8088C2} + Ringtoets.HydraRing.Data + {d4200f43-3f72-4f42-af0a-8ced416a38ec} Ringtoets.Common.Data Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/MapDataFactoryTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/MapDataFactoryTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/MapDataFactoryTest.cs (revision 33d6d1caf8f9c1a6234db7f4dc663f5a24715cfa) @@ -0,0 +1,165 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Linq; +using Core.Common.Base.Geometry; +using Core.Components.Gis.Data; +using Core.Components.Gis.Geometries; +using Core.Components.Gis.Style; +using NUnit.Framework; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.Properties; +using Ringtoets.Common.Forms.Views; +using Ringtoets.HydraRing.Data; + +namespace Ringtoets.Common.Forms.Test.Views +{ + [TestFixture] + public class MapDataFactoryTest + { + [Test] + public void CreateEmptyLineData_Always_ReturnEmptyMapLineDataWithNameSet() + { + // Setup + const string name = ""; + + // Call + MapLineData mapData = MapDataFactory.CreateEmptyLineData(name); + + // Assert + Assert.AreEqual(name, mapData.Name); + Assert.IsEmpty(mapData.Features); + } + + [Test] + public void CreateEmptyPointData_Always_ReturnEmptyMapLineDataWithNameSet() + { + // Setup + const string name = ""; + + // Call + MapPointData mapData = MapDataFactory.CreateEmptyPointData(name); + + // Assert + Assert.AreEqual(name, mapData.Name); + Assert.IsEmpty(mapData.Features); + } + + [Test] + public void Create_GivenReferenceLine_ReturnsMapFeaturesWithDefaultStyling() + { + // Setup + var pointsOne = new[] + { + new Point2D(1.2, 2.3), + new Point2D(2.7, 2.0) + }; + var line = new ReferenceLine(); + line.SetGeometry(pointsOne); + + // Call + MapData data = MapDataFactory.Create(line); + + // Assert + Assert.IsInstanceOf(data); + var mapLineData = (MapLineData)data; + Assert.AreEqual(1, mapLineData.Features.Count()); + Assert.AreEqual(1, mapLineData.Features.ElementAt(0).MapGeometries.Count()); + AssertEqualPointCollections(pointsOne, mapLineData.Features.ElementAt(0).MapGeometries.ElementAt(0)); + + Assert.AreEqual(Resources.ReferenceLine_DisplayName, data.Name); + + AssertEqualStyle(mapLineData.Style, Color.Red, 3, DashStyle.Solid); + } + + [Test] + public void Create_NoReferenceLine_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => MapDataFactory.Create((ReferenceLine)null); + + // Assert + var parameter = Assert.Throws(test).ParamName; + Assert.AreEqual("referenceLine", parameter); + } + + [Test] + public void Create_GivenHydraulicDatabase_ReturnsMapFeaturesWithDefaultStyling() + { + // Setup + var pointsOne = new[] + { + new Point2D(1.2, 2.3), + new Point2D(2.7, 2.0) + }; + var database = new HydraulicBoundaryDatabase(); + database.Locations.AddRange(pointsOne.Select(p => new HydraulicBoundaryLocation(0, "", p.X, p.Y))); + + // Call + MapData data = MapDataFactory.Create(database); + + // Assert + Assert.IsInstanceOf(data); + var mapPointData = (MapPointData)data; + Assert.AreEqual(1, mapPointData.Features.Count()); + Assert.AreEqual(1, mapPointData.Features.ElementAt(0).MapGeometries.Count()); + AssertEqualPointCollections(pointsOne, mapPointData.Features.ElementAt(0).MapGeometries.ElementAt(0)); + + Assert.AreEqual(Resources.HydraulicBoundaryConditions_DisplayName, data.Name); + + AssertEqualStyle(mapPointData.Style, Color.DarkBlue, 6, PointSymbol.Circle); + } + + [Test] + public void Create_NoHydraulicDatabase_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => MapDataFactory.Create((HydraulicBoundaryDatabase)null); + + // Assert + var parameter = Assert.Throws(test).ParamName; + Assert.AreEqual("hydraulicBoundaryDatabase", parameter); + } + + private static void AssertEqualStyle(LineStyle lineStyle, Color color, int width, DashStyle style) + { + Assert.AreEqual(color, lineStyle.Color); + Assert.AreEqual(width, lineStyle.Width); + Assert.AreEqual(style, lineStyle.Style); + } + + private void AssertEqualStyle(PointStyle pointStyle, Color color, int width, PointSymbol symbol) + { + Assert.AreEqual(color, pointStyle.Color); + Assert.AreEqual(width, pointStyle.Size); + Assert.AreEqual(symbol, pointStyle.Symbol); + } + + private void AssertEqualPointCollections(IEnumerable points, MapGeometry geometry) + { + CollectionAssert.AreEqual(points.Select(p => new Point2D(p.X, p.Y)), geometry.PointCollections.First()); + } + } +} \ No newline at end of file Fisheye: Tag 33d6d1caf8f9c1a6234db7f4dc663f5a24715cfa refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/MapDataFactory.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj =================================================================== diff -u -rce94b8228bc7e51779b3754217580f13cb35e475 -r33d6d1caf8f9c1a6234db7f4dc663f5a24715cfa --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision ce94b8228bc7e51779b3754217580f13cb35e475) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 33d6d1caf8f9c1a6234db7f4dc663f5a24715cfa) @@ -42,7 +42,6 @@ Properties\GlobalAssembly.cs - Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionView.cs =================================================================== diff -u -re2b40c9e08052a476113b2cb2492f60057e6e4e1 -r33d6d1caf8f9c1a6234db7f4dc663f5a24715cfa --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionView.cs (.../AssessmentSectionView.cs) (revision e2b40c9e08052a476113b2cb2492f60057e6e4e1) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionView.cs (.../AssessmentSectionView.cs) (revision 33d6d1caf8f9c1a6234db7f4dc663f5a24715cfa) @@ -25,6 +25,7 @@ using Core.Components.Gis.Data; using Core.Components.Gis.Forms; using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Forms.Views; using Ringtoets.Integration.Forms.Properties; using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; Fisheye: Tag 33d6d1caf8f9c1a6234db7f4dc663f5a24715cfa refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/MapDataFactoryTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj =================================================================== diff -u -rdf02e9274a94d8763da204833a4d93f984e242c6 -r33d6d1caf8f9c1a6234db7f4dc663f5a24715cfa --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision df02e9274a94d8763da204833a4d93f984e242c6) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 33d6d1caf8f9c1a6234db7f4dc663f5a24715cfa) @@ -58,7 +58,6 @@ - Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingFailureMechanismView.cs =================================================================== diff -u -re2b40c9e08052a476113b2cb2492f60057e6e4e1 -r33d6d1caf8f9c1a6234db7f4dc663f5a24715cfa --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingFailureMechanismView.cs (.../PipingFailureMechanismView.cs) (revision e2b40c9e08052a476113b2cb2492f60057e6e4e1) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingFailureMechanismView.cs (.../PipingFailureMechanismView.cs) (revision 33d6d1caf8f9c1a6234db7f4dc663f5a24715cfa) @@ -25,6 +25,7 @@ using Core.Components.Gis.Data; using Core.Components.Gis.Forms; using Ringtoets.Common.Forms.Properties; +using Ringtoets.Common.Forms.Views; using Ringtoets.Piping.Forms.PresentationObjects; using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; using PipingDataResources = Ringtoets.Piping.Data.Properties.Resources; @@ -153,25 +154,25 @@ { if (data == null || data.Parent == null || data.Parent.ReferenceLine == null) { - return PipingMapDataFactory.CreateEmptyLineData(RingtoetsCommonDataResources.ReferenceLine_DisplayName); + return MapDataFactory.CreateEmptyLineData(RingtoetsCommonDataResources.ReferenceLine_DisplayName); } - return PipingMapDataFactory.Create(data.Parent.ReferenceLine); + return MapDataFactory.Create(data.Parent.ReferenceLine); } private MapData GetHydraulicBoundaryLocationsMapData() { if (data == null || data.Parent == null || data.Parent.HydraulicBoundaryDatabase == null) { - return PipingMapDataFactory.CreateEmptyPointData(RingtoetsCommonDataResources.HydraulicBoundaryConditions_DisplayName); + return MapDataFactory.CreateEmptyPointData(RingtoetsCommonDataResources.HydraulicBoundaryConditions_DisplayName); } - return PipingMapDataFactory.Create(data.Parent.HydraulicBoundaryDatabase); + return MapDataFactory.Create(data.Parent.HydraulicBoundaryDatabase); } private MapData GetSurfaceLinesMapData() { if (data == null || data.WrappedData == null || data.WrappedData.SurfaceLines == null || !data.WrappedData.SurfaceLines.Any()) { - return PipingMapDataFactory.CreateEmptyLineData(PipingFormsResources.PipingSurfaceLinesCollection_DisplayName); + return MapDataFactory.CreateEmptyLineData(PipingFormsResources.PipingSurfaceLinesCollection_DisplayName); } return PipingMapDataFactory.Create(data.WrappedData.SurfaceLines); } @@ -180,7 +181,7 @@ { if (data == null || data.WrappedData == null || data.WrappedData.StochasticSoilModels == null || !data.WrappedData.StochasticSoilModels.Any()) { - return PipingMapDataFactory.CreateEmptyLineData(PipingFormsResources.StochasticSoilModelCollection_DisplayName); + return MapDataFactory.CreateEmptyLineData(PipingFormsResources.StochasticSoilModelCollection_DisplayName); } return PipingMapDataFactory.Create(data.WrappedData.StochasticSoilModels); } @@ -189,7 +190,7 @@ { if (data == null || data.WrappedData == null || data.WrappedData.Sections == null || !data.WrappedData.Sections.Any()) { - return PipingMapDataFactory.CreateEmptyLineData(Resources.FailureMechanism_Sections_DisplayName); + return MapDataFactory.CreateEmptyLineData(Resources.FailureMechanism_Sections_DisplayName); } return PipingMapDataFactory.Create(data.WrappedData.Sections); } @@ -201,7 +202,7 @@ string mapDataName = string.Format("{0} ({1})", Resources.FailureMechanism_Sections_DisplayName, Resources.FailureMechanismSections_StartPoints_DisplayName); - return PipingMapDataFactory.CreateEmptyPointData(mapDataName); + return MapDataFactory.CreateEmptyPointData(mapDataName); } return PipingMapDataFactory.CreateStartPoints(data.WrappedData.Sections); } @@ -213,7 +214,7 @@ string mapDataName = string.Format("{0} ({1})", Resources.FailureMechanism_Sections_DisplayName, Resources.FailureMechanismSections_EndPoints_DisplayName); - return PipingMapDataFactory.CreateEmptyPointData(mapDataName); + return MapDataFactory.CreateEmptyPointData(mapDataName); } return PipingMapDataFactory.CreateEndPoints(data.WrappedData.Sections); } Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingMapDataFactory.cs =================================================================== diff -u -r04b631b486b742c5339deb1d5504bb13ab5e248d -r33d6d1caf8f9c1a6234db7f4dc663f5a24715cfa --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingMapDataFactory.cs (.../PipingMapDataFactory.cs) (revision 04b631b486b742c5339deb1d5504bb13ab5e248d) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingMapDataFactory.cs (.../PipingMapDataFactory.cs) (revision 33d6d1caf8f9c1a6234db7f4dc663f5a24715cfa) @@ -29,7 +29,6 @@ using Core.Components.Gis.Features; using Core.Components.Gis.Geometries; using Core.Components.Gis.Style; -using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.HydraRing.Data; using Ringtoets.Piping.Data; @@ -170,70 +169,6 @@ }; } - /// - /// Create with default styling based on the . - /// - /// The for which to create . - /// based on the . - /// is null. - public static MapData Create(ReferenceLine referenceLine) - { - if (referenceLine == null) - { - throw new ArgumentNullException("referenceLine"); - } - - var features = GetMapFeature(referenceLine.Points); - - return new MapLineData(features, Common.Data.Properties.Resources.ReferenceLine_DisplayName) - { - Style = new LineStyle(Color.Red, 3, DashStyle.Solid) - }; - } - - /// - /// Create with default styling based on the locations of . - /// - /// The for which to create . - /// based on the locations in the . - /// is null. - public static MapData Create(HydraulicBoundaryDatabase hydraulicBoundaryDatabase) - { - if (hydraulicBoundaryDatabase == null) - { - throw new ArgumentNullException("hydraulicBoundaryDatabase"); - } - - IEnumerable locations = hydraulicBoundaryDatabase.Locations.Select(h => h.Location).ToArray(); - - var features = GetMapFeature(locations); - - return new MapPointData(features, Common.Data.Properties.Resources.HydraulicBoundaryConditions_DisplayName) - { - Style = new PointStyle(Color.DarkBlue, 6, PointSymbol.Circle) - }; - } - - /// - /// Create a instance with a name, but without data. - /// - /// The name of the . - /// An empty object. - public static MapLineData CreateEmptyLineData(string name) - { - return new MapLineData(Enumerable.Empty(), name); - } - - /// - /// Create a instance with a name, but without data. - /// - /// The name of the . - /// An empty object. - public static MapPointData CreateEmptyPointData(string name) - { - return new MapPointData(Enumerable.Empty(), name); - } - private static IEnumerable GetMapFeature(IEnumerable points) { return new[] Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingMapDataFactoryTest.cs =================================================================== diff -u -r04b631b486b742c5339deb1d5504bb13ab5e248d -r33d6d1caf8f9c1a6234db7f4dc663f5a24715cfa --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingMapDataFactoryTest.cs (.../PipingMapDataFactoryTest.cs) (revision 04b631b486b742c5339deb1d5504bb13ab5e248d) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingMapDataFactoryTest.cs (.../PipingMapDataFactoryTest.cs) (revision 33d6d1caf8f9c1a6234db7f4dc663f5a24715cfa) @@ -29,7 +29,6 @@ using Core.Components.Gis.Geometries; using Core.Components.Gis.Style; using NUnit.Framework; -using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.HydraRing.Data; using Ringtoets.Piping.Data; @@ -43,34 +42,6 @@ public class PipingMapDataFactoryTest { [Test] - public void CreateEmptyLineData_Always_ReturnEmptyMapLineDataWithNameSet() - { - // Setup - const string name = ""; - - // Call - MapLineData mapData = PipingMapDataFactory.CreateEmptyLineData(name); - - // Assert - Assert.AreEqual(name, mapData.Name); - Assert.IsEmpty(mapData.Features); - } - - [Test] - public void CreateEmptyPointData_Always_ReturnEmptyMapLineDataWithNameSet() - { - // Setup - const string name = ""; - - // Call - MapPointData mapData = PipingMapDataFactory.CreateEmptyPointData(name); - - // Assert - Assert.AreEqual(name, mapData.Name); - Assert.IsEmpty(mapData.Features); - } - - [Test] public void Create_GivenSurfaceLines_ReturnsMapFeaturesWithDefaultStyling() { // Setup @@ -314,82 +285,6 @@ Assert.AreEqual("sections", parameter); } - [Test] - public void Create_GivenReferenceLine_ReturnsMapFeaturesWithDefaultStyling() - { - // Setup - var pointsOne = new[] - { - new Point2D(1.2, 2.3), - new Point2D(2.7, 2.0) - }; - var line = new ReferenceLine(); - line.SetGeometry(pointsOne); - - // Call - MapData data = PipingMapDataFactory.Create(line); - - // Assert - Assert.IsInstanceOf(data); - var mapLineData = (MapLineData) data; - Assert.AreEqual(1, mapLineData.Features.Count()); - Assert.AreEqual(1, mapLineData.Features.ElementAt(0).MapGeometries.Count()); - AssertEqualPointCollections(pointsOne, mapLineData.Features.ElementAt(0).MapGeometries.ElementAt(0)); - - Assert.AreEqual(Common.Data.Properties.Resources.ReferenceLine_DisplayName, data.Name); - - AssertEqualStyle(mapLineData.Style, Color.Red, 3, DashStyle.Solid); - } - - [Test] - public void Create_NoReferenceLine_ThrowsArgumentNullException() - { - // Call - TestDelegate test = () => PipingMapDataFactory.Create((ReferenceLine) null); - - // Assert - var parameter = Assert.Throws(test).ParamName; - Assert.AreEqual("referenceLine", parameter); - } - - [Test] - public void Create_GivenHydraulicDatabase_ReturnsMapFeaturesWithDefaultStyling() - { - // Setup - var pointsOne = new[] - { - new Point2D(1.2, 2.3), - new Point2D(2.7, 2.0) - }; - var database = new HydraulicBoundaryDatabase(); - database.Locations.AddRange(pointsOne.Select(p => new HydraulicBoundaryLocation(0, "", p.X, p.Y))); - - // Call - MapData data = PipingMapDataFactory.Create(database); - - // Assert - Assert.IsInstanceOf(data); - var mapPointData = (MapPointData) data; - Assert.AreEqual(1, mapPointData.Features.Count()); - Assert.AreEqual(1, mapPointData.Features.ElementAt(0).MapGeometries.Count()); - AssertEqualPointCollections(pointsOne, mapPointData.Features.ElementAt(0).MapGeometries.ElementAt(0)); - - Assert.AreEqual(Common.Data.Properties.Resources.HydraulicBoundaryConditions_DisplayName, data.Name); - - AssertEqualStyle(mapPointData.Style, Color.DarkBlue, 6, PointSymbol.Circle); - } - - [Test] - public void Create_NoHydraulicDatabase_ThrowsArgumentNullException() - { - // Call - TestDelegate test = () => PipingMapDataFactory.Create((HydraulicBoundaryDatabase) null); - - // Assert - var parameter = Assert.Throws(test).ParamName; - Assert.AreEqual("hydraulicBoundaryDatabase", parameter); - } - private void AssertEqualStyle(PointStyle pointStyle, Color color, int width, PointSymbol symbol) { Assert.AreEqual(color, pointStyle.Color);