public void TestMultiTransactions()
        {
            this.UnBindSession();

            using (ISessionBinderProvider provider = new SessionBinderProvider(this.SessionFactory.GetCurrentSession,
                                                                        this.LocalBindSession, this.LocalUnBindSession,
                                                                        () =>
                                                                        CurrentSessionContext.HasBind(
                                                                            this.SessionFactory)))
            {
                provider.BindSession();

                provider.BeginTransaction("first");
                Assert.IsTrue(provider.InProgress);

                provider.BeginTransaction("second");
                Assert.IsTrue(provider.InProgress);

                provider.BeginTransaction("third");
                Assert.IsTrue(provider.InProgress);

                provider.CommitTransaction();
                Assert.IsTrue(provider.InProgress);

                provider.CommitTransaction();
                Assert.IsTrue(provider.InProgress);

                provider.CommitTransaction();
                Assert.IsFalse(provider.InProgress);

                provider.UnBindSession();
            }
        }
        public void TestMultiTransactionsWithRollback()
        {
            this.UnBindSession();

            using (ISessionBinderProvider provider = new SessionBinderProvider(this.SessionFactory.GetCurrentSession,
                                                                        this.LocalBindSession, this.LocalUnBindSession,
                                                                        () =>
                                                                        CurrentSessionContext.HasBind(
                                                                            this.SessionFactory)))
            {
                try
                {
                    provider.BindSession();

                    provider.BeginTransaction("first");
                    Assert.IsTrue(provider.InProgress);

                    provider.BeginTransaction("second");
                    Assert.IsTrue(provider.InProgress);

                    provider.BeginTransaction("third");
                    Assert.IsTrue(provider.InProgress);

                    provider.CommitTransaction(); /* commit the third transaction. */
                    Assert.IsTrue(provider.InProgress);

                    provider.RollbackTransaction();
                        /* this throws an exception because there are another inner transaction in progress. */
                }
                finally
                {
                    provider.UnBindSession();
                }
            }
        }