Index: Core/Common/src/Core.Common.IO/Core.Common.IO.csproj =================================================================== diff -u -r9a4c74a9d2cc49987adf0049919baafa6e12a618 -r354027b2a36a779798852d3edadaaf339140295c --- Core/Common/src/Core.Common.IO/Core.Common.IO.csproj (.../Core.Common.IO.csproj) (revision 9a4c74a9d2cc49987adf0049919baafa6e12a618) +++ Core/Common/src/Core.Common.IO/Core.Common.IO.csproj (.../Core.Common.IO.csproj) (revision 354027b2a36a779798852d3edadaaf339140295c) @@ -45,7 +45,6 @@ Properties\GlobalAssembly.cs - Fisheye: Tag 354027b2a36a779798852d3edadaaf339140295c refers to a dead (removed) revision in file `Core/Common/src/Core.Common.IO/Exceptions/ElementReadException.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Common/test/Core.Common.IO.Test/Core.Common.IO.Test.csproj =================================================================== diff -u -r9a4c74a9d2cc49987adf0049919baafa6e12a618 -r354027b2a36a779798852d3edadaaf339140295c --- Core/Common/test/Core.Common.IO.Test/Core.Common.IO.Test.csproj (.../Core.Common.IO.Test.csproj) (revision 9a4c74a9d2cc49987adf0049919baafa6e12a618) +++ Core/Common/test/Core.Common.IO.Test/Core.Common.IO.Test.csproj (.../Core.Common.IO.Test.csproj) (revision 354027b2a36a779798852d3edadaaf339140295c) @@ -48,7 +48,6 @@ - Fisheye: Tag 354027b2a36a779798852d3edadaaf339140295c refers to a dead (removed) revision in file `Core/Common/test/Core.Common.IO.Test/Exceptions/ElementReadExceptionTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Components/src/Core.Components.Gis.IO/Readers/ShapeFileReaderBase.cs =================================================================== diff -u -r2117ba3d745d5776cefdf94dc86ac8d5950aa31e -r354027b2a36a779798852d3edadaaf339140295c --- Core/Components/src/Core.Components.Gis.IO/Readers/ShapeFileReaderBase.cs (.../ShapeFileReaderBase.cs) (revision 2117ba3d745d5776cefdf94dc86ac8d5950aa31e) +++ Core/Components/src/Core.Components.Gis.IO/Readers/ShapeFileReaderBase.cs (.../ShapeFileReaderBase.cs) (revision 354027b2a36a779798852d3edadaaf339140295c) @@ -94,7 +94,7 @@ /// /// Reads all lines from the shape file. /// - /// The name of the . When null a default value will be set. + /// The name of the . When null, a default value will be set. /// The representing the shape. public abstract FeatureBasedMapData ReadShapeFile(string name = null); Index: Core/Components/src/Core.Components.Gis/Features/MapFeature.cs =================================================================== diff -u -r2117ba3d745d5776cefdf94dc86ac8d5950aa31e -r354027b2a36a779798852d3edadaaf339140295c --- Core/Components/src/Core.Components.Gis/Features/MapFeature.cs (.../MapFeature.cs) (revision 2117ba3d745d5776cefdf94dc86ac8d5950aa31e) +++ Core/Components/src/Core.Components.Gis/Features/MapFeature.cs (.../MapFeature.cs) (revision 354027b2a36a779798852d3edadaaf339140295c) @@ -26,7 +26,7 @@ namespace Core.Components.Gis.Features { /// - /// Features containing a of . + /// Features containing an of . /// public class MapFeature { @@ -39,7 +39,7 @@ { if (mapGeometries == null) { - throw new ArgumentNullException("mapGeometries", "MapFeature can't be created without map geometries."); + throw new ArgumentNullException("mapGeometries", "MapFeature cannot be created without map geometries."); } MapGeometries = mapGeometries; Index: Core/Components/src/Core.Components.Gis/Geometries/MapGeometry.cs =================================================================== diff -u -r2117ba3d745d5776cefdf94dc86ac8d5950aa31e -r354027b2a36a779798852d3edadaaf339140295c --- Core/Components/src/Core.Components.Gis/Geometries/MapGeometry.cs (.../MapGeometry.cs) (revision 2117ba3d745d5776cefdf94dc86ac8d5950aa31e) +++ Core/Components/src/Core.Components.Gis/Geometries/MapGeometry.cs (.../MapGeometry.cs) (revision 354027b2a36a779798852d3edadaaf339140295c) @@ -39,7 +39,7 @@ { if (points == null) { - throw new ArgumentNullException("points", "MapGeometry can't be created without points."); + throw new ArgumentNullException("points", "MapGeometry cannot be created without points."); } Points = points; } Index: Core/Components/test/Core.Components.Gis.Test/Features/MapFeatureTest.cs =================================================================== diff -u -r2117ba3d745d5776cefdf94dc86ac8d5950aa31e -r354027b2a36a779798852d3edadaaf339140295c --- Core/Components/test/Core.Components.Gis.Test/Features/MapFeatureTest.cs (.../MapFeatureTest.cs) (revision 2117ba3d745d5776cefdf94dc86ac8d5950aa31e) +++ Core/Components/test/Core.Components.Gis.Test/Features/MapFeatureTest.cs (.../MapFeatureTest.cs) (revision 354027b2a36a779798852d3edadaaf339140295c) @@ -36,7 +36,7 @@ TestDelegate call = () => new MapFeature(null); // Assert - TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, "MapFeature can't be created without map geometries."); + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, "MapFeature cannot be created without map geometries."); } [Test] Index: Core/Components/test/Core.Components.Gis.Test/Geometries/MapGeometryTest.cs =================================================================== diff -u -r2117ba3d745d5776cefdf94dc86ac8d5950aa31e -r354027b2a36a779798852d3edadaaf339140295c --- Core/Components/test/Core.Components.Gis.Test/Geometries/MapGeometryTest.cs (.../MapGeometryTest.cs) (revision 2117ba3d745d5776cefdf94dc86ac8d5950aa31e) +++ Core/Components/test/Core.Components.Gis.Test/Geometries/MapGeometryTest.cs (.../MapGeometryTest.cs) (revision 354027b2a36a779798852d3edadaaf339140295c) @@ -35,7 +35,7 @@ TestDelegate call = () => new MapGeometry(null); // Assert - TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, "MapGeometry can't be created without points."); + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, "MapGeometry cannot be created without points."); } } } \ No newline at end of file Index: Core/Plugins/src/Core.Plugins.DotSpatial/Core.Plugins.DotSpatial.csproj =================================================================== diff -u -r5e80369138024933a45f3e4ae721509dfb17d8fb -r354027b2a36a779798852d3edadaaf339140295c --- Core/Plugins/src/Core.Plugins.DotSpatial/Core.Plugins.DotSpatial.csproj (.../Core.Plugins.DotSpatial.csproj) (revision 5e80369138024933a45f3e4ae721509dfb17d8fb) +++ Core/Plugins/src/Core.Plugins.DotSpatial/Core.Plugins.DotSpatial.csproj (.../Core.Plugins.DotSpatial.csproj) (revision 354027b2a36a779798852d3edadaaf339140295c) @@ -56,6 +56,10 @@ ..\..\..\..\packages\Fluent.Ribbon.3.4.0\lib\net40\Fluent.dll True + + ..\..\..\..\packages\log4net.2.0.4\lib\net40-full\log4net.dll + True + Index: Core/Plugins/src/Core.Plugins.DotSpatial/Legend/MapLegendView.cs =================================================================== diff -u -r5819da80218aa466bd274694f7e8ea6ebaf6630a -r354027b2a36a779798852d3edadaaf339140295c --- Core/Plugins/src/Core.Plugins.DotSpatial/Legend/MapLegendView.cs (.../MapLegendView.cs) (revision 5819da80218aa466bd274694f7e8ea6ebaf6630a) +++ Core/Plugins/src/Core.Plugins.DotSpatial/Legend/MapLegendView.cs (.../MapLegendView.cs) (revision 354027b2a36a779798852d3edadaaf339140295c) @@ -20,21 +20,22 @@ // All rights reserved. using System; +using System.IO; using System.Linq; using System.Windows.Forms; using Core.Common.Base; using Core.Common.Controls.TreeView; using Core.Common.Controls.Views; using Core.Common.Gui.ContextMenu; -using Core.Common.IO.Exceptions; -using Core.Common.Utils.Builders; using Core.Components.DotSpatial.Forms; using Core.Components.Gis.Data; using Core.Components.Gis.IO.Readers; using DotSpatial.Data; using DotSpatial.Topology; +using log4net; using DotSpatialResources = Core.Plugins.DotSpatial.Properties.Resources; using GuiResources = Core.Common.Gui.Properties.Resources; +using ILog = log4net.ILog; namespace Core.Plugins.DotSpatial.Legend { @@ -43,6 +44,8 @@ /// public sealed partial class MapLegendView : UserControl, IView { + private static readonly ILog log = LogManager.GetLogger(typeof(MapLegendView)); + private readonly IContextMenuBuilderProvider contextMenuBuilderProvider; private readonly IWin32Window parentWindow; private readonly TreeViewControl treeViewControl; @@ -57,11 +60,11 @@ { if (contextMenuBuilderProvider == null) { - throw new ArgumentNullException("contextMenuBuilderProvider", "Cannot create a MapLegendView when the context menu builder provider is null"); + throw new ArgumentNullException("contextMenuBuilderProvider", "Cannot create a MapLegendView when the context menu builder provider is null."); } if (parentWindow == null) { - throw new ArgumentNullException("parentWindow" ,"Cannot create a MapLegendView when the parent window is null"); + throw new ArgumentNullException("parentWindow", "Cannot create a MapLegendView when the parent window is null."); } this.contextMenuBuilderProvider = contextMenuBuilderProvider; @@ -181,8 +184,8 @@ private static void MapControlOnDrop(object droppedData, object newParentData, object oldParentData, int position, TreeViewControl control) { - var mapData = (MapData)droppedData; - var target = (MapDataCollection)newParentData; + var mapData = (MapData) droppedData; + var target = (MapDataCollection) newParentData; target.List.Remove(mapData); target.List.Insert(target.List.Count - position, mapData); // Note: target is the same as the previous parent in this case @@ -192,9 +195,9 @@ private ContextMenuStrip MapDataCollectionContextMenuStrip(MapDataCollection mapDataCollection, object parentData, TreeViewControl treeView) { StrictContextMenuItem addMapLayerMenuItem = new StrictContextMenuItem( - DotSpatialResources.MapLegendView_MapDataCollectionContextMenuStrip__Add_MapLayer, - DotSpatialResources.MapLegendView_MapDataCollectionContextMenuStrip_Add_MapLayer_ToolTip, - DotSpatialResources.MapPlusIcon, + DotSpatialResources.MapLegendView_MapDataCollectionContextMenuStrip__Add_MapLayer, + DotSpatialResources.MapLegendView_MapDataCollectionContextMenuStrip_Add_MapLayer_ToolTip, + DotSpatialResources.MapPlusIcon, (sender, args) => ShowSelectShapeFileDialog(sender, args, mapDataCollection)); return contextMenuBuilderProvider.Get(mapDataCollection, treeView).AddCustomItem(addMapLayerMenuItem).Build(); @@ -218,7 +221,7 @@ { if (dialog.ShowDialog(parentWindow) == DialogResult.OK) { - CheckDataFormat(dialog.FileName, System.IO.Path.GetFileNameWithoutExtension(dialog.FileName), mapDataCollection); + CheckDataFormat(dialog.FileName, Path.GetFileNameWithoutExtension(dialog.FileName), mapDataCollection); } } } @@ -232,6 +235,7 @@ switch (featureSet.FeatureType) { case FeatureType.Point: + case FeatureType.MultiPoint: using (ShapeFileReaderBase reader = new PointShapeFileReader(filePath)) { importedData = GetShapeFileData(reader, filePath, title); @@ -250,26 +254,18 @@ } break; default: - throw new NotSupportedException(); + log.Error(DotSpatialResources.MapLegendView_CheckDataFormat_ShapeFile_Contains_Unsupported_Data_); + return; } - - + mapDataCollection.List.Add(importedData); + log.Info(DotSpatialResources.MapLegendView_CheckDataFormat_Shapefile_Is_Imported_); mapDataCollection.NotifyObservers(); } private FeatureBasedMapData GetShapeFileData(ShapeFileReaderBase reader, string filePath, string title) { - try - { - return reader.ReadShapeFile(title); - } - catch (ElementReadException e) - { - string message = new FileReaderErrorMessageBuilder(filePath) - .Build(DotSpatialResources.MapLegendView_GetShapeFileData_The_File_Contains_Non_Supported_Data_); - throw new CriticalFileReadException(message, e); - } + return reader.ReadShapeFile(title); } #endregion Index: Core/Plugins/src/Core.Plugins.DotSpatial/Properties/Resources.Designer.cs =================================================================== diff -u -r5819da80218aa466bd274694f7e8ea6ebaf6630a -r354027b2a36a779798852d3edadaaf339140295c --- Core/Plugins/src/Core.Plugins.DotSpatial/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 5819da80218aa466bd274694f7e8ea6ebaf6630a) +++ Core/Plugins/src/Core.Plugins.DotSpatial/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 354027b2a36a779798852d3edadaaf339140295c) @@ -136,6 +136,24 @@ } /// + /// Looks up a localized string similar to De shape file bevat data welke niet wordt ondersteund.. + /// + public static string MapLegendView_CheckDataFormat_ShapeFile_Contains_Unsupported_Data_ { + get { + return ResourceManager.GetString("MapLegendView_CheckDataFormat_ShapeFile_Contains_Unsupported_Data_", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to De shape file is geimporteerd.. + /// + public static string MapLegendView_CheckDataFormat_Shapefile_Is_Imported_ { + get { + return ResourceManager.GetString("MapLegendView_CheckDataFormat_Shapefile_Is_Imported_", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Het bestand bevat data, welke niet ondersteund wordt.. /// public static string MapLegendView_GetShapeFileData_The_File_Contains_Non_Supported_Data_ { Index: Core/Plugins/src/Core.Plugins.DotSpatial/Properties/Resources.resx =================================================================== diff -u -r5819da80218aa466bd274694f7e8ea6ebaf6630a -r354027b2a36a779798852d3edadaaf339140295c --- Core/Plugins/src/Core.Plugins.DotSpatial/Properties/Resources.resx (.../Resources.resx) (revision 5819da80218aa466bd274694f7e8ea6ebaf6630a) +++ Core/Plugins/src/Core.Plugins.DotSpatial/Properties/Resources.resx (.../Resources.resx) (revision 354027b2a36a779798852d3edadaaf339140295c) @@ -214,4 +214,10 @@ Het bestand bevat data, welke niet ondersteund wordt. + + De shape file bevat data welke niet wordt ondersteund. + + + De shape file is geimporteerd. + \ No newline at end of file Index: Core/Plugins/src/Core.Plugins.DotSpatial/packages.config =================================================================== diff -u -r5e80369138024933a45f3e4ae721509dfb17d8fb -r354027b2a36a779798852d3edadaaf339140295c --- Core/Plugins/src/Core.Plugins.DotSpatial/packages.config (.../packages.config) (revision 5e80369138024933a45f3e4ae721509dfb17d8fb) +++ Core/Plugins/src/Core.Plugins.DotSpatial/packages.config (.../packages.config) (revision 354027b2a36a779798852d3edadaaf339140295c) @@ -29,4 +29,5 @@ + \ No newline at end of file Index: Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapDataCollectionTreeNodeInfoTest.cs =================================================================== diff -u -r2117ba3d745d5776cefdf94dc86ac8d5950aa31e -r354027b2a36a779798852d3edadaaf339140295c --- Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapDataCollectionTreeNodeInfoTest.cs (.../MapDataCollectionTreeNodeInfoTest.cs) (revision 2117ba3d745d5776cefdf94dc86ac8d5950aa31e) +++ Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapDataCollectionTreeNodeInfoTest.cs (.../MapDataCollectionTreeNodeInfoTest.cs) (revision 354027b2a36a779798852d3edadaaf339140295c) @@ -24,13 +24,14 @@ private MapLegendView mapLegendView; private TreeNodeInfo info; private IContextMenuBuilderProvider contextMenuBuilderProvider; + private IWin32Window parentWindow; [SetUp] public void SetUp() { mocks = new MockRepository(); contextMenuBuilderProvider = mocks.StrictMock(); - var parentWindow = mocks.StrictMock(); + parentWindow = mocks.Stub(); mapLegendView = new MapLegendView(contextMenuBuilderProvider, parentWindow); var treeViewControl = TypeUtils.GetField(mapLegendView, "treeViewControl"); @@ -279,6 +280,8 @@ public void ContextMenuStrip_Always_ContainsAddMapLayerMenuItem() { // Setup + const string expectedItemText = "&Voeg kaartlaag toe..."; + const string expectedItemTooltip = "Importeer een nieuwe kaartlaag en voeg deze toe."; var treeViewControlMock = mocks.StrictMock(); var mapDataCollection = mocks.StrictMock(Enumerable.Empty(), "test data"); @@ -290,10 +293,8 @@ var contextMenu = info.ContextMenuStrip(mapDataCollection, null, treeViewControlMock); // Assert - const string expectedItemText = "&Voeg kaartlaag toe..."; - const string expectedItemTooltip = "Importeer een nieuwe kaartlaag en voeg deze toe."; TestHelper.AssertContextMenuStripContainsItem(contextMenu, 0, expectedItemText, expectedItemTooltip, DotSpatialResources.MapIcon); mocks.VerifyAll(); - } + } } } \ No newline at end of file Index: Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapLegendControllerTest.cs =================================================================== diff -u -r5e80369138024933a45f3e4ae721509dfb17d8fb -r354027b2a36a779798852d3edadaaf339140295c --- Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapLegendControllerTest.cs (.../MapLegendControllerTest.cs) (revision 5e80369138024933a45f3e4ae721509dfb17d8fb) +++ Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapLegendControllerTest.cs (.../MapLegendControllerTest.cs) (revision 354027b2a36a779798852d3edadaaf339140295c) @@ -66,7 +66,7 @@ } [Test] - public void Constructor_WithToolViewControllerAndContextMenuBuilderProvider_DoesNotThrow() + public void Constructor_WithToolViewControllerAndContextMenuBuilderProvider_DoesNotThrowException() { // Setup var mocks = new MockRepository(); Index: Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapLegendViewTest.cs =================================================================== diff -u -re8ed2a7235a3d440d258ce5f76862196388c64bc -r354027b2a36a779798852d3edadaaf339140295c --- Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapLegendViewTest.cs (.../MapLegendViewTest.cs) (revision e8ed2a7235a3d440d258ce5f76862196388c64bc) +++ Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapLegendViewTest.cs (.../MapLegendViewTest.cs) (revision 354027b2a36a779798852d3edadaaf339140295c) @@ -65,7 +65,7 @@ TestDelegate test = () => new MapLegendView(null, parentWindow); // Assert - TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, "Cannot create a MapLegendView when the context menu builder provider is null"); + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, "Cannot create a MapLegendView when the context menu builder provider is null."); } [Test] @@ -75,7 +75,7 @@ TestDelegate test = () => new MapLegendView(contextMenuBuilderProvider, null); // Assert - TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, "Cannot create a MapLegendView when the parent window is null"); + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, "Cannot create a MapLegendView when the parent window is null."); } [Test] Index: Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapLineDataTreeNodeInfoTest.cs =================================================================== diff -u -r2117ba3d745d5776cefdf94dc86ac8d5950aa31e -r354027b2a36a779798852d3edadaaf339140295c --- Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapLineDataTreeNodeInfoTest.cs (.../MapLineDataTreeNodeInfoTest.cs) (revision 2117ba3d745d5776cefdf94dc86ac8d5950aa31e) +++ Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapLineDataTreeNodeInfoTest.cs (.../MapLineDataTreeNodeInfoTest.cs) (revision 354027b2a36a779798852d3edadaaf339140295c) @@ -21,30 +21,7 @@ { private MapLegendView mapLegendView; private TreeNodeInfo info; - private MockRepository mockRepository; - [SetUp] - public void SetUp() - { - mockRepository = new MockRepository(); - var contextMenuBuilderProvider = mockRepository.StrictMock(); - var parentWindow = mockRepository.StrictMock(); - mockRepository.ReplayAll(); - - mapLegendView = new MapLegendView(contextMenuBuilderProvider, parentWindow); - - var treeViewControl = TypeUtils.GetField(mapLegendView, "treeViewControl"); - var treeNodeInfoLookup = TypeUtils.GetField>(treeViewControl, "tagTypeTreeNodeInfoLookup"); - - info = treeNodeInfoLookup[typeof(MapLineData)]; - } - - [TearDown] - public void TearDown() - { - mockRepository.VerifyAll(); - } - [Test] public void Initialized_Always_ExpectedPropertiesSet() { @@ -67,7 +44,7 @@ public void Text_Always_ReturnsTextFromResource() { // Setup - var mocks = new MockRepository(); + var mocks = CreateDefaultMocks(); var mapLineData = mocks.StrictMock(Enumerable.Empty(), "MapLineData"); mocks.ReplayAll(); @@ -93,7 +70,7 @@ public void CanCheck_Always_ReturnsTrue() { // Setup - var mocks = new MockRepository(); + var mocks = CreateDefaultMocks(); var lineData = mocks.StrictMock(Enumerable.Empty(), "test data"); mocks.ReplayAll(); @@ -112,7 +89,7 @@ public void IsChecked_Always_ReturnsAccordingToVisibleStateOfLineData(bool isVisible) { // Setup - var mocks = new MockRepository(); + var mocks = CreateDefaultMocks(); var lineData = mocks.StrictMock(Enumerable.Empty(), "test data"); lineData.IsVisible = isVisible; @@ -133,7 +110,7 @@ public void OnNodeChecked_LineDataNodeWithoutParent_SetsLineDataVisibility(bool initialVisibleState) { // Setup - var mocks = new MockRepository(); + var mocks = CreateDefaultMocks(); var lineData = mocks.StrictMock(Enumerable.Empty(), "test data"); mocks.ReplayAll(); @@ -154,7 +131,7 @@ public void OnNodeChecked_LineDataNodeWithObservableParent_SetsLineDataVisibilityAndNotifiesParentObservers(bool initialVisibleState) { // Setup - var mocks = new MockRepository(); + var mocks = CreateDefaultMocks(); var observable = mocks.StrictMock(); var lineData = mocks.StrictMock(Enumerable.Empty(), "test data"); @@ -177,7 +154,7 @@ public void CanDrag_Always_ReturnsTrue() { // Setup - var mocks = new MockRepository(); + var mocks = CreateDefaultMocks(); var lineData = mocks.StrictMock(Enumerable.Empty(), "test data"); mocks.ReplayAll(); @@ -190,5 +167,21 @@ mocks.VerifyAll(); } + + private MockRepository CreateDefaultMocks() + { + var mockRepository = new MockRepository(); + var contextMenuBuilderProvider = mockRepository.StrictMock(); + var parentWindow = mockRepository.StrictMock(); + + mapLegendView = new MapLegendView(contextMenuBuilderProvider, parentWindow); + + var treeViewControl = TypeUtils.GetField(mapLegendView, "treeViewControl"); + var treeNodeInfoLookup = TypeUtils.GetField>(treeViewControl, "tagTypeTreeNodeInfoLookup"); + + info = treeNodeInfoLookup[typeof(MapLineData)]; + + return mockRepository; + } } } \ No newline at end of file Index: Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapPointDataTreeNodeInfoTest.cs =================================================================== diff -u -r2117ba3d745d5776cefdf94dc86ac8d5950aa31e -r354027b2a36a779798852d3edadaaf339140295c --- Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapPointDataTreeNodeInfoTest.cs (.../MapPointDataTreeNodeInfoTest.cs) (revision 2117ba3d745d5776cefdf94dc86ac8d5950aa31e) +++ Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapPointDataTreeNodeInfoTest.cs (.../MapPointDataTreeNodeInfoTest.cs) (revision 354027b2a36a779798852d3edadaaf339140295c) @@ -21,30 +21,7 @@ { private MapLegendView mapLegendView; private TreeNodeInfo info; - private MockRepository mockRepository; - [SetUp] - public void SetUp() - { - mockRepository = new MockRepository(); - var contextMenuBuilderProvider = mockRepository.StrictMock(); - var parentWindow = mockRepository.StrictMock(); - mockRepository.ReplayAll(); - - mapLegendView = new MapLegendView(contextMenuBuilderProvider, parentWindow); - - var treeViewControl = TypeUtils.GetField(mapLegendView, "treeViewControl"); - var treeNodeInfoLookup = TypeUtils.GetField>(treeViewControl, "tagTypeTreeNodeInfoLookup"); - - info = treeNodeInfoLookup[typeof(MapPointData)]; - } - - [TearDown] - public void TearDown() - { - mockRepository.VerifyAll(); - } - [Test] public void Initialized_Always_ExpectedPropertiesSet() { @@ -67,7 +44,7 @@ public void Text_Always_ReturnsTextFromResource() { // Setup - var mocks = new MockRepository(); + var mocks = CreateDefaultMocks(); var mapPointData = mocks.StrictMock(Enumerable.Empty(), "MapPointData"); mocks.ReplayAll(); @@ -93,7 +70,7 @@ public void CanCheck_Always_ReturnsTrue() { // Setup - var mocks = new MockRepository(); + var mocks = CreateDefaultMocks(); var lineData = mocks.StrictMock(Enumerable.Empty(), "test data"); mocks.ReplayAll(); @@ -112,7 +89,7 @@ public void IsChecked_Always_ReturnsAccordingToVisibleStateOfLineData(bool isVisible) { // Setup - var mocks = new MockRepository(); + var mocks = CreateDefaultMocks(); var lineData = mocks.StrictMock(Enumerable.Empty(), "test data"); lineData.IsVisible = isVisible; @@ -133,7 +110,7 @@ public void OnNodeChecked_LineDataNodeWithoutParent_SetsLineDataVisibility(bool initialVisibleState) { // Setup - var mocks = new MockRepository(); + var mocks = CreateDefaultMocks(); var lineData = mocks.StrictMock(Enumerable.Empty(), "test data"); mocks.ReplayAll(); @@ -154,7 +131,7 @@ public void OnNodeChecked_LineDataNodeWithObservableParent_SetsLineDataVisibilityAndNotifiesParentObservers(bool initialVisibleState) { // Setup - var mocks = new MockRepository(); + var mocks = CreateDefaultMocks(); var observable = mocks.StrictMock(); var lineData = mocks.StrictMock(Enumerable.Empty(), "test data"); @@ -177,7 +154,7 @@ public void CanDrag_Always_ReturnsTrue() { // Setup - var mocks = new MockRepository(); + var mocks = CreateDefaultMocks(); var pointData = mocks.StrictMock(Enumerable.Empty(), "test data"); mocks.ReplayAll(); @@ -190,5 +167,22 @@ mocks.VerifyAll(); } + + private MockRepository CreateDefaultMocks() + { + var mockRepository = new MockRepository(); + var contextMenuBuilderProvider = mockRepository.StrictMock(); + var parentWindow = mockRepository.StrictMock(); + mockRepository.ReplayAll(); + + mapLegendView = new MapLegendView(contextMenuBuilderProvider, parentWindow); + + var treeViewControl = TypeUtils.GetField(mapLegendView, "treeViewControl"); + var treeNodeInfoLookup = TypeUtils.GetField>(treeViewControl, "tagTypeTreeNodeInfoLookup"); + + info = treeNodeInfoLookup[typeof(MapPointData)]; + + return mockRepository; + } } } \ No newline at end of file Index: Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapPolygonDataTreeNodeInfoTest.cs =================================================================== diff -u -r2117ba3d745d5776cefdf94dc86ac8d5950aa31e -r354027b2a36a779798852d3edadaaf339140295c --- Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapPolygonDataTreeNodeInfoTest.cs (.../MapPolygonDataTreeNodeInfoTest.cs) (revision 2117ba3d745d5776cefdf94dc86ac8d5950aa31e) +++ Core/Plugins/test/Core.Plugins.DotSpatial.Test/Legend/MapPolygonDataTreeNodeInfoTest.cs (.../MapPolygonDataTreeNodeInfoTest.cs) (revision 354027b2a36a779798852d3edadaaf339140295c) @@ -21,30 +21,7 @@ { private MapLegendView mapLegendView; private TreeNodeInfo info; - private MockRepository mockRepository; - [SetUp] - public void SetUp() - { - mockRepository = new MockRepository(); - var contextMenuBuilderProvider = mockRepository.StrictMock(); - var parentWindow = mockRepository.StrictMock(); - mockRepository.ReplayAll(); - - mapLegendView = new MapLegendView(contextMenuBuilderProvider, parentWindow); - - var treeViewControl = TypeUtils.GetField(mapLegendView, "treeViewControl"); - var treeNodeInfoLookup = TypeUtils.GetField>(treeViewControl, "tagTypeTreeNodeInfoLookup"); - - info = treeNodeInfoLookup[typeof(MapPolygonData)]; - } - - [TearDown] - public void TearDown() - { - mockRepository.VerifyAll(); - } - [Test] public void Initialized_Always_ExpectedPropertiesSet() { @@ -67,7 +44,7 @@ public void Text_Always_ReturnsTextFromResource() { // Setup - var mocks = new MockRepository(); + var mocks = CreateDefaultMocks(); var mapPolygonData = mocks.StrictMock(Enumerable.Empty(), "MapPolygonData"); mocks.ReplayAll(); @@ -93,7 +70,7 @@ public void CanCheck_Always_ReturnsTrue() { // Setup - var mocks = new MockRepository(); + var mocks = CreateDefaultMocks(); var lineData = mocks.StrictMock(Enumerable.Empty(), "test data"); mocks.ReplayAll(); @@ -107,12 +84,30 @@ mocks.VerifyAll(); } + [Test] + public void CanDrag_Always_ReturnsTrue() + { + // Setup + var mocks = CreateDefaultMocks(); + var polygonData = mocks.StrictMock(Enumerable.Empty(), "test data"); + + mocks.ReplayAll(); + + // Call + var canDrag = info.CanDrag(polygonData, null); + + // Assert + Assert.IsTrue(canDrag); + + mocks.VerifyAll(); + } + [TestCase(true)] [TestCase(false)] public void IsChecked_Always_ReturnsAccordingToVisibleStateOfLineData(bool isVisible) { // Setup - var mocks = new MockRepository(); + var mocks = CreateDefaultMocks(); var lineData = mocks.StrictMock(Enumerable.Empty(), "test data"); lineData.IsVisible = isVisible; @@ -133,7 +128,7 @@ public void OnNodeChecked_LineDataNodeWithoutParent_SetsLineDataVisibility(bool initialVisibleState) { // Setup - var mocks = new MockRepository(); + var mocks = CreateDefaultMocks(); var lineData = mocks.StrictMock(Enumerable.Empty(), "test data"); mocks.ReplayAll(); @@ -154,7 +149,7 @@ public void OnNodeChecked_LineDataNodeWithObservableParent_SetsLineDataVisibilityAndNotifiesParentObservers(bool initialVisibleState) { // Setup - var mocks = new MockRepository(); + var mocks = CreateDefaultMocks(); var observable = mocks.StrictMock(); var lineData = mocks.StrictMock(Enumerable.Empty(), "test data"); @@ -173,22 +168,21 @@ mocks.VerifyAll(); } - [Test] - public void CanDrag_Always_ReturnsTrue() + private MockRepository CreateDefaultMocks() { - // Setup - var mocks = new MockRepository(); - var polygonData = mocks.StrictMock(Enumerable.Empty(), "test data"); + var mockRepository = new MockRepository(); + var contextMenuBuilderProvider = mockRepository.StrictMock(); + var parentWindow = mockRepository.StrictMock(); + mockRepository.ReplayAll(); - mocks.ReplayAll(); + mapLegendView = new MapLegendView(contextMenuBuilderProvider, parentWindow); - // Call - var canDrag = info.CanDrag(polygonData, null); + var treeViewControl = TypeUtils.GetField(mapLegendView, "treeViewControl"); + var treeNodeInfoLookup = TypeUtils.GetField>(treeViewControl, "tagTypeTreeNodeInfoLookup"); - // Assert - Assert.IsTrue(canDrag); + info = treeNodeInfoLookup[typeof(MapPolygonData)]; - mocks.VerifyAll(); + return mockRepository; } } } \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.IO/FailureMechanismSectionReader.cs =================================================================== diff -u -r2117ba3d745d5776cefdf94dc86ac8d5950aa31e -r354027b2a36a779798852d3edadaaf339140295c --- Ringtoets/Common/src/Ringtoets.Common.IO/FailureMechanismSectionReader.cs (.../FailureMechanismSectionReader.cs) (revision 2117ba3d745d5776cefdf94dc86ac8d5950aa31e) +++ Ringtoets/Common/src/Ringtoets.Common.IO/FailureMechanismSectionReader.cs (.../FailureMechanismSectionReader.cs) (revision 354027b2a36a779798852d3edadaaf339140295c) @@ -23,17 +23,14 @@ using System.Collections.Generic; using System.IO; using System.Linq; - using Core.Common.Base.Geometry; using Core.Common.IO.Exceptions; using Core.Common.Utils; using Core.Common.Utils.Builders; using Core.Components.Gis.Data; using Core.Components.Gis.Features; -using Core.Components.Gis.IO; using Core.Components.Gis.IO.Readers; using Ringtoets.Common.Data; - using CoreCommonUtilsResources = Core.Common.Utils.Properties.Resources; using RingtoetsCommonIOResources = Ringtoets.Common.IO.Properties.Resources; @@ -137,7 +134,7 @@ /// private MapLineData ReadMapLineData() { - return polylineShapeFileReader.ReadLine() as MapLineData; + return polylineShapeFileReader.ReadLine() as MapLineData; } private FailureMechanismSection CreateFailureMechanismSection(MapLineData lineData) @@ -157,7 +154,7 @@ private string GetSectionName(MapFeature lineFeature) { - return (string)lineFeature.MetaData[SectionNameAttributeKey]; + return (string) lineFeature.MetaData[SectionNameAttributeKey]; } private IEnumerable GetSectionGeometry(MapFeature lineFeature)