public void ShouldNotBeAbleToCommitTwice()
        {
            var transaction = new Neo4jTransaction(new GraphClient(new Uri("http://foo/db/data")));

            transaction.Commit();
            transaction.Commit();
        }
        public void ShouldNotBeAbleToRollbackAfterCommit()
        {
            var transaction = new Neo4jTransaction(new GraphClient(new Uri("http://foo/db/data")));

            transaction.Commit();
            transaction.Rollback();
        }
Ejemplo n.º 3
0
        public void ShouldNotBeAbleToRollbackAfterCommit()
        {
            var transaction = new Neo4jTransaction(new GraphClient(new Uri("http://foo/db/data")));

            transaction.Commit();
            Assert.That(() => transaction.Rollback(), Throws.TypeOf <ClosedTransactionException>());
        }
Ejemplo n.º 4
0
        public override Transaction NewTransaction(bool withTransaction)
        {
            if (NotNeo4jTransaction)
            {
                return(new NotNeo4jTransaction());
            }

            Neo4jTransaction transaction = base.NewTransaction(withTransaction) as Neo4jTransaction;
            ISession         session     = transaction.Session;

            transaction.Session         = new MockSession(session);
            transaction.StatementRunner = transaction.Session;
            transaction.Transaction?.Dispose();
            transaction.Transaction = null;

            if (withTransaction)
            {
                transaction.Transaction     = transaction.Session.BeginTransaction();
                transaction.StatementRunner = transaction.Transaction;
            }

            return(transaction);
        }