Пример #1
0
        public void Move(Orientation testOrientation, int expectedXPosition, int expectedYPosition)
        {
            const int testX        = 2;
            const int testY        = 2;
            var       testPosition = new Position(testX, testY, testOrientation);

            const int testGridSizeX      = 3;
            const int testGridSizeY      = 3;
            var       testTrackingModule = new TrackingModule
            {
                GridMaximumX = testGridSizeX,
                GridMaximumY = testGridSizeY,
                Position     = testPosition
            };

            var spyCommand  = new SpyCommand();
            var moveCommand = new MoveForwardCommand(spyCommand);

            moveCommand.Execute(testTrackingModule);

            var actualTrackingModule = spyCommand.TrackingModule;

            actualTrackingModule.Position.Y.Should().Be(expectedYPosition);
            actualTrackingModule.Position.X.Should().Be(expectedXPosition);
        }
Пример #2
0
        public void RotateToNextOrientationOnLCommand(Orientation testOrientation, Orientation expectedOrientation)
        {
            const int dummyX             = 1;
            const int dummyY             = 1;
            var       testPosition       = new Position(dummyX, dummyY, testOrientation);
            const int testGridSizeX      = 3;
            const int testGridSizeY      = 3;
            var       testTrackingModule = new TrackingModule
            {
                GridMaximumX = testGridSizeX,
                GridMaximumY = testGridSizeY,
                Position     = testPosition
            };

            var spyCommand    = new SpyCommand();
            var rotateCommand = new RotateRightCommand(spyCommand);

            rotateCommand.Execute(testTrackingModule);

            var actualTrackingModule = spyCommand.TrackingModule;

            actualTrackingModule.Position.Orientation.Should().Be(expectedOrientation);
        }