using System; using System.Collections.Generic; using Core.Common.Controls.TreeView; using Core.Common.TestUtil; using Core.Common.Utils.Reflection; using Core.Components.Gis.Data; using Core.Plugins.DotSpatial.Legend; using NUnit.Framework; using DotSpatialResources = Core.Plugins.DotSpatial.Properties.Resources; namespace Core.Plugins.DotSpatial.Test.Legend { [TestFixture] public class MapLineDataTreeNodeInfoTest { private MapLegendView mapLegendView; private TreeNodeInfo info; [SetUp] public void SetUp() { mapLegendView = new MapLegendView(); var treeViewControl = TypeUtils.GetField(mapLegendView, "treeViewControl"); var treeNodeInfoLookup = TypeUtils.GetField>(treeViewControl, "tagTypeTreeNodeInfoLookup"); info = treeNodeInfoLookup[typeof(MapLineData)]; } [Test] public void Initialized_Always_ExpectedPropertiesSet() { // Assert Assert.AreEqual(typeof(MapLineData), info.TagType); Assert.IsNull(info.ForeColor); Assert.IsNull(info.ContextMenuStrip); Assert.IsNull(info.EnsureVisibleOnCreate); Assert.IsNull(info.ChildNodeObjects); Assert.IsNull(info.CanRename); Assert.IsNull(info.OnNodeRenamed); Assert.IsNull(info.CanRemove); Assert.IsNull(info.OnNodeRemoved); Assert.IsNull(info.CanCheck); Assert.IsNull(info.IsChecked); Assert.IsNull(info.OnNodeChecked); Assert.IsNull(info.CanDrag); Assert.IsNull(info.CanDrop); Assert.IsNull(info.CanInsert); Assert.IsNull(info.OnDrop); } [Test] public void Text_Always_ReturnsTextFromResource() { // Call var text = info.Text(null); // Assert Assert.AreEqual(DotSpatialResources.MapDataNodePresenter_Line_data_label, text); } [Test] public void Image_Always_ReturnsImageFromResource() { // Call var image = info.Image(null); // Assert TestHelper.AssertImagesAreEqual(DotSpatialResources.LineIcon, image); } } }