I'm using the .Net Nest client to connect to an Elasticsearch instance.
I want to test my code that is calling Nest and wanted to mock Nest away.
Currently fighting with mocking the ElasticClient.IndexAsync method.
It returns an instance of the IndexResponse class. That one is neither an interface or has virtual properties. So there seems to be no way to Mock IndexResponse and therefore the IndexAsync method.
Is there a documented way on how to do this?
- writing a complete wrapper for the client (another layer of abstraction as if there weren't enough) and mock that
- using InMemoryConnection to provide responses on a lower level (that feels like testing primarily the ElasticClient, but i actually want to test my code and just get rid of the dependency)