public void TestPlayerLocatesThemselves() { GameObject expected = p; GameObject actual = p.Locate("me"); Assert.AreEqual(expected, actual, "Test player can locate themselves"); }
public void LocateItemsTest() { Player TestPlayer = new Player ("TestPlayer", "For testing"); Item TestItem = new Item (new string[] { "potato", "baked" }, "baked potato", "a baked potato"); TestPlayer.Inventory.PutItem (TestItem); //Assert.IsTrue (TestPlayer.Locate ("TestPlayer")== TestPlayer); Assert.IsTrue (TestPlayer.Locate ("potato") == TestItem); Assert.IsTrue (TestPlayer.Locate ("potato") == TestItem); }
public void LocateItemsTest() { Player TestPlayer = new Player("TestPlayer", "For testing"); Item TestItem = new Item(new string[] { "potato", "baked" }, "baked potato", "a baked potato"); TestPlayer.Inventory.PutItem(TestItem); //Assert.IsTrue (TestPlayer.Locate ("TestPlayer")== TestPlayer); Assert.IsTrue(TestPlayer.Locate("potato") == TestItem); Assert.IsTrue(TestPlayer.Locate("potato") == TestItem); }
public void TestLocatesItem() { Player test = new Player ("Player 1", "a funny wizard"); 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); }
[Test] // LOCATE: The Player returns itself if asked to locate "me" or "inventory": public void testLocatePlayerOrInventory() { Player testPlayer = new Player("Fred", "The Mighty Programmer"); GameObject locatedPlayer = testPlayer.Locate("me"); GameObject locatedInventory = testPlayer.Locate("inventory"); bool actual = false; if (locatedPlayer == testPlayer && locatedInventory != null) { actual = true; } bool expected = true; Assert.AreEqual(expected, actual, "Player is not returning itself or its inventory correctly."); }
public void LocatePlayerTest() { Player TestPlayer = new Player ("TestPlayer", "For testing"); //Assert.IsTrue (TestPlayer.Locate ("TestPlayer")== TestPlayer); Assert.IsTrue (TestPlayer.Locate ("me") == TestPlayer); }
public void LocateNothingTest() { Player TestPlayer = new Player("TestPlayer", "For testing"); //Assert.IsTrue (TestPlayer.Locate ("TestPlayer")== TestPlayer); Assert.IsTrue(TestPlayer.Locate("potato") == null); }
public void LocatePlayerTest() { Player TestPlayer = new Player("TestPlayer", "For testing"); //Assert.IsTrue (TestPlayer.Locate ("TestPlayer")== TestPlayer); Assert.IsTrue(TestPlayer.Locate("me") == TestPlayer); }
public void LocateNothingTest() { Player TestPlayer = new Player ("TestPlayer", "For testing"); //Assert.IsTrue (TestPlayer.Locate ("TestPlayer")== TestPlayer); Assert.IsTrue (TestPlayer.Locate ("potato") == null); }
public IHaveInventory FetchContainer(Player p, string containerId) { if (p.AreYou(containerId)) { return(p); } return(p.Locate(containerId) as IHaveInventory); }
[Test] // LOCATE: The Player returns a null if asked to locate something it does not have public void TestLocateNot() { Player testPlayer = new Player("Fred", "The Mighty Programmer"); GameObject actual = testPlayer.Locate("non-existent item"); GameObject expected = null; Assert.AreEqual(expected, actual, "Player has retrieved a non-existent item from inventory."); }
public void TestPlayerLocateinLocation() { Player test = new Player ("Player 1", "a funny wizard"); Locations testLocation = new Locations("park","a nice park which is ..."); Item item1 = new Item( new String[] {"shovel", "spade" }, "a shovel", "This is a might fine ..." ); testLocation.Inventory.Put (item1); test.Location = testLocation; Assert.AreEqual (test.Location,testLocation); Assert.AreEqual (test.Locate("shovel"),item1); }
public void TestPlayerCanLocateItems() { Loc.Inventory.Put(Itm); P.Location = Loc; GameObject expected = Itm; GameObject actual = P.Locate(Itm.FirstID); Assert.AreEqual(expected, actual); }
private IHaveInventory FetchContainer(Player p, string containerId) { GameObject obj = p.Locate(containerId); if (obj == null && p.Location.AreYou(containerId)) { obj = p.Location; } IHaveInventory container = obj as IHaveInventory; return(container); }
[Test] // PLAYERS CAN LOCATE ITEMS IN THEIR LOCATION: public void PlayerCanLocateItemsInLocation() { Location testLocation = new Location("room", "a large room"); Player andrew = new Player("Andrew", "HD Student"); Item sword = new Item(new string[] { "sword", "bronze sword" }, "a Sword", "A mighty fine Sword"); testLocation.Inventory.Put(sword); andrew.Location = testLocation; GameObject actual = andrew.Locate("sword"); GameObject expected = sword; Assert.AreEqual(expected, actual, "Player not able to locate items in Player's location correctly."); }
[Test] // LOCATE: The Player can locate items in its inventory public void TestLocateItems() { Player testPlayer = new Player("Fred", "The Mighty Programmer"); Item testItem = new Item(new string[] { "a TestFirstId", "TestSecondId" }, "TestName", "TestDesc"); testPlayer.Inventory.Put(testItem); // Locate the item and store in GameObject: GameObject locatedItem = testPlayer.Locate("TestName"); // Search Inventory for item: bool actual = testPlayer.Inventory.HasItem("a testfirstid"); bool expected = true; Assert.AreEqual(expected, actual, "Item in Players Inventory is not locating correctly."); }
/// <summary> /// Looks at in. /// </summary> private string LookAtIn(Player p, string thingId, string containerId) { string output = ""; GameObject obj= p.Locate (containerId); if (obj != null) { IHaveInventory container = obj as IHaveInventory; if (container.Locate (thingId) != null) { output = container.Locate (thingId).FullDescription; } else { if (containerId == "inventory") { output = "I cannot find the " + thingId; } else { output = "I cannot find the " + thingId + " in the " + containerId; } } } else { output = "I cannot find the " + containerId; } return output; }
public string LookAtIn(Player p, string thingId, string containerId) { if (p.AreYou(thingId)) { return(p.LongDesc); } GameObject wantedItem = null; IHaveInventory wantedInventory = p.Locate(containerId) as IHaveInventory; if (p.AreYou(containerId) || containerId == "") { wantedInventory = (IHaveInventory)p; //return p.LongDesc; } if (wantedInventory == null) { return("i cannot find the " + containerId); } wantedItem = wantedInventory.Locate(thingId); if (wantedItem == null) { if (containerId == "") { return("i cannot find the " + thingId); } else { return("i cannot find the " + thingId + " in " + containerId); } } return(wantedItem.LongDesc); }
public string LookAtIn(Player p, string thingId, string containerId) { if (p.AreYou(thingId)) { return p.LongDesc; } GameObject wantedItem = null; IHaveInventory wantedInventory = p.Locate(containerId) as IHaveInventory; if (p.AreYou (containerId) || containerId == "") { wantedInventory = (IHaveInventory)p; //return p.LongDesc; } if (wantedInventory == null) { return "i cannot find the " + containerId; } wantedItem = wantedInventory.Locate (thingId); if (wantedItem == null) { if (containerId == "") { return "i cannot find the " + thingId; } else { return "i cannot find the " + thingId + " in " + containerId; } } return wantedItem.LongDesc; }
public void TestLocatesNothing() { Player plr = new Player("name", "cool guy"); Assert.IsNull(plr.Locate("obj1"), "should be null"); }
public void TestLocatesItself() { Player test = new Player ("Player 1", "a funny wizard"); Assert.AreEqual (test.Locate("me"),test); }
public void TestLocatesNothing() { Player test = new Player ("Player 1", "a funny wizard"); Assert.AreEqual (test.Locate("123"),null); }
public void TestPlayerLocateItemsLocation() { Assert.AreEqual(_testGem, _testPlayer.Locate("gem")); }
private IHaveInventory FetchContainer(Player p, string containerId) { return((IHaveInventory)p.Locate(containerId)); }
public void TestPlayerLocatesSelf() { Player plr = new Player("name", "cool guy"); Assert.AreEqual(plr.Locate("me"), plr, "should be equal"); }
private IHaveInventory FetchContainer(Player p, string containerid) { return(p.Locate(containerid) as IHaveInventory); }
private IHasInventory FetchContainer(Player p, string containerId) { GameObject container = p.Locate(containerId); return(container as IHasInventory); }
public void TestPlayerLocateNothing() { Assert.AreEqual(_player1.Locate("service"), null); }