public async Task Succeed_ReturnLogbookWhenManagerWasRemoved() { var options = TestUtils.GetOptions(nameof(Succeed_ReturnLogbookWhenManagerWasRemoved)); using (var arrangeContext = new ManagerLogbookContext(options)) { await arrangeContext.Users.AddAsync(TestHelpersLogbook.TestUser01()); await arrangeContext.Users.AddAsync(TestHelpersLogbook.TestUser02()); await arrangeContext.Logbooks.AddAsync(TestHelpersLogbook.TestLogbook04()); await arrangeContext.UsersLogbooks.AddAsync(TestHelpersLogbook.TestUsersLogbooks04()); await arrangeContext.SaveChangesAsync(); } using (var assertContext = new ManagerLogbookContext(options)) { var mockedBusinessValidator = new Mock <IBusinessValidator>(); var sut = new LogbookService(assertContext, mockedBusinessValidator.Object); await sut.RemoveManagerFromLogbookAsync(TestHelpersLogbook.TestUser01().Id, TestHelpersLogbook.TestLogbook04().Id); Assert.AreEqual(assertContext.UsersLogbooks.Select(x => x.LogbookId).Count(), 0); } }