using System; using System.Linq; using Core.Common.TestUtil; using Core.Components.Gis.Data; using NUnit.Framework; namespace Core.Components.Gis.Test.Data { [TestFixture] public class MapDataCollectionTest { [Test] public void Constructor_NullList_ThrowsArgumentNullException() { // Call TestDelegate test = () => new MapDataCollection(null, "test data"); // Assert TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, "A list collection is required when creating MapDataCollection."); } [Test] [TestCase("")] [TestCase(" ")] [TestCase(null)] public void Constructor_InvalidName_ThrowsArgumentExcpetion(string invalidName) { // Setup var list = Enumerable.Empty().ToList(); // Call TestDelegate test = () => new MapDataCollection(list, invalidName); // Assert TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, "A name must be set to map data"); } [Test] public void Constructor_ListSet_InstanceWithListSet() { // Setup var list = Enumerable.Empty().ToList(); // Call var collection = new MapDataCollection(list, "test data"); // Assert Assert.IsInstanceOf(collection); Assert.AreSame(list, collection.List); } [Test] public void Constructor_WithName_SetsName() { // Setup var list = Enumerable.Empty().ToList(); var name = "Some name"; // Call var data = new MapDataCollection(list, name); // Assert Assert.AreEqual(name, data.Name); } } }