Exemplo n.º 1
0
        public void ShouldThrowExceptionWhenYouMoveRoverOffEdge()
        {
            _marsRoverGrid = new MarsRoverGrid();
            _marsRoverGrid.SetMarsRoverGridBoundary(5, 5);
            var rover = new Rover.Core.Entities.Rover()
            {
                GridPosition = new YAndXCoordinate {
                    X = 2, Y = 2
                }
            };

            Assert.Throws <RoverWillDriveOffGridException>(() => _marsRoverGrid.MoveRoverTo(rover, 6, 5));
        }
Exemplo n.º 2
0
        public void ShouldThrowExceptionWhenYouMoveRoverToACellThatIsOccupied()
        {
            _marsRoverGrid = new MarsRoverGrid();
            _marsRoverGrid.SetMarsRoverGridBoundary(5, 5);
            _marsRoverGrid.SetRoverStartPosition(3, 3);
            var rover = new Rover.Core.Entities.Rover()
            {
                GridPosition = new YAndXCoordinate {
                    X = 2, Y = 2
                }
            };

            Assert.Throws <GridSpaceOccupiedException>(() => _marsRoverGrid.MoveRoverTo(rover, 3, 3));
        }