private void MockGetCasOfShowAsync(bool changeId = false) { _mazeService.GetCastOfAShowAsync(changeId == false ? 1 : 2).Returns(new List <Infrastructure.MazeWebService.Cast>() { new Cast() { person = new Person() { id = 9, name = "Dean Norris", birthday = "1963-04-08" } }, new Cast() { person = new Person() { id = 7, name = "Mike Vogel", birthday = "1979-07-17" } } }); _mazeService.GetCastOfAShowAsync(4).Returns(new List <Infrastructure.MazeWebService.Cast>() { new Cast() { person = new Person() { id = 6, name = "Michael Emerson", birthday = "1950-01-01" } } }); }
public async Task <IList <Domain.ShowDomain.Show> > GetShowAsync(GetShowRequest getShowRequest) { var shows = await _mazeService.GetShowsAsync(); var domainShows = new List <Domain.ShowDomain.Show>(); foreach (var show in shows) { var casts = await _mazeService.GetCastOfAShowAsync(show.id); var domainCasts = casts.Select(x => { var birthday = x.person.birthday != null ? DateTime.Parse(x.person.birthday) : DateTime.MinValue; return(new MazeServiceScraper.Domain.ShowDomain.Cast(x.person.id, x.person.name, birthday)); }).ToList(); var domainShow = new Domain.ShowDomain.Show(show.id, show.name, domainCasts); domainShows.Add(domainShow); } return(domainShows); }