コード例 #1
0
        public void GetRootIDTest()
        {
            var parentID   = Guid.NewGuid();
            var childID    = Guid.NewGuid();
            var parentItem = new ItemDefinition(parentID)
            {
                maxStackSize = 5,
                name         = "ParentItem"
            };

            var childItem = new ItemDefinition(childID, parentItem)
            {
                maxStackSize = 3,
                name         = "ChildItem"
            };

            Assert.AreEqual(3, childItem.maxStackSize);
            Assert.AreEqual(5, childItem.parent.maxStackSize);
            Assert.AreEqual(5, parentItem.maxStackSize);

            Assert.AreEqual("ParentItem", parentItem.name);
            Assert.AreEqual("ParentItem", childItem.parent.name);
            Assert.AreEqual("ChildItem", childItem.name);

            Assert.AreEqual(parentItem, childItem.parent);
            Assert.AreEqual(childID, childItem.ID);
            Assert.AreEqual(parentID, childItem.GetRootID());

            Assert.AreEqual(1, childItem.GetParentCount());
            Assert.AreEqual(0, parentItem.GetParentCount());
        }
コード例 #2
0
        public void GetIDTest()
        {
            var id   = Guid.NewGuid();
            var item = new ItemDefinition(id)
            {
                maxStackSize = 3
            };

            Assert.IsNull(item.parent);
            Assert.AreEqual(id, item.ID);
            Assert.AreEqual(id, item.GetRootID());
            Assert.AreEqual(0, item.GetParentCount());
        }