using System; using System.Collections.ObjectModel; using Core.Components.DotSpatial.Data; using NUnit.Framework; namespace Core.Components.DotSpatial.Test.Data { [TestFixture] public class MapPointDataTest { [Test] public void Constructor_NullPoints_ThrowsArgumentNullException() { // Setup TestDelegate test = () => new MapPointData(null); // Call var message = Assert.Throws(test).Message; // Assert StringAssert.Contains(string.Format("A point collection is required when creating a subclass of {0}.", typeof(PointBasedMapData)), message); } [Test] public void Constructor_WithEmptyPoints_CreatesNewMapPointData() { // Setup var points = new Collection>(); // Call var data = new MapPointData(points); // Assert Assert.IsInstanceOf(data); Assert.AreNotSame(points, data.Points); } [Test] public void Constructor_WithPoints_CreatesNewMapPointData() { // Setup var points = CreateTestPoints(); // Call var data = new MapPointData(points); // Assert Assert.IsInstanceOf(data); Assert.AreNotSame(points, data.Points); CollectionAssert.AreEqual(points, data.Points); } private Collection> CreateTestPoints() { return new Collection> { new Tuple(0.0, 1.1), new Tuple(1.0, 2.1), new Tuple(1.6, 1.6) }; } } }