Beispiel #1
0
        public void WhenRotateRight_ThenBotRotates90DegreesRight(string originalDirection, string expectedDirection)
        {
            var rotationHandler = new RotateMovementHandler();
            var currenPosition  = new Position(new Coordinates(), (CardinalPoint)Enum.Parse(typeof(CardinalPoint), originalDirection));

            var newPosition = rotationHandler.HandleMovement(currenPosition, Movement.R);

            newPosition.Direction.Should().Be((CardinalPoint)Enum.Parse(typeof(CardinalPoint), expectedDirection));
        }
Beispiel #2
0
        public void WhenRotateIsCalled_ThenOriginalCoordinatesAreReturned()
        {
            var originalCoordinates = new Coordinates {
                X = 10, Y = 20
            };
            var rotationHandler = new RotateMovementHandler();
            var currenPosition  = new Position(originalCoordinates, CardinalPoint.N);

            var newPosition = rotationHandler.HandleMovement(currenPosition, Movement.L);

            newPosition.Coordinates.ShouldBeEquivalentTo(originalCoordinates);
        }