public void ChildTransactionShouldBeCreated()
        {
            //arrange
            _txn = _env.BeginTransaction();

            //act
            var subTxn = _txn.BeginTransaction();

            //assert
            Assert.AreEqual(LightningTransactionState.Active, subTxn.State);
        }
Esempio n. 2
0
        public void ChildTransactionShouldBeCreated()
        {
            //arrange
            _txn = _env.BeginTransaction();

            //act
            var subTxn = _txn.BeginTransaction();

            //assert
            Assert.AreEqual(LightningTransactionState.Active, subTxn.State);
        }
Esempio n. 3
0
        public void ChildTransactionShouldBeAbortedIfParentIsAborted()
        {
            //arrange
            _txn = _env.BeginTransaction();
            var child = _txn.BeginTransaction();

            //act
            _txn.Abort();

            //assert
            Assert.AreEqual(LightningTransactionState.Aborted, child.State);
        }
Esempio n. 4
0
        public void ChildTransactionShouldBeAbortedIfEnvironmentIsClosed()
        {
            //arrange
            _txn = _env.BeginTransaction();
            var child = _txn.BeginTransaction();

            //act
            _env.Close();

            //assert
            Assert.AreEqual(LightningTransacrionState.Aborted, child.State);
        }
 private ITransaction BeginTransactionInternal(ITransaction parentTransaction, TransactionBeginFlags flags)
 {
     if (parentTransaction == null || parentTransaction.InnerObject == null)
     {
         return(new LMDBTransaction(_environment.BeginTransaction(flags), flags == TransactionBeginFlags.ReadOnly ? true : false));
     }
     else
     {
         ValidateTransaction(parentTransaction);
         LightningTransaction lmdbTransaction = (LightningTransaction)parentTransaction.InnerObject;
         return(new LMDBTransaction(lmdbTransaction.BeginTransaction(flags), flags == TransactionBeginFlags.ReadOnly ? true : false));
     }
 }
        public void ChildTransactionShouldBeAbortedIfParentIsAborted()
        {
            //arrange
            _txn = _env.BeginTransaction();
            var child = _txn.BeginTransaction();

            //act
            _txn.Abort();

            //assert
            Assert.AreEqual(LightningTransactionState.Aborted, child.State);
        }
        public void ChildTransactionShouldBeAbortedIfEnvironmentIsClosed()
        {
            //arrange
            _txn = _env.BeginTransaction();
            var child = _txn.BeginTransaction();

            //act
            _env.Close();

            //assert
            Assert.AreEqual(LightningTransacrionState.Aborted, child.State);
        }