//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldSeeExpectedTransactionData() public virtual void ShouldSeeExpectedTransactionData() { // GIVEN //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final Graph state = new Graph(db, random); Graph state = new Graph(_db, _random); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final ExpectedTransactionData expected = new ExpectedTransactionData(true); ExpectedTransactionData expected = new ExpectedTransactionData(true); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.graphdb.event.TransactionEventHandler<Object> handler = new VerifyingTransactionEventHandler(expected); TransactionEventHandler <object> handler = new VerifyingTransactionEventHandler(expected); using (Transaction tx = _db.beginTx()) { for (int i = 0; i < 100; i++) { Operation.CreateNode.perform(state, expected); } for (int i = 0; i < 20; i++) { Operation.CreateRelationship.perform(state, expected); } tx.Success(); } _db.registerTransactionEventHandler(handler); // WHEN Operation[] operations = Operation.values(); for (int i = 0; i < 1_000; i++) { expected.Clear(); using (Transaction tx = _db.beginTx()) { int transactionSize = _random.intBetween(1, 20); for (int j = 0; j < transactionSize; j++) { _random.among(operations).perform(state, expected); } tx.Success(); } } // THEN the verifications all happen inside the transaction event handler }
public VerifyingTransactionEventHandler(ExpectedTransactionData expectedData) { this._expectedData = expectedData; }
internal abstract void perform(Graph graph, ExpectedTransactionData expectations);