I have a test where I create a mock Examine search result and test some code which should run if there are any results
line of code I need to test:
if (results.Any())
{
...do stuff
}
And in the test:
private Mock<ISearchResults> _mockSearchResults;
in the setup:
_mockSearchResults = new Mock<ISearchResults>();
At this point the mock results do not contain anything so if statement won't be true, I'm guessing I need to add a search result item to the results but I'm not sure how to, or if that's even correct. Here's what I was thinking, but it gives the error 'Invalid setup on an extension method' :
How to mock Examine search results
I have a test where I create a mock Examine search result and test some code which should run if there are any results
line of code I need to test:
And in the test:
in the setup:
At this point the mock results do not contain anything so if statement won't be true, I'm guessing I need to add a search result item to the results but I'm not sure how to, or if that's even correct. Here's what I was thinking, but it gives the error 'Invalid setup on an extension method' :
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.