コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void canAvoidDeadlockThatWouldHappenIfTheRelationshipTypeCreationTransactionModifiedData()
        public virtual void CanAvoidDeadlockThatWouldHappenIfTheRelationshipTypeCreationTransactionModifiedData()
        {
            GraphDatabaseService graphdb = Database.GraphDatabaseAPI;
            Node node = null;

            using (Transaction tx = graphdb.BeginTx())
            {
                node = graphdb.CreateNode();
                node.SetProperty("counter", 0L);
                tx.Success();
            }

            graphdb.RegisterTransactionEventHandler(new RelationshipCounterTransactionEventHandler(node));

            using (Transaction tx = graphdb.BeginTx())
            {
                node.SetProperty("state", "not broken yet");
                node.CreateRelationshipTo(graphdb.CreateNode(), RelationshipType.withName("TEST"));
                node.RemoveProperty("state");
                tx.Success();
            }

            assertThat(node, inTx(graphdb, hasProperty("counter").withValue(1L)));
        }