I'm trying to write some unit tests on classes that use the ArcGIS Runtime. I don't want to hit live services. Instead, I want to provide fake responses.
Is there any way to provide an instance of HttpClient or HttpMessageHandler to the ArcGIS Runtime so that I can send fake responses back?
Solved! Go to Solution.
I've got bad news and good news: There is no way to mock HTTP responses for Runtime yet, but there will be very soon.
In the next version of Runtime SDK for .NET, we plan to include an easy way to replace HttpMessageHandler for any request issued by Runtime. This will allow integration with tools like MockHTTP. This will also allow for scenarios like reading responses from local files (e.g. something like this) or generating them on the fly.
I will post another reply when this functionality is released, and I'll have some sample code to share at that time.
I've got bad news and good news: There is no way to mock HTTP responses for Runtime yet, but there will be very soon.
In the next version of Runtime SDK for .NET, we plan to include an easy way to replace HttpMessageHandler for any request issued by Runtime. This will allow integration with tools like MockHTTP. This will also allow for scenarios like reading responses from local files (e.g. something like this) or generating them on the fly.
I will post another reply when this functionality is released, and I'll have some sample code to share at that time.
Thank you for letting me know! I look forward to the next version.