Exemple #1
0
        public void WhenCreated_ThenNewTransactionIsStarted()
        {
            using (var tx = new DTCTransactionScope(null, new TransactionOptions(), sessionFactoryMock.Object))
            {
                Transaction.Current.Should().NotBeNull();

                tx.Complete();
            }
        }
        public void WhenCreated_ThenNewTransactionIsStarted()
        {
            using (var tx = new DTCTransactionScope(null, new TransactionOptions(), sessionFactoryMock.Object))
            {
                Transaction.Current.Should().NotBeNull();

                tx.Complete();
            }
        }
Exemple #3
0
        public void WhenCompleted_ThenTransactionShouldBeCommitted()
        {
            var transactionStatus = TransactionStatus.InDoubt;

            using (var tx = new DTCTransactionScope(null, new TransactionOptions(), sessionFactoryMock.Object))
            {
                Transaction.Current.TransactionCompleted +=
                    (s, e) => transactionStatus           = e.Transaction.TransactionInformation.Status;

                tx.Complete();
            }

            transactionStatus.Should().Be(TransactionStatus.Committed);
        }
        public void WhenCompleted_ThenTransactionShouldBeCommitted()
        {
            var transactionStatus = TransactionStatus.InDoubt;

            using (var tx = new DTCTransactionScope(null, new TransactionOptions(), sessionFactoryMock.Object))
            {
                Transaction.Current.TransactionCompleted +=
                    (s, e) => transactionStatus = e.Transaction.TransactionInformation.Status;

                tx.Complete();
            }

            transactionStatus.Should().Be(TransactionStatus.Committed);
        }