I'm trying to mock the .NET HttpClient with Moq in F#. I currently have the following code:
open System.Net.Http
open Foq
[<Fact>]
let ``Some test`` () =
Mock<HttpClient>.With
(fun client ->
<@ client.GetStringAsync("foo")
--> task { return "bar" } @>)
|> ignore
Upon running the test I get the following error.
System.Reflection.TargetParameterCountException : Parameter count mismatch.
How can I fix this?
I know there are many similar questions, but they are all for C#. They mention that either there are arguments missing somewhere or something with a callback should be added. But I can't figure out what arguments are missing, or how to add the callback to my example.