public async Task <IActionResult> Index() { var planets = await _service.GetAllPlanets(); return(View(new PlanetIndexViewModel { Planets = planets })); }
public async Task <IEnumerable <PlanetViewModel> > GetAllPlanets() { var planetsWithAppearance = new List <PlanetViewModel>(); var result = await _service.GetAllPlanets(); var resultMapped = _mapper.Map <List <PlanetViewModel> >(result); foreach (var item in resultMapped) { var newPlanetWithAppearance = await GetAppearanceInMovies(item); planetsWithAppearance.Add(newPlanetWithAppearance); } return(planetsWithAppearance); }
public void Get_GetAll_SetupedResult() { var result = _planetService.GetAllPlanets(); result.Should().BeEquivalentTo(_planets); }