
Moq Return method not available after Setup
If you are familiar with the mocking framework Moq, you’re used to call Setup with the overload taking a Func<T, TResult> and expect after that the Return<TResult> method to be available. And it’s normally there. However, I just ran into an interesting scenario, where calling the correct overload did not make available the Return<TResult> method. In my case the code being mocked is a dependency that makes a request on a webservice. A mockup of the wrapper class is created, and the Load method, which returns an XDocument, is setup. ...