//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @ParameterizedTest(name = "V{0}") @ValueSource(longs = {org.neo4j.bolt.v1.BoltProtocolV1.VERSION, org.neo4j.bolt.v2.BoltProtocolV2.VERSION, org.neo4j.bolt.v3.BoltProtocolV3.VERSION}) void shouldCreateBoltProtocol(long protocolVersion) throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldCreateBoltProtocol(long protocolVersion) { EmbeddedChannel channel = new EmbeddedChannel(); BoltChannel boltChannel = new BoltChannel("bolt-1", "bolt", channel); BoltStateMachineFactory stateMachineFactory = mock(typeof(BoltStateMachineFactory)); BoltStateMachine stateMachine = mock(typeof(BoltStateMachine)); when(stateMachineFactory.NewStateMachine(protocolVersion, boltChannel)).thenReturn(stateMachine); BoltConnectionFactory connectionFactory = mock(typeof(BoltConnectionFactory)); BoltConnection connection = mock(typeof(BoltConnection)); when(connectionFactory.NewConnection(boltChannel, stateMachine)).thenReturn(connection); BoltProtocolFactory factory = new DefaultBoltProtocolFactory(connectionFactory, stateMachineFactory, NullLogService.Instance); BoltProtocol protocol = factory(protocolVersion, boltChannel); protocol.Install(); // handler with correct version is created assertEquals(protocolVersion, protocol.Version()); // it uses the expected worker verify(connectionFactory).newConnection(eq(boltChannel), any(typeof(BoltStateMachine))); // and halts this same worker when closed verify(connection, never()).stop(); channel.close(); verify(connection).stop(); channel.finishAndReleaseAll(); }
private static BoltProtocol NewBoltProtocol(long version) { BoltProtocol handler = mock(typeof(BoltProtocol)); when(handler.Version()).thenReturn(version); return(handler); }