Beispiel #1
0
        public void GivenGetNextPosition_WhenNoDirection_ThenNoPosition()
        {
            var robot = new State.ToyRobot();

            robot.Place(1, 1, RobotDirection.East);
            robot.Direction = null;

            robot.GetNextPosition().Should().BeNull();
        }
Beispiel #2
0
        public void GivenPlace_WhenPlacing_ThenPositionAndDirectionSet(int positionX, int positionY, RobotDirection direction)
        {
            var robot = new State.ToyRobot();

            robot.Place(positionX, positionY, direction);

            robot.IsPlaced.Should().BeTrue();
            robot.PositionX.Should().Be(positionX);
            robot.PositionY.Should().Be(positionY);
            robot.Direction.Should().Be(direction);
        }
Beispiel #3
0
        public void GivenMove_WhenNextPosition_ThenMovement()
        {
            var robot = new State.ToyRobot();

            robot.Place(1, 1, RobotDirection.South);


            robot.Move();

            robot.PositionX.Should().Be(1);
            robot.PositionY.Should().Be(0);
        }
Beispiel #4
0
        public void GivenMove_WhenNoNextPosition_ThenNoMovement()
        {
            var robot = new State.ToyRobot();

            robot.Place(1, 1, RobotDirection.East);
            robot.Direction = null;

            robot.Move();

            robot.PositionX.Should().Be(1);
            robot.PositionY.Should().Be(1);
        }
Beispiel #5
0
        public void GivenGetNextPosition_WhenPlaced_ThenNewPositionIsApplicationOfDirectionAndSpeed(int speed, int x, int y, RobotDirection direction, int expectedX, int expectedY)
        {
            var robot = new State.ToyRobot(speed);

            robot.Place(x, y, direction);

            var position = robot.GetNextPosition();

            position.Should().NotBeNull();
            position.X.Should().Be(expectedX);
            position.Y.Should().Be(expectedY);
        }
Beispiel #6
0
        public void GivenGetNextPosition_WhenNotPlaced_ThenNoPosition()
        {
            var robot = new State.ToyRobot();

            robot.GetNextPosition().Should().BeNull();
        }