Ejemplo n.º 1
0
        public void CannotSetCommandListUntilRobotHasStartingLocation()
        {
            var commandList = new List <RobotCommand>();
            var robot       = new WarriorRobot();

            Assert.Throws <WarriorRobot.StartLocationNotSetException>(() => robot.ExecuteCommandList(commandList));
        }
Ejemplo n.º 2
0
        public void CanProvideCommandsToRobot()
        {
            var commandList = new List <RobotCommand>();
            var robot       = new WarriorRobot();

            robot.UploadArena(new Arena(1, 1));
            robot.StartAt(SimpleVector());
            robot.ExecuteCommandList(commandList);
        }
Ejemplo n.º 3
0
        public void ExecutingASingleCommandUpdatesThePositionAsExpected()
        {
            var startPosition = new RobotVector(new Position(0, 0), Heading.North);

            var robot = new WarriorRobot();

            robot.UploadArena(new Arena(1, 1));
            robot.StartAt(startPosition);

            var commandList = new List <RobotCommand>();

            commandList.Add(new MoveForwards());
            robot.ExecuteCommandList(commandList);

            RobotVector reportedPosition = robot.ReportPosition();

            Assert.That(startPosition, Is.Not.EqualTo(reportedPosition));
        }