Esempio n. 1
0
        public void TestSaveNull()
        {
            StandardBroker <Bean> broker = new StandardBroker <Bean>("name");

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

            TestStore <Bean> .ExceptionOnCall = false;
            Assert.IsNotNull(broker.Save(new Bean(), null));
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }