public void SerializeItemInfo() { IItemInfo info = new ItemConsumableInfo(ItemClassCode.Potion, ItemType.HealingPotion, 5, "Healing Potion"); IItemInfo infoClone = Serializer.DeepClone(info); Assert.AreEqual(info.ClassCode, infoClone.ClassCode); Assert.AreEqual(info.TypeCode, infoClone.TypeCode); Assert.IsTrue(info is IItemConsumableInfo); Assert.AreEqual(info.Name, infoClone.Name); }
public void InventoryAddStackable() { IInventory inventory = new Inventory(60); IItemInfo info = new ItemConsumableInfo(ItemClassCode.Potion, ItemType.HealingPotion, 10); IItem testItem = new Item(Guid.NewGuid(), info, null, ItemQualityCode.Superior, 1); IItem testItem2 = new Item(Guid.NewGuid(), info, null, ItemQualityCode.Superior, 1); IItem testItem3 = new Item(Guid.NewGuid(), info, null, ItemQualityCode.Superior, 1); inventory.Set(testItem, InventorySlot.Inventory1, null); inventory.Set(testItem2, InventorySlot.Inventory1, null); inventory.Set(testItem3, InventorySlot.Inventory1, null); Assert.AreEqual(inventory.Remaining, 59); IItem getItem = inventory.Get(InventorySlot.Inventory1, null); Assert.IsNotNull(getItem); Assert.AreEqual(3, getItem.Count); Assert.AreEqual(inventory.Remaining, 60); }