コード例 #1
0
 public void Initialise()
 {
     _battleArena = new BattleArenaFactory().Create(5, 5);
     _currentGame = new Game(null);
     _robotFactory = new RobotFactory();
     _commandParser = new DeployRobotCommandParser(_currentGame, _robotFactory);
 }
コード例 #2
0
ファイル: Steps.cs プロジェクト: jeanml/robot-wars
        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"]);
            }
        }
コード例 #3
0
ファイル: Steps.cs プロジェクト: jeanml/robot-wars
 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);
 }