public IEnumerator CraftItem() { var inv = new Dummy_Inventory(2); var item = new Item("Test", 4); inv.AddItem(item, 4); inv.AddItem(item, 4); var owner = new Test_InventoryOwner(inv, 10); var craftResult = new Item("TestC", 1); var itemCrafting = new ItemCrafting(new List <Item>() { craftResult }, new List <CraftingRecipe>() { new CraftingRecipe(new List <Item>() { item }, new List <int>() { 8 }) }); var crafting = new Crafting(new List <ItemCrafting>() { itemCrafting }); crafting.Craft(owner, 0); Assert.AreEqual(craftResult, inv.GetItem(0)); Assert.AreEqual(1, inv.GetItem(0).count); Assert.AreEqual(Item.Empty, inv.GetItem(1)); yield return(null); }
public IEnumerator AddItem() { var i = new Dummy_Inventory(9); var itemData = new Item("Test1", 1); i.AddItem(itemData, 1); Assert.AreEqual(itemData, i.GetItem(0)); Assert.AreEqual(1, i.GetItem(0).count); yield return(null); }
public IEnumerator AddItemFillStack() { var i = new Dummy_Inventory(9); var itemData = new Item("Test1", 1); i.AddItem(itemData, 4); Assert.AreEqual(i.GetItem(0), itemData); Assert.AreEqual(i.GetItem(0).StackFull, true); Assert.AreEqual(i.GetItem(1), Item.Empty); yield return(null); }
public IEnumerator SortByName() { var i = new Dummy_Inventory(9); var itemDataA = new Item("TestA", 1); var itemDataB = new Item("TestB", 1); i.AddItem(itemDataA, 1); i.AddItem(itemDataB, 1); i.SortByName(); Assert.AreEqual(itemDataA, i.GetItem(0)); Assert.AreEqual(itemDataB, i.GetItem(1)); yield return(null); }
public IEnumerator SortByType() { var i = new Dummy_Inventory(9); var itemDataA = new Item("A", ItemType.armor, 1); var itemDataB = new Item("B", ItemType.collectable, 1); i.AddItem(itemDataA, 1); i.AddItem(itemDataB, 1); i.SortByType(); Assert.AreEqual(itemDataA.Type, i.GetItem(0).Type); Assert.AreEqual(itemDataB.Type, i.GetItem(1).Type); yield return(null); }
public IEnumerator SwitchItem() { var i = new Dummy_Inventory(9); var itemData = new Item("Test1", 1); var itemData2 = new Item("Test2", 1); i.AddItem(itemData, 1); i.AddItem(itemData2, 1); i.SwitchPositions(0, 1); Assert.AreEqual(itemData, i.GetItem(1)); Assert.AreEqual(itemData2, i.GetItem(0)); yield return(null); }
public IEnumerator SwitchSameItemFromTwoDifferentInventories() { var i = new Dummy_Inventory(9); var i2 = new Dummy_Inventory(9); var itemData = new Item("Test1", 1); var itemData2 = new Item("Test1", 1); i.AddItem(itemData); i2.AddItem(itemData2); i2.SwitchPositions(0, 0, i); Assert.AreEqual(Item.Empty, i.GetItem(0)); Assert.AreEqual(itemData, i2.GetItem(0)); Assert.AreEqual(2, i2.GetItem(0).count); yield return(null); }
public IEnumerator AddItemRemoveMoreThanPossible() { var i = new Dummy_Inventory(9); var itemData = new Item("Test1", 1); i.AddItem(itemData, 4); Assert.AreEqual(i.RemoveItem(itemData, 6), false); Assert.AreEqual(i.GetItem(0).count, 4); yield return(null); }
public IEnumerator AddItemRemoveItem() { var i = new Dummy_Inventory(9); var itemData = new Item("Test1", 1); i.AddItem(itemData, 4); Assert.AreEqual(i.RemoveItem(itemData, 4), true); Assert.AreEqual(i.GetItem(0), Item.Empty); yield return(null); }