public void AddTVShows_Succesfully() { Task.Run(async() => { CastMemberDTO mockCasMember_1 = new CastMemberDTO(1, "mockMember_1", "12-07-1989"); TVShowDTO mockTvShow_1 = new TVShowDTO(1, "mockTvShow_1", new List <CastMemberDTO> { mockCasMember_1 }); await repo.AddTVShows(mockTvShow_1); var tvShows = await repo.GetTVShows(); Assert.IsTrue(tvShows.First().Id == mockTvShow_1.Id); }).GetAwaiter().GetResult(); }
public async Task AddTVShows(IEnumerable <TVShowDTO> tvShows) { foreach (var tvShow in tvShows) { await tvShowRepository.AddTVShows(tvShow); foreach (var item in tvShow.Cast) { await tvShowRepository.AddCasts(item); TVShowCastMemberDTO relation = new TVShowCastMemberDTO(tvShow.Id, item.Id); await tvShowRepository.AddRelation(relation); } } }