Create Unit tests for Elasticsearch query in .net

25 Views Asked by At

I have a microservice used to search in Elasticsearch documents (Using Elasticsearch.Net and NEST). I want to add some unit tests to test my Query on the SearchAsync method. Is there a way to mock the IElasticSearch client in order to get some documents and apply the Query on this documents? I managed to mock the SearchAsync method to return an ISearchResponse but this does not apply the Query on documents.

Thanks.

0

There are 0 best solutions below