public void Check_NavigationOutOfPlateau_ThrowsException() { Plateau plateau = new Plateau(5, 5); Navigation navigation = new Navigation(6, 6, "N"); Assert.Throws <System.Exception>(() => _roverService.Init(plateau, navigation)); }
public void Run() { try { _logger.LogInformation("Mars Rover Application Started..."); Plateau plateau = _plateauService.Init(5, 5); List <Rover> rovers = new List <Rover>(); // First Rover Navigation navigation = _navigationService.Init(1, 2, "N"); Rover rover1 = _roverService.Init(plateau, navigation); rovers.Add(rover1); List <Navigate> navigates = _navigationService.Movements("LMLMLMLMM"); _roverService.SurroundTerrain(navigates); // Second Rover navigation = _navigationService.Init(3, 3, "E"); Rover rover2 = _roverService.Init(plateau, navigation); rovers.Add(rover2); navigates = _navigationService.Movements("MMRMMRMRRM"); _roverService.SurroundTerrain(navigates); // Third Rover - with errors navigation = _navigationService.Init(5, 5, "N"); Rover rover3 = _roverService.Init(plateau, navigation); rovers.Add(rover3); navigates = _navigationService.Movements("MMRMMRMRRM"); _roverService.SurroundTerrain(navigates); } catch (System.Exception ex) { // Global Exception Handling _logger.LogError(ex, ex.Message); } }