public void op_Verify_IRepository_whenKeyIsNotSet() { var obj = new RepositoryUpsertInsertRecord <RandomObject> { Record1 = { Created = DateTime.UtcNow, Key = null, Modified = DateTime.UtcNow } }; var repository = new Mock <IRepository <RandomObject> >(); repository .Setup(x => x.Upsert(obj.Record1)) .Returns(obj.Record1) .Verifiable(); Assert.Throws <RepositoryTestException>(() => obj.Verify(repository.Object)); repository.VerifyAll(); }
public void op_Verify_IRepository() { var obj = new RepositoryUpsertInsertRecord <RandomObject> { Record1 = { Created = DateTime.UtcNow, Key = AlphaDecimal.Random(), Modified = DateTime.UtcNow } }; var repository = new Mock <IRepository <RandomObject> >(); repository .Setup(x => x.Upsert(obj.Record1)) .Returns(obj.Record1) .Verifiable(); obj.Verify(repository.Object); repository.VerifyAll(); }