Esempio n. 1
0
        public void Check_SmallerThanZero_ReturnsZero()
        {
            var response = _plateauService.Init(-5, -5);

            Assert.AreEqual(0, response.Height);
            Assert.AreEqual(0, response.Width);
        }
        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);
            }
        }