Index: Core/Plugins/src/Core.Plugins.Map/Legend/MapLegendView.cs =================================================================== diff -u -r7a02214c204a80a085b50b8d5fd7f90b9e0b4149 -rd481a5ba0fb5309250e76a7e8dc12a512a6d3312 --- Core/Plugins/src/Core.Plugins.Map/Legend/MapLegendView.cs (.../MapLegendView.cs) (revision 7a02214c204a80a085b50b8d5fd7f90b9e0b4149) +++ Core/Plugins/src/Core.Plugins.Map/Legend/MapLegendView.cs (.../MapLegendView.cs) (revision d481a5ba0fb5309250e76a7e8dc12a512a6d3312) @@ -120,7 +120,7 @@ CanDrag = (mapPointData, parentData) => true, CanCheck = mapPointData => true, IsChecked = mapPointData => mapPointData.IsVisible, - OnNodeChecked = PointBasedMapDataOnNodeChecked + OnNodeChecked = MapDataOnNodeChecked }); treeViewControl.RegisterTreeNodeInfo(new TreeNodeInfo @@ -133,7 +133,7 @@ CanDrag = (mapLineData, parentData) => true, CanCheck = mapLineData => true, IsChecked = mapLineData => mapLineData.IsVisible, - OnNodeChecked = PointBasedMapDataOnNodeChecked + OnNodeChecked = MapDataOnNodeChecked }); treeViewControl.RegisterTreeNodeInfo(new TreeNodeInfo @@ -146,7 +146,7 @@ CanDrag = (mapPolygonData, parentData) => true, CanCheck = mapPolygonData => true, IsChecked = mapPolygonData => mapPolygonData.IsVisible, - OnNodeChecked = PointBasedMapDataOnNodeChecked + OnNodeChecked = MapDataOnNodeChecked }); treeViewControl.RegisterTreeNodeInfo(new TreeNodeInfo @@ -163,16 +163,10 @@ #region MapData - private static void PointBasedMapDataOnNodeChecked(FeatureBasedMapData featureBasedMapData, object parentData) + private static void MapDataOnNodeChecked(FeatureBasedMapData featureBasedMapData, object parentData) { featureBasedMapData.IsVisible = !featureBasedMapData.IsVisible; featureBasedMapData.NotifyObservers(); - - var observableParent = parentData as IObservable; - if (observableParent != null) - { - observableParent.NotifyObservers(); - } } #endregion Index: Core/Plugins/test/Core.Plugins.Map.Test/Legend/MapLineDataTreeNodeInfoTest.cs =================================================================== diff -u -r6ab9f58d961acb9f1f80fab04e8759b9990262e0 -rd481a5ba0fb5309250e76a7e8dc12a512a6d3312 --- Core/Plugins/test/Core.Plugins.Map.Test/Legend/MapLineDataTreeNodeInfoTest.cs (.../MapLineDataTreeNodeInfoTest.cs) (revision 6ab9f58d961acb9f1f80fab04e8759b9990262e0) +++ Core/Plugins/test/Core.Plugins.Map.Test/Legend/MapLineDataTreeNodeInfoTest.cs (.../MapLineDataTreeNodeInfoTest.cs) (revision d481a5ba0fb5309250e76a7e8dc12a512a6d3312) @@ -180,39 +180,23 @@ [TestCase(true)] [TestCase(false)] - public void OnNodeChecked_LineDataNodeWithoutParent_SetsLineDataVisibility(bool initialVisibleState) + public void OnNodeChecked_MapLineDataNode_SetsLineDataVisibilityAndNotifiesObservers(bool initialVisibleState) { // Setup - mocks.ReplayAll(); - var mapLineData = new MapLineData("test data") - { - IsVisible = initialVisibleState - }; + var observer = mocks.StrictMock(); + observer.Expect(o => o.UpdateObserver()); - // Call - info.OnNodeChecked(mapLineData, null); - - // Assert - Assert.AreEqual(!initialVisibleState, mapLineData.IsVisible); - } - - [TestCase(true)] - [TestCase(false)] - public void OnNodeChecked_LineDataNodeWithObservableParent_SetsLineDataVisibilityAndNotifiesParentObservers(bool initialVisibleState) - { - // Setup - var observable = mocks.StrictMock(); - observable.Expect(o => o.NotifyObservers()); - mocks.ReplayAll(); var mapLineData = new MapLineData("test data") { IsVisible = initialVisibleState }; + mapLineData.Attach(observer); + // Call - info.OnNodeChecked(mapLineData, observable); + info.OnNodeChecked(mapLineData, null); // Assert Assert.AreEqual(!initialVisibleState, mapLineData.IsVisible); Index: Core/Plugins/test/Core.Plugins.Map.Test/Legend/MapPointDataTreeNodeInfoTest.cs =================================================================== diff -u -r6ab9f58d961acb9f1f80fab04e8759b9990262e0 -rd481a5ba0fb5309250e76a7e8dc12a512a6d3312 --- Core/Plugins/test/Core.Plugins.Map.Test/Legend/MapPointDataTreeNodeInfoTest.cs (.../MapPointDataTreeNodeInfoTest.cs) (revision 6ab9f58d961acb9f1f80fab04e8759b9990262e0) +++ Core/Plugins/test/Core.Plugins.Map.Test/Legend/MapPointDataTreeNodeInfoTest.cs (.../MapPointDataTreeNodeInfoTest.cs) (revision d481a5ba0fb5309250e76a7e8dc12a512a6d3312) @@ -180,39 +180,23 @@ [TestCase(true)] [TestCase(false)] - public void OnNodeChecked_PointDataNodeWithoutParent_SetsPointDataVisibility(bool initialVisibleState) + public void OnNodeChecked_MapPointDataNode_SetsPointDataVisibilityAndNotifiesObservers(bool initialVisibleState) { // Setup - mocks.ReplayAll(); - var mapPointData = new MapPointData("test data") - { - IsVisible = initialVisibleState - }; + var observer = mocks.StrictMock(); + observer.Expect(o => o.UpdateObserver()); - // Call - info.OnNodeChecked(mapPointData, null); - - // Assert - Assert.AreEqual(!initialVisibleState, mapPointData.IsVisible); - } - - [TestCase(true)] - [TestCase(false)] - public void OnNodeChecked_PointDataNodeWithObservableParent_SetsPointDataVisibilityAndNotifiesParentObservers(bool initialVisibleState) - { - // Setup - var observable = mocks.StrictMock(); - observable.Expect(o => o.NotifyObservers()); - mocks.ReplayAll(); var mapPointData = new MapPointData("test data") { IsVisible = initialVisibleState }; + mapPointData.Attach(observer); + // Call - info.OnNodeChecked(mapPointData, observable); + info.OnNodeChecked(mapPointData, null); // Assert Assert.AreEqual(!initialVisibleState, mapPointData.IsVisible); Index: Core/Plugins/test/Core.Plugins.Map.Test/Legend/MapPolygonDataTreeNodeInfoTest.cs =================================================================== diff -u -r6ab9f58d961acb9f1f80fab04e8759b9990262e0 -rd481a5ba0fb5309250e76a7e8dc12a512a6d3312 --- Core/Plugins/test/Core.Plugins.Map.Test/Legend/MapPolygonDataTreeNodeInfoTest.cs (.../MapPolygonDataTreeNodeInfoTest.cs) (revision 6ab9f58d961acb9f1f80fab04e8759b9990262e0) +++ Core/Plugins/test/Core.Plugins.Map.Test/Legend/MapPolygonDataTreeNodeInfoTest.cs (.../MapPolygonDataTreeNodeInfoTest.cs) (revision d481a5ba0fb5309250e76a7e8dc12a512a6d3312) @@ -180,39 +180,23 @@ [TestCase(true)] [TestCase(false)] - public void OnNodeChecked_PolygonDataNodeWithoutParent_SetsPolygonDataVisibility(bool initialVisibleState) + public void OnNodeChecked_MapPolygonDataNode_SetsPolygonDataVisibilityAndNotifiesObservers(bool initialVisibleState) { // Setup - mocks.ReplayAll(); - var mapPolygonData = new MapPolygonData("test data") - { - IsVisible = initialVisibleState - }; + var observer = mocks.StrictMock(); + observer.Expect(o => o.UpdateObserver()); - // Call - info.OnNodeChecked(mapPolygonData, null); - - // Assert - Assert.AreEqual(!initialVisibleState, mapPolygonData.IsVisible); - } - - [TestCase(true)] - [TestCase(false)] - public void OnNodeChecked_PolygonDataNodeWithObservableParent_SetsPolygonDataVisibilityAndNotifiesParentObservers(bool initialVisibleState) - { - // Setup - var observable = mocks.StrictMock(); - observable.Expect(o => o.NotifyObservers()); - mocks.ReplayAll(); var mapPolygonData = new MapPolygonData("test data") { IsVisible = initialVisibleState }; + mapPolygonData.Attach(observer); + // Call - info.OnNodeChecked(mapPolygonData, observable); + info.OnNodeChecked(mapPolygonData, null); // Assert Assert.AreEqual(!initialVisibleState, mapPolygonData.IsVisible);