I am using NEST framework to do elastic search query in c#.
I am writing a simple unit test with Moq.
mockElasticClient.Setup(ec => ec.SearchAsync(
It.IsAny<Func<SearchDescriptor<Relativity>,
SearchDescriptor<Relativity>>>()))
.ReturnsAsync(mockSearchResponse.Object);
THe above code throws 'An expression tree may not contain a call or invocation that uses optional arguments'
the above code is working if i use Search instead of SearchAsync.
What am i doing wrong here?