public ClientFixture()
        {
            _connectionPool = TestConnection.Create();
            var settings = new ConnectionSettings(_connectionPool);

            settings.DisableDirectStreaming();
            settings.OnRequestCompleted(details =>
            {
                Output?.WriteLine(ApiCallDumper.ApiCallToDump(details));
            });
            EsClient = new ElasticClient(settings);
        }
Example #2
0
        /// <summary>
        /// Initializes a new instance of <see cref="IEsClientProvider"/>
        /// </summary>
        public TestEsClientProvider(string url, ITestOutputHelper output)
        {
            _connectionPool = new SingleNodeConnectionPool(new Uri(url));
            var settings = new ConnectionSettings(_connectionPool);

            settings.DisableDirectStreaming();
            settings.OnRequestCompleted(details =>
            {
                output?.WriteLine(ApiCallDumper.ApiCallToDump(details));
            });

            _client = new ElasticClient(settings);
        }
Example #3
0
        /// <summary>
        /// Initializes a new instance of <see cref="EsIndexFactoryFixture{TDoc, TConnectionProvider}"/>
        /// </summary>
        protected EsIndexFactoryFixture(TConnectionProvider connectionProvider)
        {
            _connection = connectionProvider.Provide();

            var settings = new ConnectionSettings(_connection);

            settings.DisableDirectStreaming();
            settings.OnRequestCompleted(details =>
            {
                Output?.WriteLine(ApiCallDumper.ApiCallToDump(details));
            });

            _client = new ElasticClient(settings);
        }
        /// <summary>
        /// Initializes a new instance of <see cref="EsIndexFixture{TDoc, TConnectionProvider}"/>
        /// </summary>
        protected EsIndexFixture(TConnectionProvider connectionProvider)
        {
            _connection = connectionProvider.Provide();

            var settings = new ConnectionSettings(_connection);

            settings.DisableDirectStreaming();
            settings.OnRequestCompleted(details =>
            {
                try
                {
                    Output?.WriteLine(ApiCallDumper.ApiCallToDump(details));
                }
                catch (InvalidOperationException e) when(e.Message == "There is no currently active test.")
                {
                    //Do nothing
                }
            });

            EsClient = new ElasticClient(settings);
        }