public void TestItemList() { 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.AreEqual (test.ItemList, "a shovel (shovel)\r\na gun (gun)\r\n"); }
public void TestFetchItem() { Inventory test = new Inventory (); Item item1 = new Item( new String[] {"shovel", "spade" }, "a shovel", "This is a might fine ..." ); test.Put(item1); Assert.AreEqual (test.Fetch ("shovel"), item1); }
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 FetchItemTest() { Item TestItem = new Item (new string[] { "potato", "baked" }, "baked potato", "a baked potato"); Inventory TestInventory = new Inventory (); TestInventory.PutItem (TestItem); Assert.IsTrue (TestInventory.FetchItem ("baked") == TestItem); Assert.IsTrue (TestInventory.HasItem ("baked")); }
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 Location(string[] ids, string name, string desc) { _inventory = new Inventory (); this.Name = name; this.LongDesc = desc; foreach(string id in ids) { this.AddIdentifier (id); } }
public Player(string name, string desc) : base(new string[] { "me", "inventory"} , name, desc) { this.Name = name; this.LongDesc = desc; _inventory = new Inventory (); _location = null; _lastlocation = null; }
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 TestNoItem() { Inventory test = new Inventory (); Assert.IsFalse (test.HasItem ("gun")); Assert.IsFalse (test.HasItem ("rifle")); }