<!-- GENERATED FILE - DO NOT EDIT This file was generated by [MarkdownSnippets](https://github.com/SimonCropp/MarkdownSnippets). Source File: /docs/mdsource/fsharp.source.md To change this file edit the source file and then run MarkdownSnippets. --> # Usage in FSharp Argon ships F# support in a separate nuget [Argon.FSharp](https://www.nuget.org/packages/Argon.FSharp/). To serialize F# types properly, add the converters: ```fs VerifierSettings.AddExtraSettings(fun settings -> settings.AddFSharpConverters()) ``` ## DefaultValueHandling By default [DefaultValueHandling is Ignore](/docs/serializer-settings.md#default-settings). Since F# `Option.None` is treated as null, it will be ignored by default. To include `Option.None` use `VerifierSettings.AddExtraSettings` at module startup: <!-- snippet: DefaultValueHandling --> <a id='snippet-DefaultValueHandling'></a> ```fs VerifierSettings.AddExtraSettings(fun settings -> settings.DefaultValueHandling <- DefaultValueHandling.Include) ``` <sup><a href='/src/FSharpTests/Tests.fs#L8-L10' title='Snippet source file'>snippet source</a> | <a href='#snippet-DefaultValueHandling' title='Start of snippet'>anchor</a></sup> <!-- endSnippet --> ## Async Qwerks 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#. <!-- snippet: FsTest --> <a id='snippet-FsTest'></a> ```fs [<Fact>] let MyTest () = Verifier.Verify(15).ToTask() |> Async.AwaitTask ``` <sup><a href='/src/FSharpTests/Tests.fs#L12-L16' title='Snippet source file'>snippet source</a> | <a href='#snippet-FsTest' title='Start of snippet'>anchor</a></sup> <!-- endSnippet --> ## Full tests <!-- snippet: FSharpTests/Tests.fs --> <a id='snippet-FSharpTests/Tests.fs'></a> ```fs module Tests open Xunit open VerifyTests open VerifyXunit open Argon VerifierSettings.AddExtraSettings(fun settings -> settings.DefaultValueHandling <- DefaultValueHandling.Include) [<Fact>] let MyTest () = Verifier.Verify(15).ToTask() |> Async.AwaitTask [<Fact>] let WithFluentSetting () = Verifier .Verify(15) .UseMethodName("customName") .ToTask() |> Async.AwaitTask do () ``` <sup><a href='/src/FSharpTests/Tests.fs#L1-L21' title='Snippet source file'>snippet source</a> | <a href='#snippet-FSharpTests/Tests.fs' title='Start of snippet'>anchor</a></sup> <!-- endSnippet -->