public void GivenThatIHaveDeployedRobots(Table table) { var deployRobotCommandParser = new DeployRobotCommandParser(_game, new RobotFactory()); var moveRobotCommandParser = new MoveRobotCommandParser(_game, new MoveInstructionFactory(new LinearMoveFactory())); foreach(var row in table.Rows) { Assert.IsTrue(deployRobotCommandParser.Validate(row["InitialPosition"])); deployRobotCommandParser.ProcessInput(row["InitialPosition"]); Assert.IsTrue(moveRobotCommandParser.Validate(row["MoveInstructions"])); moveRobotCommandParser.ProcessInput(row["MoveInstructions"]); } }
public void WhenITryToSpecifyRobotMoveInstructions(string moveInstructions) { var commandParser = new MoveRobotCommandParser(_game, new MoveInstructionFactory(new LinearMoveFactory())); Assert.IsTrue(commandParser.Validate(moveInstructions)); var exception = Assert.Catch<Exception>(() => commandParser.ProcessInput(moveInstructions)); ScenarioContext.Current.Add("Exception", exception); }