public void op_Verify_IRepository_whenExists() { var obj = new RepositoryDeleteUrn<RandomObject> { Record1 = { Key = AlphaDecimal.Random() } }; var repository = new Mock<IRepository<RandomObject>>(); repository .Setup(x => x.Insert(obj.Record1)) .Returns(obj.Record1) .Verifiable(); repository .Setup(x => x.Delete(obj.Record1.Urn)) .Returns(true) .Verifiable(); repository .Setup(x => x.Exists(obj.Record1.Urn)) .Returns(true) .Verifiable(); Assert.Throws<RepositoryTestException>(() => obj.Verify(repository.Object)); repository.VerifyAll(); }
public void op_Verify_IRepository() { var obj = new RepositoryDeleteUrn<RandomObject> { Record1 = { Key = AlphaDecimal.Random() } }; var repository = new Mock<IRepository<RandomObject>>(); repository .Setup(x => x.Insert(obj.Record1)) .Returns(obj.Record1) .Verifiable(); repository .Setup(x => x.Delete(obj.Record1.Urn)) .Returns(true) .Verifiable(); repository .Setup(x => x.Exists(obj.Record1.Urn)) .Returns(false) .Verifiable(); obj.Verify(repository.Object); repository.VerifyAll(); }