Beispiel #1
0
 public void TestBagLocationItems()
 {
     Bag test = new Bag (new string[]{"Bag", "Backpack"}, "a bag", "This is a bag for....");
     Item item1 = new Item( new String[] {"shovel", "spade" }, "a shovel", "This is a might fine ..." );
     test.Inventory.Put (item1);
     Assert.AreEqual(test.Locate ("shovel"),item1);
 }
Beispiel #2
0
        public void BagBagTest()
        {
            Bag b1 = new Bag(new string[] { "b1", "Bag" }, "Test Bag", "A Testing Bag");
            Bag b2 = new Bag(new string[] { "b2", "Bag" }, "b2 Bag", "A Testing Bag");

            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");

            b1.Inventory.PutItem(TestItem);
            b2.Inventory.PutItem(TestItem2);
            b1.Inventory.PutItem(b2);

            Assert.IsTrue(b1.Locate("potato") == TestItem);
            Assert.IsFalse(b1.Locate("chicken") == TestItem2);
            Assert.IsTrue(b1.Locate("b2") == b2);
        }
Beispiel #3
0
        public void BagBagTest()
        {
            Bag b1 = new Bag (new string[] { "b1", "Bag" }, "Test Bag", "A Testing Bag");
            Bag b2 = new Bag (new string[] { "b2", "Bag" }, "b2 Bag", "A Testing Bag");

            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");

            b1.Inventory.PutItem (TestItem);
            b2.Inventory.PutItem (TestItem2);
            b1.Inventory.PutItem (b2);

            Assert.IsTrue (b1.Locate ("potato") == TestItem);
            Assert.IsFalse (b1.Locate ("chicken") == TestItem2);
            Assert.IsTrue (b1.Locate ("b2") == b2);
        }
Beispiel #4
0
        [Test] // LOCATE: The Bag can locate itself
        public void TestLocateBagItself()
        {
            Bag testBag = new Bag(new string[] { "bag", "container" }, "a Bag", "A Container for Items");

            // Locate the BAG and store in GameObject:
            GameObject actual   = testBag.Locate("bag");
            GameObject expected = testBag;

            Assert.AreEqual(expected, actual, "The Bag is not locating itself correctly.");
        }
Beispiel #5
0
        public void LocateTest()
        {
            Bag TestBag = new Bag(new string[] { "Test", "Bag" }, "Test Bag", "A Testing Bag");

            Item TestItem = new Item(new string[] { "potato", "baked" }, "baked potato", "a baked potato");

            TestBag.Inventory.PutItem(TestItem);

            Assert.IsTrue(TestBag.Locate("potato") == TestItem);
        }
Beispiel #6
0
        public void LocateTest()
        {
            Bag TestBag = new Bag (new string[] { "Test", "Bag" }, "Test Bag", "A Testing Bag");

            Item TestItem = new Item (new string[] { "potato", "baked" }, "baked potato", "a baked potato");

            TestBag.Inventory.PutItem (TestItem);

            Assert.IsTrue (TestBag.Locate ("potato") == TestItem);
        }
Beispiel #7
0
        [Test] // LOCATE: Return null if located item not in Bag
        public void TestLocateBagReturnsNull()
        {
            Bag  testBag  = new Bag(new string[] { "bag", "container" }, "a Bag", "A Container for Items");
            Item testItem = new Item(new string[] { "item", "A passed item" }, "an item", "This item could be anything");

            // Return NULL if an Item cannot be found:
            GameObject actual   = testBag.Locate("different item");
            GameObject expected = null;

            Assert.AreEqual(expected, actual, "The Bag is not locating itself correctly.");
        }
Beispiel #8
0
        public void TestBagLocatesItem()
        {
            B1.Inventory.Put(Itm);
            GameObject actual   = B1.Locate(Itm.FirstID);
            GameObject expected = Itm;

            Assert.AreEqual(expected, actual, "Test bag can locate item");
        }
Beispiel #9
0
        [Test] // LOCATE: The Bag can locate items in its inventory
        public void TestLocateBagItems()
        {
            Bag  testBag  = new Bag(new string[] { "bag", "container" }, "a Bag", "A Container for Items");
            Item testItem = new Item(new string[] { "item", "A passed item" }, "an item", "This item could be anything");

            testBag.Inventory.Put(testItem);

            // Locate the item and store in GameObject:
            GameObject locatedItem = testBag.Locate("item");

            // Search Inventory for item:
            bool actual = testBag.Inventory.HasItem("item");

            bool expected = true;

            Assert.AreEqual(expected, actual, "Item in Bag's Inventory is not locating correctly.");
        }
Beispiel #10
0
        public void LocateNullTest()
        {
            Bag TestBag = new Bag(new string[] { "Test", "Bag" }, "Test Bag", "A Testing Bag");

            Assert.IsTrue(TestBag.Locate("testfail") == null);
        }
Beispiel #11
0
        public void LocateSelfTest()
        {
            Bag TestBag = new Bag(new string[] { "Test", "Bag" }, "Test Bag", "A Testing Bag");

            Assert.IsTrue(TestBag.Locate("test") == TestBag);
        }
Beispiel #12
0
 public void TestBagLocateItself()
 {
     Assert.AreEqual(_b1, _b1.Locate("lbag"));
     Assert.AreEqual(_b1, _b1.Locate("lpouch"));
 }
Beispiel #13
0
        public void LocateNullTest()
        {
            Bag TestBag = new Bag (new string[] { "Test", "Bag" }, "Test Bag", "A Testing Bag");

            Assert.IsTrue (TestBag.Locate ("testfail") == null);
        }
Beispiel #14
0
 public void TestBagLocateNothing()
 {
     Bag test = new Bag (new string[]{"Bag", "Backpack"}, "a bag", "This is a bag for....");
     Assert.AreEqual(test.Locate ("Sth"),null);
 }
Beispiel #15
0
 public void TestBagLocateItself()
 {
     Bag test = new Bag (new string[]{"Bag", "Backpack"}, "a bag", "This is a bag for....");
     Assert.AreEqual(test.Locate ("Bag"),test);
 }
Beispiel #16
0
        public void TestBagLocatesNothing()
        {
            Bag plr = new Bag(new string[] { "bag", "container" }, "Bag", "holds stuff");

            Assert.IsNull(plr.Locate("obj1"), "should be null");
        }
Beispiel #17
0
        public void TestBagLocatesItself()
        {
            Bag plr = new Bag(new string[] { "bag", "container" }, "Bag", "holds stuff");

            Assert.AreEqual(plr.Locate("bag"), plr, "should be equal");
        }
Beispiel #18
0
        public void LocateSelfTest()
        {
            Bag TestBag = new Bag (new string[] { "Test", "Bag" }, "Test Bag", "A Testing Bag");

            Assert.IsTrue (TestBag.Locate ("test") == TestBag);
        }