public void AreYouTest() { Location TestLocation = new Location (new string[] { "potato", "farm" }, "potato farm", "a potato farm"); Assert.IsTrue (TestLocation.AreYou ("potato")); Assert.IsTrue (TestLocation.AreYou ("farm")); }
public void AreYouTest() { Location TestLocation = new Location(new string[] { "potato", "farm" }, "potato farm", "a potato farm"); Assert.IsTrue(TestLocation.AreYou("potato")); Assert.IsTrue(TestLocation.AreYou("farm")); }
[Test] // LOCATION CAN IDENTIFY ITSELF: public void LocationIdentifyItself() { Location testLocation = new Location("room", "a large room"); bool actual = testLocation.AreYou("room"); bool expected = true; Assert.AreEqual(expected, actual, "AreYou() Method passed through Location is not identifying matches correctly."); }
public Location GetLocation(string direction) { if (direction == "n" || direction == "up" || direction == "north") { return(_north); } else if (direction == "s" || direction == "down" || direction == "south") { return(_south); } else if (direction == "e" || direction == "east") { return(_east); } else if (direction == "w" || direction == "west") { return(_west); } else if (direction == "a" || direction == "north_east") { return(_north_east); } else if (direction == "b" || direction == "north_west") { return(_north_west); } else if (direction == "c" || direction == "south_east") { return(_south_east); } else if (direction == "d" || direction == "south_west") { return(_south_west); } else { if (_north != null) { if (_north.AreYou(direction)) { return(_north); } } if (_south != null) { if (_south.AreYou(direction)) { return(_south); } } if (_east != null) { if (_east.AreYou(direction)) { return(_east); } } if (_west != null) { if (_west.AreYou(direction)) { return(_west); } } if (_north_east != null) { if (_north_east.AreYou(direction)) { return(_north_east); } } if (_north_west != null) { if (_north_west.AreYou(direction)) { return(_north_west); } } if (_south_east != null) { if (_south_east.AreYou(direction)) { return(_south_east); } } if (_south_west != null) { if (_south_west.AreYou(direction)) { return(_south_west); } } return(null); } }
public void TestLocationIsIdentifiable() { bool actual = Loc.AreYou("here"); Assert.IsTrue(actual, "Location is identifiable through keyword"); }