public void TestParseParameters_InvalidDirection() { var paramParser = new PlaceCommandParameterParser(); string[] rawInput = "PLACE 0,0,SouthWest".Split(' '); var exception = Assert.Throws<ArgumentException>(delegate { paramParser.ParseParameters(rawInput); }); Assert.That(exception.Message, Is.EqualTo("Invalid direction. Please select from one of the following directions: NORTH|EAST|SOUTH|WEST")); }
public void TestParseParameters_IncompleteParameterFormat() { var paramParser = new PlaceCommandParameterParser(); string[] rawInput = "PLACE 0".Split(' '); var exception = Assert.Throws<ArgumentException>(delegate { paramParser.ParseParameters(rawInput); }); Assert.That(exception.Message, Is.EqualTo("Incomplete command. Please ensure that the PLACE command is using format: PLACE X,Y,F")); }
public void TestParseParameters_ValidPlaceParamFormat() { var paramParser = new PlaceCommandParameterParser(); string[] rawInput = "PLACE 1,2,EAST".Split(' '); var placeCommandParameter = (PlaceCommandParameter)paramParser.ParseParameters(rawInput); Assert.AreEqual(1,placeCommandParameter.Position.X); Assert.AreEqual(2, placeCommandParameter.Position.Y); Assert.AreEqual(Direction.East, placeCommandParameter.Direction); }