public async Task GetReviewsWithLowerRatingReturnsReviews() { var options = new DbContextOptionsBuilder <ReviewsContext>() .UseInMemoryDatabase(databaseName: $"ItemsDatabase{Guid.NewGuid()}") .Options; using (var context = new ReviewsContext(options)) { context.Items.Add(new Item { Name = "item", Reviews = new List <Review>() { new Review { Feedback = "smth", Rating = 3 } } }); context.SaveChanges(); } using (var context = new ReviewsContext(options)) { ItemRepository repo = new ItemRepository(context); var _controller = new ReviewsController(repo, _mockLogger.Object, _mapper.Object); var okResult = await _controller.GetReviewByAverageRatingLowerThan(2) as OkObjectResult; Assert.Equal(200, okResult.StatusCode); } }