Argon ships F# support in a separate nuget Argon.FSharp.
To serialize F# types properly, add the converters:
VerifierSettings.AddExtraSettings(fun settings -> settings.AddFSharpConverters())
By default DefaultValueHandling is Ignore. Since F# Option.None
is treated as null, it will be ignored by default. To include Option.None
use VerifierSettings.AddExtraSettings
at module startup:
VerifierSettings.AddExtraSettings(fun settings -> settings.NullValueHandling <- NullValueHandling.Include)
F# does not respect implicit operator conversion. SettingsTask
uses implicit operator conversion to provide a fluent api in combination with an instance that can be awaited. As such SettingsTask.ToTask()
needs to be awaited when used inside F#.
[<Fact>]
let MyTest () =
Verifier.Verify(15).ToTask() |> Async.AwaitTask
module Tests
open Xunit
open VerifyTests
open VerifyXunit
open Argon
VerifierSettings.AddExtraSettings(fun settings -> settings.NullValueHandling <- NullValueHandling.Include)
[<Fact>]
let MyTest () =
Verifier.Verify(15).ToTask() |> Async.AwaitTask
[<Fact>]
let WithFluentSetting () =
Verifier
.Verify(15)
.UseMethodName("customName")
.ToTask()
|> Async.AwaitTask
do ()