F# 在单元测试中调用异步函数时,任务是否立即取消?
我正在努力弄清楚为什么我的任务被取消了F# 在单元测试中调用异步函数时,任务是否立即取消?,f#,xunit,F#,Xunit,我正在努力弄清楚为什么我的任务被取消了 [<Fact>] let ``Query applicant count``() = async { // Test let! response = WebGateway.get EventStore.endpoint "ApplicantCountFn" // Can't get beyond this // Verify match! response.Conte
[<Fact>]
let ``Query applicant count``() =
async {
// Test
let! response = WebGateway.get EventStore.endpoint "ApplicantCountFn" // Can't get beyond this
// Verify
match! response.Content.ReadAsStringAsync() |> Async.AwaitTask with
| "" -> Assert.True (false, "result is empty")
| _ -> ()
}
附录:
let get baseAddress (resource:string) =
async {
let client = httpClient baseAddress
return! client.GetAsync(resource) |> Async.AwaitTask
}
我将客户端请求的超时时间增加到30秒:
let client = new HttpClient(handler)
client.Timeout <- TimeSpan(0,0,30)
let client=新的HttpClient(处理程序)
客户端超时
let client = new HttpClient(handler)
client.Timeout <- TimeSpan(0,0,30)