Index: Core/Components/test/Core.Components.DotSpatial.Forms.Test/MapControlTest.cs =================================================================== diff -u -r0280af2522389e4f1291c22e0cbea677995e3fba -rc5360f0514913f85b89148bd8a63f8b0f5943493 --- Core/Components/test/Core.Components.DotSpatial.Forms.Test/MapControlTest.cs (.../MapControlTest.cs) (revision 0280af2522389e4f1291c22e0cbea677995e3fba) +++ Core/Components/test/Core.Components.DotSpatial.Forms.Test/MapControlTest.cs (.../MapControlTest.cs) (revision c5360f0514913f85b89148bd8a63f8b0f5943493) @@ -107,7 +107,7 @@ } [Test] - public void GivenMapControlWithData_WhenMapDataNotifiesFeaturesChange_CorrespondingLayerReused() + public void GivenMapControlWithData_WhenDataSetToOtherMapDataCollection_MapControlUpdated() { // Given using (var map = new MapControl()) @@ -116,6 +116,39 @@ var mapPointData = new MapPointData("Points"); var mapLineData = new MapLineData("Lines"); var mapPolygonData = new MapPolygonData("Polygons"); + var mapDataCollection1 = new MapDataCollection("Collection 1"); + var mapDataCollection2 = new MapDataCollection("Collection 2"); + + mapDataCollection1.Add(mapPointData); + mapDataCollection2.Add(mapLineData); + mapDataCollection2.Add(mapPolygonData); + + map.Data = mapDataCollection1; + + // Precondition + Assert.AreEqual(1, mapView.Layers.Count); + Assert.IsInstanceOf(mapView.Layers[0]); + + // When + map.Data = mapDataCollection2; + + // Then + Assert.AreEqual(2, mapView.Layers.Count); + Assert.IsInstanceOf(mapView.Layers[0]); + Assert.IsInstanceOf(mapView.Layers[1]); + } + } + + [Test] + public void GivenMapControlWithData_WhenMapDataNotifiesChange_CorrespondingLayerReused() + { + // Given + using (var map = new MapControl()) + { + var mapView = map.Controls.OfType().First(); + var mapPointData = new MapPointData("Points"); + var mapLineData = new MapLineData("Lines"); + var mapPolygonData = new MapPolygonData("Polygons"); var mapDataCollection = new MapDataCollection("Root collection"); var nestedMapDataCollection1 = new MapDataCollection("Nested collection 1"); var nestedMapDataCollection2 = new MapDataCollection("Nested collection 2"); Index: Core/Components/test/Core.Components.DotSpatial.Test/Core.Components.DotSpatial.Test.csproj =================================================================== diff -u -r0e524a720919848a33bb6bb331082c2d32ff1b5c -rc5360f0514913f85b89148bd8a63f8b0f5943493 --- Core/Components/test/Core.Components.DotSpatial.Test/Core.Components.DotSpatial.Test.csproj (.../Core.Components.DotSpatial.Test.csproj) (revision 0e524a720919848a33bb6bb331082c2d32ff1b5c) +++ Core/Components/test/Core.Components.DotSpatial.Test/Core.Components.DotSpatial.Test.csproj (.../Core.Components.DotSpatial.Test.csproj) (revision c5360f0514913f85b89148bd8a63f8b0f5943493) @@ -52,10 +52,6 @@ False ..\..\..\..\lib\DotSpatial.1.8\DotSpatial.Extensions.dll - - False - ..\..\..\..\bin\Debug\DotSpatial.Projections.dll - False ..\..\..\..\lib\DotSpatial.1.8\DotSpatial.Symbology.dll