Ejemplo n.º 1
0
        public void RestAtExpectedCoordinates()
        {
            var initialVectorWithHeading  = new VectorWithHeading(1, 2, Heading.North);
            var expectedVectorWithHeading = new VectorWithHeading(1, 2, Heading.North);

            var rover = new MarsRover(initialVectorWithHeading, new Plateau(1, 2));

            var roverPosition = rover.GetVectorWithHeading();

            Assert.That(roverPosition, Is.EqualTo(expectedVectorWithHeading));
        }
Ejemplo n.º 2
0
        public void MovePositionByOneFromInitialPositionWhenMoveCommandCalled()
        {
            var initialPosition = new VectorWithHeading(2, 2, Heading.North);
            var plateau         = new Plateau(5, 5);

            var marsRover = new MarsRover(initialPosition, plateau);

            marsRover.Move();

            var result = marsRover.GetVectorWithHeading();

            Assert.That(result, Is.EqualTo(new VectorWithHeading(2, 3, Heading.North)));
        }
Ejemplo n.º 3
0
        public void BeOrientedToTheWestWhenAfterTurningOnceFromAStartingOrientationOfNorth()
        {
            var initialPosition = new VectorWithHeading(2, 2, Heading.North);
            var plateau         = new Plateau(5, 5);

            var marsRover = new MarsRover(initialPosition, plateau);

            marsRover.TurnLeft();

            var result = marsRover.GetVectorWithHeading();

            Assert.That(result, Is.EqualTo(new VectorWithHeading(2, 2, Heading.West)));
        }
Ejemplo n.º 4
0
        public void ReturnExpectedOutputOnSetSequenceofMovementCommands()
        {
            var initialPosition  = new VectorWithHeading(1, 2, Heading.North);
            var expectedPosition = new VectorWithHeading(1, 3, Heading.North);

            var plateau = new Plateau(5, 5);

            var marsRover = new MarsRover(initialPosition, plateau);

            marsRover.TurnLeft();
            marsRover.Move();
            marsRover.TurnLeft();
            marsRover.Move();
            marsRover.TurnLeft();
            marsRover.Move();
            marsRover.TurnLeft();
            marsRover.Move();
            marsRover.Move();

            var result = marsRover.GetVectorWithHeading();

            Assert.That(result, Is.EqualTo(expectedPosition));
        }