예제 #1
0
        public void ThenTheRoverShouldWrapAroundTheGrid(Heading startingHeading, int x, int y, string expectedValue)
        {
            var subject = new RoverApi(new Rover(new Position(x, y), startingHeading, Grid.InitialiseFrom(100, 100)));
            var result  = subject.Process("B");

            result.Should().Be(expectedValue);
        }
예제 #2
0
        public void ThenTheRoverShouldMoveBackwardsInTheDirectionItIsFacing(Heading startingHeading, string expectedValue)
        {
            var subject = new RoverApi(new Rover(new Position(1, 1), startingHeading, Grid.InitialiseFrom(100, 100)));
            var result  = subject.Process("B");

            result.Should().Be(expectedValue);
        }
        public void ThenTheRoverShouldMoveForwardsInTheDirectionItIsFacing(string input, string expectedValue)
        {
            var subject = new RoverApi(new Rover(Position.Zero, Heading.N, Grid.InitialiseFrom(100, 100)));
            var result  = subject.Process(input);

            result.Should().Be(expectedValue);
        }
        public void ThenTheStartingLocationIsReturned()
        {
            var subject = new RoverApi(new Rover(Position.Zero, Heading.N, Grid.InitialiseFrom(100, 100)));
            var result  = subject.Process(string.Empty);

            result.Should().Be("0,0,N");
        }
예제 #5
0
        public void ThenTheStartingLocationIsReturned(int x, int y, Heading heading, string expectedValue)
        {
            var subject = new RoverApi(new Rover(new Position(x, y), heading, Grid.InitialiseFrom(100, 100)));
            var result  = subject.Process(null);

            result.Should().Be(expectedValue);
        }
예제 #6
0
        public void ThenTheOtherCommandsAreNotExecuted(string input, string expectedValue)
        {
            var grid = Grid.InitialiseFrom(100, 100)
                       .AddObstacle(new Position(1, 2));

            var subject = new RoverApi(new Rover(Position.Zero, Heading.N, grid));
            var result  = subject.Process(input);

            result.Should().Be(expectedValue);
        }