Ejemplo n.º 1
1
 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");
 }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
        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"));
        }
Ejemplo n.º 4
0
        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"));
        }
Ejemplo n.º 5
0
 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"));
 }
Ejemplo n.º 6
0
        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);
            }
        }
Ejemplo n.º 7
0
        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;
        }
Ejemplo n.º 8
0
        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"));
        }
Ejemplo n.º 9
0
 public void TestNoItem()
 {
     Inventory test = new Inventory ();
     Assert.IsFalse (test.HasItem ("gun"));
     Assert.IsFalse (test.HasItem ("rifle"));
 }