public void Initialise() { _battleArena = new BattleArenaFactory().Create(5, 5); _currentGame = new Game(null); _robotFactory = new RobotFactory(); _commandParser = new DeployRobotCommandParser(_currentGame, _robotFactory); }
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 WhenITryToDeployARobotAtPosition(string consoleInput) { var commandParser = new DeployRobotCommandParser(_game, new RobotFactory()); Assert.IsTrue(commandParser.Validate(consoleInput)); var exception = Assert.Catch<Exception>(() => commandParser.ProcessInput(consoleInput)); ScenarioContext.Current.Add("Exception", exception); }