public void op_Verify_IRepository_whenRepositoryExceptionNotThrown() { var obj = new RepositoryUpdateRecordKeyNotFound <RandomObject>(); var repository = new Mock <IRepository <RandomObject> >(); repository .Setup(x => x.Insert(obj.Record1)) .Returns(obj.Record2) .Verifiable(); repository .Setup(x => x.Update(obj.Record2)) .Returns(new Mock <IRecord <RandomObject> >().Object) .Verifiable(); Assert.Throws <RepositoryTestException>(() => obj.Verify(repository.Object)); repository.VerifyAll(); }
public void op_Verify_IRepository() { var obj = new RepositoryUpdateRecordKeyNotFound <RandomObject>(); var repository = new Mock <IRepository <RandomObject> >(); repository .Setup(x => x.Insert(obj.Record1)) .Returns(obj.Record1) .Verifiable(); repository .Setup(x => x.Update(obj.Record2)) .Throws(new RepositoryException()) .Verifiable(); obj.Verify(repository.Object); repository.VerifyAll(); }