2

We are using F# for our HTTP calls automation tests and I stumbled upon one runtime error from FsUnit that I am not sure I understand, I admit I wrote F# only 2 times in my life therefore this might be stupid question but bear with me.

This is the test:

[<Test>]
[<AsyncStateMachine(typeof<Task>)>]
member x.``When all dependent microservices and kafka are up and running service should be healty``() = toTask <| async {
    let! responseContent = Http.AsyncRequestString(url = config.ApiHost + "/BetsReportingApiModule/healthcheck")
    let expectedIsAlive = JsonValue.Parse(responseContent).GetProperty("alive").AsBoolean
    return  expectedIsAlive |> should be True
}

And this is the error message:

Message: Expected: True But was: << StartupCode$SBTech-BetsReportingAPI-AutomationTests>.$HttpApiTests+expectedIsAlive@1689>

I can guess that this is some runtime generated string but I am not sure what is the cause if it.

kuskmen
  • 3,648
  • 4
  • 27
  • 54
  • 5
    I suppose the `AsBoolean` is method not property – FoggyFinder Jun 19 '18 at 14:30
  • 1
    @FoggyFinder, thanks I guess autocomplete failed me, whats more in C# always first parameter of `Assert` is expected while here it looks like to be other way around which also helped to my confusion, thanks. – kuskmen Jun 19 '18 at 14:34
  • 2
    Try using the FsUnitTyped namespace instead of FsUnit, it can catch problems like that at compile time. – marklam Jun 23 '18 at 08:47

0 Answers0