AnyUnit.Style.FSharp 1.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package AnyUnit.Style.FSharp --version 1.2.0
                    
NuGet\Install-Package AnyUnit.Style.FSharp -Version 1.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AnyUnit.Style.FSharp" Version="1.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AnyUnit.Style.FSharp" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="AnyUnit.Style.FSharp" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AnyUnit.Style.FSharp --version 1.2.0
                    
#r "nuget: AnyUnit.Style.FSharp, 1.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AnyUnit.Style.FSharp@1.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AnyUnit.Style.FSharp&version=1.2.0
                    
Install as a Cake Addin
#tool nuget:?package=AnyUnit.Style.FSharp&version=1.2.0
                    
Install as a Cake Tool

AnyUnit.Style.FSharp

F#'s own idiomatic, value-based test style for AnyUnit - a test is a Test value built with the test { } computation expression, not a [Test]- attributed instance method the way AnyUnit.Style.Nunit/ AnyUnit.Style.Xunit/AnyUnit.Style.FsUnit all work. If your F# test suite already reaches for real NUnit/xUnit's attribute style, use one of those instead - reach for this one when a top-level let reads more naturally than a class full of [Test] methods.

Usage

[<assembly: AnyUnit.Style.FSharp.FSharpStyle>]
do ()

open AnyUnit.Style.FSharp.Test

// Either shape is discovered - a plain value binding, or a real
// zero-argument function (the two idiomatic ways to write "just a test,
// no parameters" in F#):
let ``adds two numbers`` = test {
    let! Assert = assertion
    Assert.Equal(4, 2 + 2)
}

let ``adds two numbers, function form`` () = test {
    let! Assert = assertion
    Assert.Equal(4, 2 + 2)
}

let! Assert = assertion binds the current test's IAssert - call straight into whichever style's assertion vocabulary you already have referenced (AnyUnit.Style.Xunit's Assert.Equal/Assert.True/..., AnyUnit.Constraints' Assert.That(x, Is.EqualTo(y)), ...): this package doesn't provide its own. let! log = AnyUnit.Style.FSharp.Test.log gets the test's ILog (captured output) the same way.

A test is discovered by its own let binding name - there's no separate description string to also keep in sync.

Parameterized tests

This style has no data attribute of its own by design (a Test is a value, not a method with parameters an attribute could sit on) - a real F# function (with real parameters, so it compiles to a genuine method, not a property) carrying another style's row attribute works instead, since Test-typed function discovery recognizes any attribute implementing AnyUnit.Run.Attributes.IRowInlineParameter:

open AnyUnit.Style.FSharp.Test
open AnyUnit.Style.Xunit // for InlineDataAttribute - any style's own row attribute works the same way

[<InlineData(1, 1)>]
[<InlineData(2, 4)>]
[<InlineData(3, 9)>]
let square (n: int) (expected: int) = test {
    let! Assert = assertion
    Assert.True(n * n = expected, $"Expected {n}*{n} = {expected}")
}

Each row runs as its own, separately-reported test - same as [TestCase]/ [InlineData] under the attribute-based styles.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.2 50 9/16/2026
1.2.1 59 9/16/2026
1.2.0 64 9/16/2026
1.2.0-alpha.0.6 47 9/14/2026
1.1.0 75 9/14/2026
1.0.0 81 9/12/2026