Index: Core/Common/test/Core.Common.Controls.TreeView.Test/Core.Common.Controls.TreeView.Test.csproj =================================================================== diff -u -rf24e27cd856cf597082209f97478815b5e9cebbe -rf7f58324728d778611e81aec9f56fdc0669b5df5 --- Core/Common/test/Core.Common.Controls.TreeView.Test/Core.Common.Controls.TreeView.Test.csproj (.../Core.Common.Controls.TreeView.Test.csproj) (revision f24e27cd856cf597082209f97478815b5e9cebbe) +++ Core/Common/test/Core.Common.Controls.TreeView.Test/Core.Common.Controls.TreeView.Test.csproj (.../Core.Common.Controls.TreeView.Test.csproj) (revision f7f58324728d778611e81aec9f56fdc0669b5df5) @@ -61,6 +61,7 @@ + Index: Core/Common/test/Core.Common.Controls.TreeView.Test/TreeNodeInfoTest.cs =================================================================== diff -u --- Core/Common/test/Core.Common.Controls.TreeView.Test/TreeNodeInfoTest.cs (revision 0) +++ Core/Common/test/Core.Common.Controls.TreeView.Test/TreeNodeInfoTest.cs (revision f7f58324728d778611e81aec9f56fdc0669b5df5) @@ -0,0 +1,195 @@ +using System; +using System.Drawing; +using System.Windows.Forms; +using NUnit.Framework; + +namespace Core.Common.Controls.TreeView.Test +{ + [TestFixture] + public class TreeNodeInfoTest + { + [Test] + public void DefaultConstructor_ExpectedValues() + { + // Call + var treeNodeInfo = new TreeNodeInfo(); + + // Assert + Assert.IsNull(treeNodeInfo.TagType); + Assert.IsNull(treeNodeInfo.Text); + Assert.IsNull(treeNodeInfo.ForeColor); + Assert.IsNull(treeNodeInfo.Image); + Assert.IsNull(treeNodeInfo.ContextMenuStrip); + Assert.IsNull(treeNodeInfo.EnsureVisibleOnCreate); + Assert.IsNull(treeNodeInfo.ChildNodeObjects); + Assert.IsNull(treeNodeInfo.CanRename); + Assert.IsNull(treeNodeInfo.OnNodeRenamed); + Assert.IsNull(treeNodeInfo.CanRemove); + Assert.IsNull(treeNodeInfo.OnNodeRemoved); + Assert.IsNull(treeNodeInfo.CanCheck); + Assert.IsNull(treeNodeInfo.IsChecked); + Assert.IsNull(treeNodeInfo.OnNodeChecked); + Assert.IsNull(treeNodeInfo.CanDrag); + Assert.IsNull(treeNodeInfo.CanDrop); + Assert.IsNull(treeNodeInfo.CanInsert); + Assert.IsNull(treeNodeInfo.OnDrop); + } + + [Test] + public void SimpleProperties_SetNewValues_GetNewlySetValues() + { + // Setup + var treeNodeInfo = new TreeNodeInfo(); + var tagType = typeof(int); + Func text = o => ""; + Func foreColor = o => Color.Azure; + Func image = o => new Bitmap(16, 16); + Func contextMenuStrip = (o1, o2, tvc) => new ContextMenuStrip(); + Func ensureVisibleOnCreate = o => true; + Func childNodeObjects = o => new object[0]; + Func canRename = (o1, o2) => true; + Action onNodeRenamed = (o, newName) => { }; + Func canRemove = (o1, o2) => true; + Action onNodeRemoved = (o1, o2) => { }; + Func canCheck = o => true; + Func isChecked = o => true; + Action onNodeChecked = (o1, o2) => { }; + Func canDrag = (o1, o2) => true; + Func canDrop = (o1, o2) => true; + Func canInsert = (o1, o2) => true; + Action onDrop = (o1, o2, o3, index, tvc) => { }; + + // Call + treeNodeInfo.TagType = tagType; + treeNodeInfo.Text = text; + treeNodeInfo.ForeColor = foreColor; + treeNodeInfo.Image = image; + treeNodeInfo.ContextMenuStrip = contextMenuStrip; + treeNodeInfo.EnsureVisibleOnCreate = ensureVisibleOnCreate; + treeNodeInfo.ChildNodeObjects = childNodeObjects; + treeNodeInfo.CanRename = canRename; + treeNodeInfo.OnNodeRenamed = onNodeRenamed; + treeNodeInfo.CanRemove = canRemove; + treeNodeInfo.OnNodeRemoved = onNodeRemoved; + treeNodeInfo.CanCheck = canCheck; + treeNodeInfo.IsChecked = isChecked; + treeNodeInfo.OnNodeChecked = onNodeChecked; + treeNodeInfo.CanDrag = canDrag; + treeNodeInfo.CanDrop = canDrop; + treeNodeInfo.CanInsert = canInsert; + treeNodeInfo.OnDrop = onDrop; + + // Assert + Assert.AreEqual(tagType, treeNodeInfo.TagType); + Assert.AreEqual(text, treeNodeInfo.Text); + Assert.AreEqual(foreColor, treeNodeInfo.ForeColor); + Assert.AreEqual(image, treeNodeInfo.Image); + Assert.AreEqual(contextMenuStrip, treeNodeInfo.ContextMenuStrip); + Assert.AreEqual(ensureVisibleOnCreate, treeNodeInfo.EnsureVisibleOnCreate); + Assert.AreEqual(childNodeObjects, treeNodeInfo.ChildNodeObjects); + Assert.AreEqual(canRename, treeNodeInfo.CanRename); + Assert.AreEqual(onNodeRenamed, treeNodeInfo.OnNodeRenamed); + Assert.AreEqual(canRemove, treeNodeInfo.CanRemove); + Assert.AreEqual(onNodeRemoved, treeNodeInfo.OnNodeRemoved); + Assert.AreEqual(canCheck, treeNodeInfo.CanCheck); + Assert.AreEqual(isChecked, treeNodeInfo.IsChecked); + Assert.AreEqual(onNodeChecked, treeNodeInfo.OnNodeChecked); + Assert.AreEqual(canDrag, treeNodeInfo.CanDrag); + Assert.AreEqual(canDrop, treeNodeInfo.CanDrop); + Assert.AreEqual(canInsert, treeNodeInfo.CanInsert); + Assert.AreEqual(onDrop, treeNodeInfo.OnDrop); + } + + [Test] + public void DefaultGenericConstructor_ExpectedValues() + { + // Call + var treeNodeInfo = new TreeNodeInfo(); + + // Assert + Assert.AreEqual(typeof(object), treeNodeInfo.TagType); + Assert.IsNull(treeNodeInfo.Text); + Assert.IsNull(treeNodeInfo.ForeColor); + Assert.IsNull(treeNodeInfo.Image); + Assert.IsNull(treeNodeInfo.ContextMenuStrip); + Assert.IsNull(treeNodeInfo.EnsureVisibleOnCreate); + Assert.IsNull(treeNodeInfo.ChildNodeObjects); + Assert.IsNull(treeNodeInfo.CanRename); + Assert.IsNull(treeNodeInfo.OnNodeRenamed); + Assert.IsNull(treeNodeInfo.CanRemove); + Assert.IsNull(treeNodeInfo.OnNodeRemoved); + Assert.IsNull(treeNodeInfo.CanCheck); + Assert.IsNull(treeNodeInfo.IsChecked); + Assert.IsNull(treeNodeInfo.OnNodeChecked); + Assert.IsNull(treeNodeInfo.CanDrag); + Assert.IsNull(treeNodeInfo.CanDrop); + Assert.IsNull(treeNodeInfo.CanInsert); + Assert.IsNull(treeNodeInfo.OnDrop); + } + + [Test] + public void SimpleProperties_GenericTreeNodeInfoSetNewValues_GetNewlySetValues() + { + // Setup + var treeNodeInfo = new TreeNodeInfo(); + var tagType = typeof(int); + Func text = o => ""; + Func foreColor = o => Color.Azure; + Func image = o => new Bitmap(16, 16); + Func contextMenuStrip = (o1, o2, tvc) => new ContextMenuStrip(); + Func ensureVisibleOnCreate = o => true; + Func childNodeObjects = o => new object[0]; + Func canRename = (o1, o2) => true; + Action onNodeRenamed = (o, newName) => { }; + Func canRemove = (o1, o2) => true; + Action onNodeRemoved = (o1, o2) => { }; + Func canCheck = o => true; + Func isChecked = o => true; + Action onNodeChecked = (o1, o2) => { }; + Func canDrag = (o1, o2) => true; + Func canDrop = (o1, o2) => true; + Func canInsert = (o1, o2) => true; + Action onDrop = (o1, o2, o3, index, tvc) => { }; + + // Call + treeNodeInfo.TagType = tagType; + treeNodeInfo.Text = text; + treeNodeInfo.ForeColor = foreColor; + treeNodeInfo.Image = image; + treeNodeInfo.ContextMenuStrip = contextMenuStrip; + treeNodeInfo.EnsureVisibleOnCreate = ensureVisibleOnCreate; + treeNodeInfo.ChildNodeObjects = childNodeObjects; + treeNodeInfo.CanRename = canRename; + treeNodeInfo.OnNodeRenamed = onNodeRenamed; + treeNodeInfo.CanRemove = canRemove; + treeNodeInfo.OnNodeRemoved = onNodeRemoved; + treeNodeInfo.CanCheck = canCheck; + treeNodeInfo.IsChecked = isChecked; + treeNodeInfo.OnNodeChecked = onNodeChecked; + treeNodeInfo.CanDrag = canDrag; + treeNodeInfo.CanDrop = canDrop; + treeNodeInfo.CanInsert = canInsert; + treeNodeInfo.OnDrop = onDrop; + + // Assert + Assert.AreEqual(tagType, treeNodeInfo.TagType); + Assert.AreEqual(text, treeNodeInfo.Text); + Assert.AreEqual(foreColor, treeNodeInfo.ForeColor); + Assert.AreEqual(image, treeNodeInfo.Image); + Assert.AreEqual(contextMenuStrip, treeNodeInfo.ContextMenuStrip); + Assert.AreEqual(ensureVisibleOnCreate, treeNodeInfo.EnsureVisibleOnCreate); + Assert.AreEqual(childNodeObjects, treeNodeInfo.ChildNodeObjects); + Assert.AreEqual(canRename, treeNodeInfo.CanRename); + Assert.AreEqual(onNodeRenamed, treeNodeInfo.OnNodeRenamed); + Assert.AreEqual(canRemove, treeNodeInfo.CanRemove); + Assert.AreEqual(onNodeRemoved, treeNodeInfo.OnNodeRemoved); + Assert.AreEqual(canCheck, treeNodeInfo.CanCheck); + Assert.AreEqual(isChecked, treeNodeInfo.IsChecked); + Assert.AreEqual(onNodeChecked, treeNodeInfo.OnNodeChecked); + Assert.AreEqual(canDrag, treeNodeInfo.CanDrag); + Assert.AreEqual(canDrop, treeNodeInfo.CanDrop); + Assert.AreEqual(canInsert, treeNodeInfo.CanInsert); + Assert.AreEqual(onDrop, treeNodeInfo.OnDrop); + } + } +}