Named argument wrappers for unit test frameworks to disambiguate between which argument of type 'a
is expected
and which actual
as there's no consistent ordering between libraries, and even within them (e.g. Expecto and Expecto.Flip).
A core type
namespace AltCode.Test.[Expecto|NUnit|Xunit]
type AssertionMatch<'a> =
{
Actual : 'a
Expected : 'a
}
static member Create() =
{
Actual = Unchecked.defaultof<'a>
Expected = Unchecked.defaultof<'a>
}
member this.WithActual e = { this with Actual = e }
member this.WithExpected e = { this with Expected = e }
providing a F# and C#-friendly API for naming arguments
Contains module AltCode.Test.Expecto.AltExpect
which provides wrappers for Expecto.Expect
and AltCode.Test.Expecto.AltFlipExpect
for Expecto.Flip.Expect
with an appropriate AltCode.Test.Expecto.AssertionMatch
-typed argument in place of actual and template expectation
Contains class AltCode.Test.Xunit.AltAssert
which provides wrappers for Xunit.Assert
with an appropriate AltCode.Test.Xunit.AssertionMatch
-typed argument in place of actual and template expectation
Contains classes AltCode.Test.NUnit.Alt*Assert
which provide emulators for the corresponding NUnit.Framework.Legacy.*Assert
for *
= 'Classic'
(just AltAssert
, not AltClassicAssert
), 'Collection'
, 'Directory'
, 'File'
and 'String'
types with an appropriate AltCode.Test.Nunit.AssertionMatch
-typed argument in place of actual and template expectation; also
type Constraint<'a> =
{
Actual : 'a
Constraint : NUnit.Framework.Constraints.IResolveConstraint
}
static member Create() =
{
Actual = Unchecked.defaultof<'a>
Constraint = null
}
member this.WithActual e = { this with Actual = e }
member this.WithConstraint e = { this with Constraint = e }
and wrappers for NUnit.Framework.Assert.That
overloads
static member That(x: Constraint<'a>)
static member That(x: Constraint<'a>, message: string)
Build | GitHub | |
Coverage | Coveralls |
Cross platform, dotnet code throughout.
It is assumed that .net 8.0.100 or later is available (dotnet
) -- try https://www.microsoft.com/net/download
Start by setting up with dotnet tool restore
Then dotnet run --project ./Build/Setup.fsproj
to do the rest of the set-up.
Running dotnet run --project ./Build/Build.fsproj
performs a full build/package process.
Use dotnet run --project ./Build/Build.fsproj --target <targetname>
to run to a specific target.
- Coveralls for allowing free services for Open Source projects