示例#1
0
        public void RequriesNewSVTest()
        {
            var result = TransInvoke.InvokTransFunction(() =>
            {
                var sv = new TransSVAgent();
                return sv.RequiresNew(true);
            }, true, true,
                trans =>
                    Assert.AreEqual(trans.TransactionInformation.Status,
                    TransactionStatus.Active,
                    "外部事务受到内部事务的影响,无法正确提交")
            );

            var entity = _repository.GetByID<Category>(result);
            Assert.IsNotNull(entity);

            result = TransInvoke.InvokTransFunction(() =>
            {
                var sv = new TransSVAgent();
                return sv.RequiresNew(true);
            }, false, true,
                 trans =>
                        Assert.AreEqual(trans.TransactionInformation.Status,
                        TransactionStatus.Active,
                        "外部事务受到内部事务的影响,无法正确提交"));
            entity = _repository.GetByID<Category>(result);
            Assert.IsNotNull(entity, "由于外部事务的回滚导致内部事务的回滚");
        }
示例#2
0
        public void RequriesNewWithOutOuterTransTest()
        {
            var sv = new TransSVAgent();
            var result = sv.RequiresNew(true);

            var entity = _repository.GetByID<Category>(result);
            Assert.IsNotNull(entity, "由于外部事务的回滚导致内部事务的回滚");
        }
示例#3
0
 public void RequriesNewSVFailedTest()
 {
     var result = TransInvoke.InvokTransFunction(() =>
     {
         var sv = new TransSVAgent();
         return sv.RequiresNew(false);
     }, true, false,
     trans =>
         Assert.AreEqual(trans.TransactionInformation.Status,
         TransactionStatus.Active,
         "外部事务受到内部事务的影响,无法正确提交")
     );
 }