0

我正在尝试为以下代码编写单元测试:

m_Client.SendAsync(request).ContinueWith(responseTask =>
{
    HttpResponseMessage response = responseTask.Result;

    try
    {
        string str = response.Content.ReadAsStringAsync().Result;

        // ...
    }
    catch
    {
        // process exception here
    }
}

是否可以在 ReadAsStringAsync 执行期间模拟任何类型的异常?

4

0 回答 0