Unit testing with ArcGIS Runtime

1026
2
Jump to solution
04-09-2018 02:18 PM
JeffSiemens
New Contributor II

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?

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
MatveiStefarov
Esri Contributor

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.

View solution in original post

2 Replies
MatveiStefarov
Esri Contributor

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.

JeffSiemens
New Contributor II

Thank you for letting me know! I look forward to the next version.

0 Kudos