public void ShouldHaveDeepNestedTransactions()
        {
            using (var transaction1 = new TransactionRange(UnitOfWork))
            using (var transaction2 = new TransactionRange(UnitOfWork))
            {
                using (var transaction3 = new TransactionRange(UnitOfWork))
                using (var transaction4 = new TransactionRange(UnitOfWork))
                {
                    transaction4.Complete();
                    var entity1 = fixture.CreateAnonymous<Foo>();
                    fooRepository.Add(entity1);
                    UnitOfWork.SaveChanges();
                    transaction3.Complete();
                }
                transaction2.Complete();
                var entity = fixture.CreateAnonymous<Foo>();
                fooRepository.Add(entity);
                UnitOfWork.SaveChanges();
                transaction1.Complete();
            }

            using (var session = CreateSession())
            {
                var entities = session.QueryOver<Foo>().List();
                Assert.Equal(2, entities.Count);
            }
        }
        public void ShouldCommit()
        {
            using(var transaction = new TransactionRange(UnitOfWork))
            {
                var entity = fixture.CreateAnonymous<Foo>();
                fooRepository.Add(entity);
                UnitOfWork.SaveChanges();
                transaction.Complete();
            }

            using (var session = CreateSession())
            {
                var entities = session.QueryOver<Foo>().List();
                Assert.Equal(1, entities.Count);
            }
        }
        public void ShouldRollbackWhenNestedTransactionDoNotComplete()
        {
            using(var transaction1 = new TransactionRange(UnitOfWork))
            {
                using (new TransactionRange(UnitOfWork))
                {
                    var entity1 =
                        fixture.
                            CreateAnonymous
                            <Foo>();
                    fooRepository.Add(
                        entity1);
                    UnitOfWork.SaveChanges();
                }

                var entity = fixture.CreateAnonymous<Foo>();
                fooRepository.Add(entity);
                UnitOfWork.SaveChanges();
                transaction1.Complete();
            }

            using (var session = CreateSession())
            {
                var entities = session.QueryOver<Foo>().List();
                Assert.Equal(0, entities.Count);
            }
        }