Esempio n. 1
0
        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 Initialise()
 {
     _currentGame = new Game(null);
     _moveInstructionFactory = new MoveInstructionFactory(new LinearMoveFactory());
     _commandParser = new MoveRobotCommandParser(_currentGame, _moveInstructionFactory);
 }
Esempio n. 3
0
 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);
 }