Ejemplo n.º 1
0
        public List <StopCalculationResult> GetStopCalculationFromStarships(double distanceInMegaLights)
        {
            var result = new List <StopCalculationResult>();

            _logger.LogInformation("Loading starship information from external service...");
            var starships = _externalStarshipService.GetAll().Result;

            _logger.LogInformation("Calculating stops needed for each starship found...");
            starships.ForEach(delegate(StarshipResult starship){
                result.Add(StopCalculationResultBuilder.Build(starship, distanceInMegaLights));
            });

            return(result);
        }
        public void Builder_Should_Calculate_And_Create_Valid_Response()
        {
            // Arrange know result
            var megaLights = 1000000;
            var starship   = new StarshipResult()
            {
                Name        = "Millennium Falcon",
                MGLT        = "75",
                Consumables = "2 months"
            };
            var stopsExpected = 9;

            // Act
            var result = StopCalculationResultBuilder.Build(starship, megaLights);

            // Assert
            Assert.Equal(stopsExpected, result.TotalStops);
        }