public void AddNewNotificationTest() { // Arrange var helper = new TestHelper(); var mapper = new Mapper(); var options = new DbContextOptionsBuilder <AccountDbContext>() .UseInMemoryDatabase("AddNewNotificationTest") .Options; using var actContext = new AccountDbContext(options); using var arrangeContext = new AccountDbContext(options); var actRepo = new GenericRepository(actContext, new Mapper()); var newNotification = helper.Notifications[0]; // Act actRepo.AddNotification(newNotification); actContext.SaveChanges(); // Assert using var assertContext = new AccountDbContext(options); var assertNotification = assertContext.Notification.First(p => p.CoordinatorId == newNotification.CoordinatorId); Assert.NotNull(assertNotification); }