Ejemplo n.º 1
0
        public void op_Verify_IRepository_whenFalse()
        {
            var obj = new RepositoryUpsertUpdateRecord <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.Upsert(obj.Record1))
            .Returns(new Mock <IRecord <RandomObject> >().Object)
            .Verifiable();

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

            repository.VerifyAll();
        }
Ejemplo n.º 2
0
        public void op_Verify_IRepository()
        {
            var obj = new RepositoryUpsertUpdateRecord <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.Upsert(obj.Record1))
            .Returns(obj.Record1)
            .Verifiable();

            obj.Verify(repository.Object);

            repository.VerifyAll();
        }