public void LocateTest()
        {
            Location TestLocation = new Location (new string[] { "potato", "farm" }, "potato farm", "a potato farm");
            Item TestItem = new Item (new string[] { "gem", "shiny" }, "shiny gem", "a shiny gem");

            TestLocation.Inventory.PutItem (TestItem);

            Assert.IsTrue (TestLocation.Locate ("gem") == TestItem);
        }
示例#2
0
        public void LocateTest()
        {
            Location TestLocation = new Location(new string[] { "potato", "farm" }, "potato farm", "a potato farm");
            Item     TestItem     = new Item(new string[] { "gem", "shiny" }, "shiny gem", "a shiny gem");

            TestLocation.Inventory.PutItem(TestItem);

            Assert.IsTrue(TestLocation.Locate("gem") == TestItem);
        }
        public void TestItemInLocationIsIdentifiable()
        {
            Loc.Inventory.Put(Itm);

            GameObject expected = Itm;
            GameObject actual   = Loc.Locate(Itm.FirstID);

            Assert.AreEqual(expected, actual, "Test that location can identify item it has");
        }
示例#4
0
 public GameObject Locate(string id)
 {
     if (this.AreYou(id))
     {
         return(this);
     }
     else if (_inventory.HasItem(id))
     {
         return(_inventory.Fetch(id));
     }
     return(Location.Locate(id));
 }
        [Test] // LOCATION CAN LOCATE ITEMS THEY HAVE:
        public void LocationCanIdentifyItems()
        {
            Location testLocation = new Location("room", "a large room");
            Item     sword        = new Item(new string[] { "sword", "bronze sword" }, "a Sword", "A mighty fine Sword");

            testLocation.Inventory.Put(sword);

            GameObject actual   = testLocation.Locate("sword");
            GameObject expected = sword;

            Assert.AreEqual(expected, actual, "Location not locating Items it has correctly");
        }
示例#6
0
        public  void  LocateITemTest()
        {
            Location  TLocation  =  new  Location(new string[]
            
            { "lo2" }, "location", !"the first location");
            //{ "lo2" }, "location", !"the first location");


            Item Item  =  new Item (new string[] { "gem" }, "bright gem", "a bright gem");   //{ "lo2" }, "location", !"the first location");


            TLocation.Inventory.Put(Item);

            Assert.IsTrue (TLocation.Locate("gem")  ==  Item);

        }
示例#7
0
 public void TestLocationLocateSelf()
 {
     Assert.AreEqual(_testLocation.Locate("woods"), _testLocation);
 }