I'm unit testing my viewmodel command that call a web service. My viewmodel has a dependency on IHttpService which 'GetAsync' method is called by this viewmodel.
I want to unit test my viewmodel and manage the fact that 'GetAsync' returns a cancelled task, which is the case when it's implemented with HttpClient and when an TimeOutException occurs. How can i setup my IHttpServiceMock to return such a task ?
I tryed with TaskCompletionSource.SetCanceled() but i'm not able to tell with which exception it was cancelled...