public async Task DeleteAll() { // Arrange var options = new DbContextOptionsBuilder <MyAlbumDbContext>() .UseInMemoryDatabase(databaseName: "CommentRepository_DeleteAll_MyAlbumDatabase") .Options; using (var context = new MyAlbumDbContext(options)) { UnitOfWork unitOfWork = new UnitOfWork(context); int seedCommentId = new Random().Next(1, 100); IEnumerable <Comment> seedReplies = SeedReplies(seedCommentId, context); CommentRepository commentRepository = new CommentRepository(context); // Assert #1 Assert.Equal(seedReplies.Count(), context.Comments.Count()); // Act commentRepository.DeleteAll(seedReplies.ToList()); await unitOfWork.CompleteAsync(); // Assert #2 Assert.Equal(0, context.Comments.Count()); } }