private static Internal.Driver NewDriver() { var driver = new Internal.Driver(new Uri("neo4j://myTest.org"), new TestConnectionProvider(Mock.Of <IConnection>()), null, null, null, Config.Default); return(driver); }
public async void ShouldVerifyConnection() { var mock = new Mock <IConnectionProvider>(); mock.Setup(x => x.VerifyConnectivityAsync()).Returns(Task.CompletedTask); var driver = new Internal.Driver(new Uri("bolt://localhost"), mock.Object, null); await driver.VerifyConnectivityAsync(); mock.Verify(x => x.VerifyConnectivityAsync(), Times.Once); }
public async void ShouldTestSupportMultiDb() { var mock = new Mock <IConnectionProvider>(); mock.Setup(x => x.SupportsMultiDbAsync()).Returns(Task.FromResult(true)); var driver = new Internal.Driver(new Uri("bolt://localhost"), mock.Object, null); await driver.SupportsMultiDbAsync(); mock.Verify(x => x.SupportsMultiDbAsync(), Times.Once); }
private void SetupMonitoredDriver() { var config = new Config { MetricsFactory = new DefaultMetricsFactory(), ConnectionAcquisitionTimeout = TimeSpan.FromMinutes(5), ConnectionTimeout = Config.InfiniteInterval, MaxConnectionPoolSize = 100, DriverLogger = new TestDriverLogger(Output) }; var connectionSettings = new ConnectionSettings(AuthToken, config); var bufferSettings = new BufferSettings(config); var connectionFactory = new MonitoredPooledConnectionFactory( new PooledConnectionFactory(connectionSettings, bufferSettings, config.DriverLogger)); _driver = (Internal.Driver)GraphDatabase.CreateDriver(new Uri(RoutingServer), config, connectionFactory); _connections = connectionFactory.Connections; _metrics = _driver.GetMetrics(); }