示例#1
0
        public void TestSaveNull()
        {
            StandardBroker <Bean> broker = new StandardBroker <Bean>("name");

            TestStore <Bean> .ExceptionOnCall = false;
            broker.Save(null, null);
        }
示例#2
0
        public void TestSave()
        {
            StandardBroker <Bean> broker = new StandardBroker <Bean>("name");

            TestStore <Bean> .ExceptionOnCall = false;
            Assert.IsNotNull(broker.Save(new Bean(), null));
        }
示例#3
0
        public void TestSaveTransactionScope()
        {
            StandardBroker <Bean> broker = new StandardBroker <Bean>("name");

            TestStore <Bean> .ExceptionOnCall = false;
            Assert.IsNotNull(broker.Save(new Bean(), null));
            Assert.IsTrue(TestStore <Bean> .IsCallWithTransactionScope);
        }
示例#4
0
        public void TestSaveTransactionComplete()
        {
            StandardBroker <Bean> broker = new StandardBroker <Bean>("name");

            TestStore <Bean> .ExceptionOnCall = false;
            using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) {
                Assert.IsNotNull(broker.Save(new Bean(), null));
                tx.Complete();
            }
            Assert.IsTrue(TestStore <Bean> .IsCallWithTransactionScope);
        }
示例#5
0
        public void TestSaveTransactionRollback()
        {
            StandardBroker <Bean> broker = new StandardBroker <Bean>("name");

            TestStore <Bean> .ExceptionOnCall = true;
            using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required)) {
                try {
                    broker.Save(new Bean(), null);
                } catch {
                    // On intercepte l'exception.
                }
                tx.Complete();
            }
            Assert.IsTrue(TestStore <Bean> .IsCallWithTransactionScope);
        }