예제 #1
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"]);
            }
        }
예제 #2
0
파일: Steps.cs 프로젝트: jeanml/robot-wars
 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);
 }