public void TestFindItem() { Inv.Put(Itm); bool actual = Inv.HasItem(Itm.FirstID); Assert.IsTrue(actual, "Find item on inventory"); }
public void TestFindItem() { Inventory test = new Inventory (); test.Put(new Item( new String[] {"shovel", "spade" }, "a shovel", "This is a might fine ..." )); test.Put(new Item( new String[] {"gun", "rifle" }, "a gun", "This is a a long spirally grooved ..." )); Assert.IsTrue (test.HasItem ("shovel")); Assert.IsTrue (test.HasItem ("spade")); Assert.IsTrue (test.HasItem ("gun")); Assert.IsTrue (test.HasItem ("rifle")); }
public void TakeItemTest() { Item TestItem = new Item(new string[] { "potato", "baked" }, "baked potato", "a baked potato"); Inventory TestInventory = new Inventory(); TestInventory.PutItem(TestItem); Assert.IsTrue(TestInventory.HasItem("baked")); TestInventory.TakeItem(TestItem); Assert.IsFalse(TestInventory.HasItem("baked")); }
public void TakeItemTest() { Item TestItem = new Item (new string[] { "potato", "baked" }, "baked potato", "a baked potato"); Inventory TestInventory = new Inventory (); TestInventory.PutItem (TestItem); Assert.IsTrue (TestInventory.HasItem ("baked")); TestInventory.TakeItem (TestItem); Assert.IsFalse (TestInventory.HasItem ("baked")); }
public void NoFindItemTest() { Item TestItem = new Item(new string[] { "potato", "baked" }, "baked potato", "a baked potato"); Inventory TestInventory = new Inventory(); TestInventory.PutItem(TestItem); Assert.IsFalse(TestInventory.HasItem("chicken")); }
public void NoFindItemTest() { Item TestItem = new Item (new string[] { "potato", "baked" }, "baked potato", "a baked potato"); Inventory TestInventory = new Inventory (); TestInventory.PutItem (TestItem); Assert.IsFalse (TestInventory.HasItem ("chicken")); }
public void TestFindItem() { Inventory inv = new Inventory(new string[] { "me", "inventory" }, "Player", "Self"); inv.Put(new Item(new string[] { "obj1", "tool1" }, "axe", "normally used to cut wood")); Assert.IsTrue(inv.HasItem("obj1"), "should be true"); }
public void ListItemTest() { Item TestItem = new Item (new string[] { "potato", "baked" }, "baked potato", "a baked potato"); Item TestItem2 = new Item (new string[] { "chicken", "baked" }, "baked chicken", "a baked chicken"); Inventory TestInventory = new Inventory (); TestInventory.PutItem (TestItem); TestInventory.PutItem (TestItem2); //Assert.IsTrue (TestItem.ShortDesc == ("A baked potato potato.")); //ItemList.Add (Check.Name + "\t" + Check.ShortDesc + "\n"); //"baked potato" + "\t" + "A baked potato potato." + "\n" Assert.IsTrue (TestInventory.HasItem ("potato")); Assert.IsTrue (TestInventory.HasItem ("chicken")); Assert.IsTrue (TestInventory.ItemList ().Contains("baked potato" + "\t" + "A baked potato potato." + "\n")); Assert.IsTrue (TestInventory.ItemList ().Contains("baked chicken" + "\t" + "A baked chicken chicken." + "\n")); }
public void ListItemTest() { Item TestItem = new Item(new string[] { "potato", "baked" }, "baked potato", "a baked potato"); Item TestItem2 = new Item(new string[] { "chicken", "baked" }, "baked chicken", "a baked chicken"); Inventory TestInventory = new Inventory(); TestInventory.PutItem(TestItem); TestInventory.PutItem(TestItem2); //Assert.IsTrue (TestItem.ShortDesc == ("A baked potato potato.")); //ItemList.Add (Check.Name + "\t" + Check.ShortDesc + "\n"); //"baked potato" + "\t" + "A baked potato potato." + "\n" Assert.IsTrue(TestInventory.HasItem("potato")); Assert.IsTrue(TestInventory.HasItem("chicken")); Assert.IsTrue(TestInventory.ItemList().Contains("baked potato" + "\t" + "A baked potato potato." + "\n")); Assert.IsTrue(TestInventory.ItemList().Contains("baked chicken" + "\t" + "A baked chicken chicken." + "\n")); }
[Test] // PUT: The inventory has items that are put in it public void TestFindItem() { Inventory testInventoryObject = new Inventory(); Item testItem = new Item(new string[] { "a TestFirstId", "TestSecondId" }, "TestName", "TestDesc"); testInventoryObject.Put(testItem); bool actual = testInventoryObject.HasItem("a testfirstid"); bool expected = true; Assert.AreEqual(expected, actual, "Item not retrieved from Inventory correctly."); }
[Test] // HASITEM: does not have items it does not contain public void TestDontFindNonexistingItem() { Inventory testInventoryObject = new Inventory(); Item testItem = new Item(new string[] { "a TestFirstId", "TestSecondId" }, "TestName", "TestDesc"); testInventoryObject.Put(testItem); bool actual = testInventoryObject.HasItem("Non-existent Item"); bool expected = false; Assert.AreEqual(expected, actual, "Item retrieved from Inventory incorrectly."); }
public GameObject Locate(string id) { if (this.AreYou(id)) { return(this); } else if (_inventory.HasItem(id)) { return(_inventory.Fetch(id)); } return(Location.Locate(id)); }
public GameObject Locate(string id) { if (this.AreYou(id) == true) { return(this); } else if (_inventory.HasItem(id) == true) { return(_inventory.FetchItem(id)); } return(null); }
[Test] // FETCH: Returns items it has, and the item remains in the inventory public void TestFetchItem() { Inventory testInventoryObject = new Inventory(); Item testItem = new Item(new string[] { "a TestFirstId", "TestSecondId" }, "TestName", "TestDesc"); testInventoryObject.Put(testItem); Item fetchedItem = testInventoryObject.Fetch("a testfirstid"); bool actual = testInventoryObject.HasItem("a testfirstid"); bool expected = true; Assert.AreEqual(expected, actual, "Item has been fetched and no longer exists in inventory."); }
public void TestFindItem() { Assert.IsTrue(_inventory.HasItem("shovel")); }
public void TestNoItem() { Inventory test = new Inventory (); Assert.IsFalse (test.HasItem ("gun")); Assert.IsFalse (test.HasItem ("rifle")); }
public void TestNoItemFind() { Inventory inv = new Inventory(new string[] { "me", "inventory" }, "Player", "Self"); Assert.IsFalse(inv.HasItem("obj1"), "should be false"); }