//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void addingUniqueNodeWithUnrelatedValueShouldNotAffectLookup() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void AddingUniqueNodeWithUnrelatedValueShouldNotAffectLookup() { // given CreateConstraint("Person", "id"); long ourNode; { Transaction transaction = NewTransaction(AnonymousContext.writeToken()); ourNode = CreateLabeledNode(transaction, "Person", "id", 1); Commit(); } Transaction transaction = NewTransaction(AnonymousContext.writeToken()); TokenRead tokenRead = transaction.TokenRead(); int person = tokenRead.NodeLabel("Person"); int propId = tokenRead.PropertyKey("id"); IndexReference idx = transaction.SchemaRead().index(person, propId); // when CreateLabeledNode(transaction, "Person", "id", 2); // then I should find the original node assertThat(transaction.DataRead().lockingNodeUniqueIndexSeek(idx, exact(propId, Values.of(1))), equalTo(ourNode)); Commit(); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private static void lockNodeUsingUniqueIndexSeek(org.neo4j.kernel.internal.GraphDatabaseAPI database, org.neo4j.graphdb.Label label, String nameProperty) throws org.neo4j.internal.kernel.api.exceptions.KernelException private static void LockNodeUsingUniqueIndexSeek(GraphDatabaseAPI database, Label label, string nameProperty) { using (Transaction transaction = database.BeginTx()) { ThreadToStatementContextBridge contextBridge = database.DependencyResolver.resolveDependency(typeof(ThreadToStatementContextBridge)); KernelTransaction kernelTransaction = contextBridge.GetKernelTransactionBoundToThisThread(true); TokenRead tokenRead = kernelTransaction.TokenRead(); Read dataRead = kernelTransaction.DataRead(); int labelId = tokenRead.NodeLabel(label.Name()); int propertyId = tokenRead.PropertyKey(nameProperty); IndexReference indexReference = kernelTransaction.SchemaRead().index(labelId, propertyId); dataRead.LockingNodeUniqueIndexSeek(indexReference, IndexQuery.ExactPredicate.exact(propertyId, "value")); transaction.Success(); } }