コード例 #1
0
        public void AttributeShouldUseConfigurationTransactionMode()
        {
            Nails.Configure().UnitOfWork.DefaultTransactionMode(TransactionMode.NoTransaction);
            var info = UnitOfWorkInfo.From(GetType().GetMethod("MethodWithDefaultUnitOfWorkAttribute"));

            Assert.IsFalse(info.IsTransactional);
        }
コード例 #2
0
        public void FromMethodWithAllowAsyncAttribute()
        {
            Nails.Configure().UnitOfWork.DefaultAsyncMode(false)
            .AllowAsyncExecution(true);

            var info = UnitOfWorkInfo.From(GetType().GetMethod("AsyncMethod"));

            Assert.IsTrue(info.IsAsync);
        }
コード例 #3
0
        public void FromMethodShouldNotBeAsyncByDefaultIfDefaultIsNotAsync()
        {
            Nails.Configure().UnitOfWork.DefaultAsyncMode(false)
            .AllowAsyncExecution(true);

            var info = UnitOfWorkInfo.From(GetType().GetMethod("MethodWithoutAttributes"));

            Assert.IsFalse(info.IsAsync);
        }
コード例 #4
0
        public void ShouldNotBeAsyncByDefaultIfDefaultIsNotAsync()
        {
            Nails.Configure().UnitOfWork.DefaultAsyncMode(true)
            .AllowAsyncExecution(true);

            var info = new UnitOfWorkInfo();

            Assert.IsFalse(info.IsAsync);
        }
コード例 #5
0
        public void ShouldIgnoreWithAllowAsyncAttributeIfAsyncExecutionIsNotAllowed()
        {
            Nails.Configure().UnitOfWork.DefaultAsyncMode(false)
            .AllowAsyncExecution(false);

            var info = UnitOfWorkInfo.From(GetType().GetMethod("AsyncMethod"));

            Assert.IsFalse(info.IsAsync);
        }
コード例 #6
0
        public void ShouldIgnoreDefaultIfNotFromMethod()
        {
            Nails.Configure().UnitOfWork.DefaultAsyncMode(true)
            .AllowAsyncExecution(true);

            var info = new UnitOfWorkInfo();

            Assert.IsFalse(info.IsAsync);
        }
コード例 #7
0
        public void FromMethodShouldBeTransactionalByDefault()
        {
            var info = UnitOfWorkInfo.From(GetType().GetMethod("MethodWithDefaultUnitOfWorkAttribute"));

            Assert.IsTrue(info.IsTransactional);
        }
コード例 #8
0
        public void ShouldBeTransactionalByDefault()
        {
            var info = new UnitOfWorkInfo();

            Assert.IsTrue(info.IsTransactional);
        }
コード例 #9
0
        public void MethodWithoutUnitOfWorkAttributeShouldHaveDeafaultValues()
        {
            var info = UnitOfWorkInfo.From(GetType().GetMethod("MethodWithoutAttributes"));

            Assert.IsTrue(info.IsTransactional);
        }