Esempio n. 1
0
        public void Rover_Should_GenerateOutput()
        {
            _location.Initialize(new Position(5, 5));
            IRover rover1 = new MarsRover(new Position(1, 2), CompassDirection.North, _location);

            rover1.Rotate(Rotation.Left);
            rover1.Move();
            rover1.Rotate(Rotation.Left);
            rover1.Move();
            rover1.Rotate(Rotation.Left);
            rover1.Move();
            rover1.Rotate(Rotation.Left);
            rover1.Move();
            rover1.Move();

            IRover rover2 = new MarsRover(new Position(3, 3), CompassDirection.East, _location);

            rover2.Move();
            rover2.Move();
            rover2.Rotate(Rotation.Right);
            rover2.Move();
            rover2.Move();
            rover2.Rotate(Rotation.Right);
            rover2.Move();
            rover2.Rotate(Rotation.Right);
            rover2.Rotate(Rotation.Right);
            rover2.Move();

            string output         = rover1.PrintPositionAndCompassDirection() + rover2.PrintPositionAndCompassDirection();
            string expectedString = "1 3 N\r\n5 1 E\r\n";

            Assert.Equal(expectedString, output);
        }