0

I have a class like in the example bellow and i want to unit test the method UpdateDocumentAsync, but I don't know how. Do you have an idea how can i test it please ?

   public class MyElasticSearchClient
{
    private readonly IElasticClient client;

        ...

    public async Task<bool> UpdateDocumentAsync<T>(string index, string type, string id, T updated) where T : class
    {
        var response = await client.UpdateAsync<T, object>(u => u
            .Index(index)
            .Type(type)
            .Id(id)
            .Doc(updated)
            .RetryOnConflict(3)
            .Refresh()
        ).ConfigureAwait(false);
        return response.ConnectionStatus.Success;
    }
}
Mohamed BOUZIDI
  • 125
  • 1
  • 7
  • What do you actually want to test? That the document is successfully updated in Elasticsearch? – Russ Cam Mar 01 '17 at 22:02
  • I checked only that it generates the right request to ElasticSearch like in this [example](http://stackoverflow.com/questions/38207159/using-inmemoryconnection-to-test-elasticsearch) – Mohamed BOUZIDI Mar 02 '17 at 12:52

0 Answers0