Index: Core/Plugins/src/Core.Plugins.Map/PresentationObjects/FeatureBasedMapDataContext.cs
===================================================================
diff -u -r405db3b688bdee707426a1bc0a44c3be3a3dc563 -rd02ab460ba97ccc3213c3b365158bf9ce2bb1d57
--- Core/Plugins/src/Core.Plugins.Map/PresentationObjects/FeatureBasedMapDataContext.cs (.../FeatureBasedMapDataContext.cs) (revision 405db3b688bdee707426a1bc0a44c3be3a3dc563)
+++ Core/Plugins/src/Core.Plugins.Map/PresentationObjects/FeatureBasedMapDataContext.cs (.../FeatureBasedMapDataContext.cs) (revision d02ab460ba97ccc3213c3b365158bf9ce2bb1d57)
@@ -37,6 +37,16 @@
/// the belongs to.
/// Thrown when any parameter is null.
public FeatureBasedMapDataContext(FeatureBasedMapData wrappedData, MapDataCollection parentMapData)
- : base(wrappedData, parentMapData) {}
+ : base(wrappedData)
+ {
+ if (parentMapData == null)
+ {
+ throw new ArgumentNullException(nameof(parentMapData));
+ }
+
+ ParentMapData = parentMapData;
+ }
+
+ public override MapDataCollection ParentMapData { get; }
}
}
\ No newline at end of file
Index: Core/Plugins/src/Core.Plugins.Map/PresentationObjects/MapDataCollectionContext.cs
===================================================================
diff -u -r00a3af7043b73274daec82acee63ed738cdbefcd -rd02ab460ba97ccc3213c3b365158bf9ce2bb1d57
--- Core/Plugins/src/Core.Plugins.Map/PresentationObjects/MapDataCollectionContext.cs (.../MapDataCollectionContext.cs) (revision 00a3af7043b73274daec82acee63ed738cdbefcd)
+++ Core/Plugins/src/Core.Plugins.Map/PresentationObjects/MapDataCollectionContext.cs (.../MapDataCollectionContext.cs) (revision d02ab460ba97ccc3213c3b365158bf9ce2bb1d57)
@@ -35,8 +35,14 @@
/// The to wrap.
/// The parent
/// the belongs to.
- /// Thrown when any parameter is null.
+ /// Thrown when
+ /// is null.
public MapDataCollectionContext(MapDataCollection wrappedData, MapDataCollection parentMapData)
- : base(wrappedData, parentMapData) {}
+ : base(wrappedData)
+ {
+ ParentMapData = parentMapData;
+ }
+
+ public override MapDataCollection ParentMapData { get; }
}
}
\ No newline at end of file
Index: Core/Plugins/src/Core.Plugins.Map/PresentationObjects/MapDataContext.cs
===================================================================
diff -u -r7b3ee0978809b7e423487a599c3ded787efeeefe -rd02ab460ba97ccc3213c3b365158bf9ce2bb1d57
--- Core/Plugins/src/Core.Plugins.Map/PresentationObjects/MapDataContext.cs (.../MapDataContext.cs) (revision 7b3ee0978809b7e423487a599c3ded787efeeefe)
+++ Core/Plugins/src/Core.Plugins.Map/PresentationObjects/MapDataContext.cs (.../MapDataContext.cs) (revision d02ab460ba97ccc3213c3b365158bf9ce2bb1d57)
@@ -34,24 +34,17 @@
/// Creates a new instance of .
///
/// The to wrap.
- /// The parent
- /// the belongs to.
- /// Thrown when any parameter is null.
- protected MapDataContext(MapData wrappedData, MapDataCollection parentMapData)
+ /// Thrown when
+ /// is null.
+ protected MapDataContext(MapData wrappedData)
: base(wrappedData)
{
- if (parentMapData == null)
- {
- throw new ArgumentNullException(nameof(parentMapData));
- }
-
- ParentMapData = parentMapData;
}
///
/// Gets the parent
/// the belongs to.
///
- public MapDataCollection ParentMapData { get; }
+ public abstract MapDataCollection ParentMapData { get; }
}
}
\ No newline at end of file
Index: Core/Plugins/test/Core.Plugins.Map.Test/Legend/MapLegendViewTest.cs
===================================================================
diff -u -r7b3ee0978809b7e423487a599c3ded787efeeefe -rd02ab460ba97ccc3213c3b365158bf9ce2bb1d57
--- Core/Plugins/test/Core.Plugins.Map.Test/Legend/MapLegendViewTest.cs (.../MapLegendViewTest.cs) (revision 7b3ee0978809b7e423487a599c3ded787efeeefe)
+++ Core/Plugins/test/Core.Plugins.Map.Test/Legend/MapLegendViewTest.cs (.../MapLegendViewTest.cs) (revision d02ab460ba97ccc3213c3b365158bf9ce2bb1d57)
@@ -29,7 +29,6 @@
using Core.Common.Util.Reflection;
using Core.Components.Gis.Data;
using Core.Components.Gis.Forms;
-using Core.Components.Gis.TestUtil;
using Core.Plugins.Map.Legend;
using Core.Plugins.Map.PresentationObjects;
using Core.Plugins.Map.Properties;
@@ -184,15 +183,14 @@
// Setup
var mapData = new MapLineData("line data");
var mapDataCollection = new MapDataCollection("collection");
-
mapDataCollection.Add(mapData);
using (var view = new MapLegendView(contextMenuBuilderProvider)
{
Data = mapDataCollection
})
{
- var context = new TestMapDataContext(mapData, mapDataCollection);
+ var context = new TestMapDataContext(mapData);
var treeViewControl = TypeUtils.GetField(view, "treeViewControl");
WindowsFormsTestHelper.Show(treeViewControl);
@@ -244,7 +242,6 @@
// Given
var mapData = new MapLineData("line data");
var mapDataCollection = new MapDataCollection("collection");
-
mapDataCollection.Add(mapData);
using (var view = new MapLegendView(contextMenuBuilderProvider)
@@ -259,7 +256,7 @@
view.SelectionChanged += (sender, args) => selectionChangedCount++;
// When
- var context = new TestMapDataContext(mapData, mapDataCollection);
+ var context = new TestMapDataContext(mapData);
treeViewControl.TrySelectNodeForData(context);
// Then
@@ -269,12 +266,6 @@
WindowsFormsTestHelper.CloseAll();
}
- private class TestMapDataContext : MapDataContext
- {
- public TestMapDataContext(MapData wrappedData, MapDataCollection parentMapData)
- : base(wrappedData, parentMapData) {}
- }
-
[Test]
[Apartment(ApartmentState.STA)]
public void GivenMapLegendView_WhenSettingData_SelectionChangedFired()
@@ -297,5 +288,13 @@
WindowsFormsTestHelper.CloseAll();
}
+
+ private class TestMapDataContext : MapDataContext
+ {
+ public TestMapDataContext(MapData wrappedData)
+ : base(wrappedData) {}
+
+ public override MapDataCollection ParentMapData { get; }
+ }
}
}
\ No newline at end of file
Index: Core/Plugins/test/Core.Plugins.Map.Test/PresentationObjects/FeatureBasedMapDataContextTest.cs
===================================================================
diff -u -r405db3b688bdee707426a1bc0a44c3be3a3dc563 -rd02ab460ba97ccc3213c3b365158bf9ce2bb1d57
--- Core/Plugins/test/Core.Plugins.Map.Test/PresentationObjects/FeatureBasedMapDataContextTest.cs (.../FeatureBasedMapDataContextTest.cs) (revision 405db3b688bdee707426a1bc0a44c3be3a3dc563)
+++ Core/Plugins/test/Core.Plugins.Map.Test/PresentationObjects/FeatureBasedMapDataContextTest.cs (.../FeatureBasedMapDataContextTest.cs) (revision d02ab460ba97ccc3213c3b365158bf9ce2bb1d57)
@@ -19,6 +19,7 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System;
using Core.Components.Gis.Data;
using Core.Components.Gis.TestUtil;
using Core.Plugins.Map.PresentationObjects;
@@ -46,5 +47,16 @@
Assert.AreSame(data, context.WrappedData);
Assert.AreSame(collection, context.ParentMapData);
}
+
+ [Test]
+ public void Constructor_ParentMapDataNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new FeatureBasedMapDataContext(new TestFeatureBasedMapData(), null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("parentMapData", exception.ParamName);
+ }
}
}
\ No newline at end of file
Index: Core/Plugins/test/Core.Plugins.Map.Test/PresentationObjects/MapDataContextTest.cs
===================================================================
diff -u -r7b3ee0978809b7e423487a599c3ded787efeeefe -rd02ab460ba97ccc3213c3b365158bf9ce2bb1d57
--- Core/Plugins/test/Core.Plugins.Map.Test/PresentationObjects/MapDataContextTest.cs (.../MapDataContextTest.cs) (revision 7b3ee0978809b7e423487a599c3ded787efeeefe)
+++ Core/Plugins/test/Core.Plugins.Map.Test/PresentationObjects/MapDataContextTest.cs (.../MapDataContextTest.cs) (revision d02ab460ba97ccc3213c3b365158bf9ce2bb1d57)
@@ -19,7 +19,6 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
-using System;
using Core.Common.Controls.PresentationObjects;
using Core.Components.Gis.Data;
using Core.Components.Gis.TestUtil;
@@ -36,34 +35,21 @@
{
// Setup
MapData data = new TestMapData();
- var collection = new MapDataCollection("test");
- collection.Add(data);
-
// Call
- var context = new TestMapDataContext(data, collection);
+ var context = new TestMapDataContext(data);
// Assert
Assert.IsInstanceOf>(context);
Assert.AreSame(data, context.WrappedData);
- Assert.AreSame(collection, context.ParentMapData);
}
- [Test]
- public void Constructor_ParentMapDataNull_ThrowsArgumentNullException()
+ private class TestMapDataContext : MapDataContext
{
- // Call
- TestDelegate call = () => new TestMapDataContext(new TestMapData(), null);
+ public TestMapDataContext(MapData wrappedData)
+ : base(wrappedData) {}
- // Assert
- var exception = Assert.Throws(call);
- Assert.AreEqual("parentMapData", exception.ParamName);
+ public override MapDataCollection ParentMapData { get; }
}
-
- private class TestMapDataContext : MapDataContext
- {
- public TestMapDataContext(MapData wrappedData, MapDataCollection parentMapData)
- : base(wrappedData, parentMapData) {}
- }
}
}
\ No newline at end of file