public void DeleteAllPages_returns_succeeded_if_deleted_all_pages() { //arrange var pages = new List <Page> { new Page(), new Page(), new Page { } }; Mock <IUnitOfWork> uow = new Mock <IUnitOfWork>(); Mock <IPageRepository> repo = new Mock <IPageRepository>(); repo.Setup(r => r.GetAll()) .ReturnsAsync(pages) .Verifiable(); repo.Setup(r => r.Remove(It.IsAny <Page>())) .Callback <Page>(p => pages.Remove(p)) .Verifiable(); uow.Setup(u => u.PageRepository) .Returns(repo.Object); uow.Setup(u => u.SaveChanges()) .ReturnsAsync(1) //doesn't matter => must be greater than 0 .Verifiable(); TestManager manager = new TestManager(uow.Object); //act var result = manager.DeleteAllPages().Result; //assert repo.Verify(); uow.Verify(); Assert.True(result.Succeeded); Assert.Equal(0, pages.Count); }