public void UpdateEmployer_succeeded_if_Employer_is_valid() { //arrange var uow = new Mock <IUnitOfWork>(); var repo = new Mock <IEmployerRepository>(); repo.Setup(r => r.Update(It.IsNotNull <Employer>())) .Verifiable(); uow.Setup(u => u.SaveChanges()) .ReturnsAsync(1) .Verifiable(); uow.Setup(u => u.EmployerRepository) .Returns(repo.Object) .Verifiable(); var manager = new EmployerManager(uow.Object); //act var result = manager.Update(new Employer()).Result; //assert repo.Verify(); uow.Verify(); Assert.True(result.Succeeded); }
public void UpdateEmployer_failed_if_Employer_is_not_valid() { //arrange var uow = Mock.Of <IUnitOfWork>(); var manager = new EmployerManager(uow); //act var result = manager.Update(null).Result; //assert Assert.False(result.Succeeded); }