public async Task GetMovieTitleByIdShouldReturnCorrectTitle() { var options = new DbContextOptionsBuilder <NetPhlixDbContext>() .UseInMemoryDatabase("Test") .Options; var dbContext = new NetPhlixDbContext(options); await dbContext.Movies.AddAsync( new Movie() { Id = "first", Title = "title" } ); await dbContext.SaveChangesAsync(); var mappingConfig = new MapperConfiguration( mc => { mc.AddProfiles( typeof(MoviesProfile), typeof(UsersProfile), typeof(CompaniesProfile), typeof(ReviewsProfile), typeof(PeopleProfile), typeof(EventsProfile), typeof(AdminProfile) ); }); IMapper mapper = mappingConfig.CreateMapper(); var service = new MoviesService(mapper, dbContext); var title = await service.GetMovieTitleById("first"); Assert.Equal("title", title); }