public async Task DeleteNotificationTestAsync() { //Assemble var helper = new TestHelper(); var mapper = new Mapper(); var options = new DbContextOptionsBuilder <AccountDbContext>() .UseInMemoryDatabase("DeleteNotificationTestAsync") .Options; using var assembleContext = new AccountDbContext(options); var deleteNotification = mapper.MapNotification(helper.Notifications[0]); assembleContext.Add(deleteNotification); assembleContext.SaveChanges(); using var actContext = new AccountDbContext(options); var repo = new GenericRepository(actContext, new Mapper()); // Act await repo.DeleteNotificationByIdAsync(deleteNotification.NotificationId); // Assert var notification = actContext.Notification.ToList(); Assert.DoesNotContain(deleteNotification, notification); }