예제 #1
0
        public async Task <List <Starships> > GetAllStarShipsAndAddStop(double distance)
        {
            int pagination = 0;
            var starships  = new List <Starships>();

            var response = new StarshipResponse()
            {
                Next = ""
            };

            while (response.Next != null)
            {
                response = await _repository.GetAllStarshipsAsync(++pagination);

                starships.AddRange(response.Results);
            }

            ApplyStopsToStartship(starships, distance);

            return(starships);
        }
예제 #2
0
        public void StarshipMapping_IsValid(string actualName, string actualConsumables,
                                            string actualMglt, string expectedName, TimeSpan?expectedConsumables, long?expectedMglt)
        {
            var integrationStarship = new StarshipResponse
            {
                Name        = actualName,
                Consumables = actualConsumables,
                Mglt        = actualMglt
            };

            var mapper = AutoMapperConfig.Config();
            var actual = mapper.Map <Starship>(integrationStarship);

            var expected = new Starship
            {
                Name        = expectedName,
                Consumables = expectedConsumables,
                Mglt        = expectedMglt
            };

            Assert.Equal(expected.Name, actual.Name);
            Assert.Equal(expected.Mglt, actual.Mglt);
            Assert.Equal(expected.Consumables, actual.Consumables);
        }