public void GetFilmByFilmTitleTest() { using (var transaction = Fixture.Connection.BeginTransaction()) { using (var context = Fixture.CreateContext(transaction)) { foreach (var query in FilmFixture.QueriesForFilmTitle) { var filmListTask = context .Set <Film>() .Where(film => film.Title.Contains(query)) .Include(film => film.Genere) .Include(film => film.FilmActors) .ThenInclude(filmActor => filmActor.Actor) .ToListAsync(); var filmListResult = filmListTask.Result; var expectedFilmList = FilmFixture.GetFilmsByQueriesForFilmTitle(query); AssertData(expectedFilmList, filmListResult); } } } }
public void GetFilmByActorNameTest() { using (var transaction = Fixture.Connection.BeginTransaction()) { using (var context = Fixture.CreateContext(transaction)) { foreach (var query in FilmFixture.QueriesForActorName) { var actorId = context .Set <Actor>() .Where(actor => actor.Name.Contains(query)) .Select(actor => actor.Id) .FirstOrDefault(); var filmListTask = context .Set <FilmActor>() .Include(filmActor => filmActor.Film) .ThenInclude(film => film.Genere) .Include(filmActor => filmActor.Film) .ThenInclude(film => film.FilmActors) .ThenInclude(filmActors => filmActors.Actor) .Where(filmActor => filmActor.Actor.Id == actorId) .Select(filmActor => filmActor.Film) .ToListAsync(); var filmListResult = filmListTask.Result; var expectedFilmList = FilmFixture.GetFilmsByQueriesForActorName(query); AssertData(expectedFilmList, filmListResult); } } } }
public void GetListAsyncTest() { using (var transaction = Fixture.Connection.BeginTransaction()) { using (var context = Fixture.CreateContext(transaction)) { var filmListTask = context .Set <Film>() .Include(film => film.Genere) .Include(film => film.FilmActors) .ThenInclude(filmActor => filmActor.Actor) .ToListAsync(); var filmListResult = filmListTask.Result; var expectedFilmList = FilmFixture.GetAllFilms(); AssertData(expectedFilmList, filmListResult); } } }