///<summary> ///A private method to enrich data from file ///</summary> private IElasticClient GetElasticClientWithData(BaseTermQueryTestData data) { ElasticsearchInterceptingConnection conn = new ElasticsearchInterceptingConnection(); conn.RegisterRequestHandlerForType <Nest.GetResponse <GlossaryTerm> >((req, res) => { //Get the file name for this round res.Stream = TestingTools.GetTestFileAsStream("ESTermQueryData/" + data.ESTermID + ".json"); res.StatusCode = 200; }); //While this has a URI, it does not matter, an InMemoryConnection never requests //from the server. var pool = new SingleNodeConnectionPool(new Uri("http://localhost:9200")); var connectionSettings = new ConnectionSettings(pool, conn); IElasticClient client = new ElasticClient(connectionSettings); return(client); }