FSharp.xUnit 1.2.26

dotnet add package FSharp.xUnit --version 1.2.26
NuGet\Install-Package FSharp.xUnit -Version 1.2.26
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="FSharp.xUnit" Version="1.2.26" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FSharp.xUnit --version 1.2.26
#r "nuget: FSharp.xUnit, 1.2.26"
#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.
// Install FSharp.xUnit as a Cake Addin
#addin nuget:?package=FSharp.xUnit&version=1.2.26

// Install FSharp.xUnit as a Cake Tool
#tool nuget:?package=FSharp.xUnit&version=1.2.26

The class library extends xunit to assert equal.

  • It output data in F# style.

  • It's easier to customize the equals.

GetStarted

使用系统默认的相等比较器:

open FSharp.xUnit

[<Fact>]
let ``My test`` () =
    Should.equal 1 1

相反的操作Should.notEqual

使用自定义的相等比较器:

.\FSharp.xUnit.Test\CustomDataExample.fs

获得了should,我们就可以进行自定义的测试了,测试的方法和上面的差不多:

.\FSharp.xUnit.Test\Test.fs

相反的操作should.notEqual

SingleDataSource

单参数数据源

SingleDataSource向构造函数提供一个键值对列表,成员dataSource提供给MemberData特性,索引属性提供不在参数表的额外数据。

使用方法:.\FSharp.xUnit.Test\SingleDataSourceTest.fs

TupleDataSource

多参数数据源

使用方法:.\FSharp.xUnit.Test\TupleDataSourceTest.fs

ArrayDataSource

变长参数数据源

使用方法:.\FSharp.xUnit.Test\ArrayDataSourceTest.fs

ClassDataBase

open FSharp.xUnit

type MyArrays1() = 
    inherit ClassDataBase([ 
        [| 3; 4 |]; 
        [| 32; 42 |] 
    ])

type ClassDataBaseTest(output:ITestOutputHelper) =
    [<Theory>]
    [<ClassData(typeof<MyArrays1>)>]
    member _.v1 (a : int, b : int) = 
        Assert.NotEqual(a, b)
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. 
.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.26 76 3/29/2024
1.2.25 81 3/6/2024
1.2.24 124 1/11/2024
1.2.23 85 1/9/2024
1.2.22 111 12/27/2023
1.2.21 133 11/19/2023
1.2.20 95 11/16/2023
1.2.19 89 11/13/2023
1.2.18 78 11/8/2023
1.2.17 89 11/8/2023
1.2.16 120 11/2/2023
1.2.15 99 11/1/2023
1.2.14 122 11/1/2023
1.2.13 87 10/27/2023
1.2.12 98 10/18/2023
1.2.11 124 9/23/2023
1.2.10 114 9/18/2023
1.2.9 146 7/22/2023
1.2.8 159 7/21/2023
1.2.7 238 3/13/2023
1.2.6 240 3/12/2023
1.2.5 239 3/8/2023
1.2.4 299 12/19/2022
1.2.3 431 5/30/2022
1.2.2 449 3/16/2022
1.2.1 328 10/26/2021
1.2.0 355 10/26/2021
1.1.0 333 3/20/2021
1.0.0 444 9/15/2020

update idioms