Beispiel #1
0
        public void op_Verify_IRepository_whenRepositoryExceptionIsNotThrown()
        {
            var obj = new RepositoryInsertRecordCacheabilityNull <RandomObject>();

            var repository = new Mock <IRepository <RandomObject> >();

            repository
            .Setup(x => x.Insert(obj.Record1))
            .Returns(obj.Record1)
            .Verifiable();

            Assert.Throws <RepositoryTestException>(() => obj.Verify(repository.Object));

            repository.VerifyAll();
        }
Beispiel #2
0
        public void op_Verify_IRepository_whenUnexpectedExceptionIsThrown()
        {
            var obj = new RepositoryInsertRecordCacheabilityNull <RandomObject>();

            var repository = new Mock <IRepository <RandomObject> >();

            repository
            .Setup(x => x.Insert(obj.Record1))
            .Throws(new InvalidOperationException())
            .Verifiable();

            Assert.Throws <RepositoryTestException>(() => obj.Verify(repository.Object));

            repository.VerifyAll();
        }
Beispiel #3
0
        public void op_Verify_IRepository()
        {
            var obj = new RepositoryInsertRecordCacheabilityNull <RandomObject>();

            var repository = new Mock <IRepository <RandomObject> >();

            repository
            .Setup(x => x.Insert(obj.Record1))
            .Throws(new RepositoryException())
            .Verifiable();

            obj.Verify(repository.Object);

            repository.VerifyAll();
        }