GeorgJung.TUnit.PairwiseDataSource 0.2.1

Suggested Alternatives

TUnit

dotnet add package GeorgJung.TUnit.PairwiseDataSource --version 0.2.1
                    
NuGet\Install-Package GeorgJung.TUnit.PairwiseDataSource -Version 0.2.1
                    
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="GeorgJung.TUnit.PairwiseDataSource" Version="0.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GeorgJung.TUnit.PairwiseDataSource" Version="0.2.1" />
                    
Directory.Packages.props
<PackageReference Include="GeorgJung.TUnit.PairwiseDataSource" />
                    
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 GeorgJung.TUnit.PairwiseDataSource --version 0.2.1
                    
#r "nuget: GeorgJung.TUnit.PairwiseDataSource, 0.2.1"
                    
#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 GeorgJung.TUnit.PairwiseDataSource@0.2.1
                    
#: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=GeorgJung.TUnit.PairwiseDataSource&version=0.2.1
                    
Install as a Cake Addin
#tool nuget:?package=GeorgJung.TUnit.PairwiseDataSource&version=0.2.1
                    
Install as a Cake Tool

TUnit.PairwiseDataSource Icon TUnit.PairwiseDataSource

NuGet version (GeorgJung.TUnit.PairwiseDataSource) Build Status

Deprecated: TUnit 1.73.0 and later include [PairwiseDataSource] built in. It uses the same pairwise algorithm from Xunit.Combinatorial, contributed to TUnit by Andrew Arnott. This package is no longer maintained. Please migrate to the built-in attribute.

This package added pairwise (all-pairs) test case generation to TUnit before TUnit had it: a [PairwiseDataSource] attribute that works like [MatrixDataSource], but covers every pair of parameter values instead of every combination. See TUnit's pairwise tests documentation for the built-in version.

Migrating to TUnit's built-in [PairwiseDataSource]

  1. Update TUnit to 1.73.0 or later.
  2. Remove the GeorgJung.TUnit.PairwiseDataSource package reference.
  3. Delete any using TUnit.PairwiseDataSource; directives. If you set them, also remove the TUnitPairwiseDataSourceImplicitUsings and TUnitPairwiseDataSourceSuppressTUnit0049 MSBuild properties and any PWTUNIT001 suppressions.

Your tests don't need any other changes: [PairwiseDataSource], [Matrix(...)], [MatrixRange<T>(...)], [MatrixMethod<T>(...)], [MatrixExclusion(...)] and the automatic bool/enum values all work the same with TUnit's attribute. TUnit's own TUnit0049 analyzer now recognizes [PairwiseDataSource], so this package's PWTUNIT001 replacement is no longer needed.

What changes

  • Without [MatrixExclusion]: TUnit generates exactly the same test cases as this package. Both use the same algorithm and default seed.
  • With [MatrixExclusion]: TUnit applies exclusions while it generates the test cases, instead of filtering them out afterwards as this package did. Every pair that can still occur is now covered, so these tests may get different (and sometimes more) test cases than before.
  • TUnit adds a Seed property ([PairwiseDataSource(Seed = 42)]) to pick a different, equally valid set of test cases.

Seeing error CS0104?

error CS0104: 'PairwiseDataSource' is an ambiguous reference between 'TUnit.Core.PairwiseDataSourceAttribute' and 'TUnit.PairwiseDataSource.PairwiseDataSourceAttribute'

You are using version 0.1.x of this package with TUnit 1.73.0 or later. Follow the migration steps above, or update this package to 0.2.

The final 0.2 release

Version 0.2 is a final release that only bridges the gap until you remove the package. It contains no pairwise implementation of its own. With it, your existing code compiles against TUnit 1.73.0+ unchanged, including using TUnit.PairwiseDataSource; directives, and [PairwiseDataSource] already uses TUnit's built-in attribute.

  • It reports warning PWTUNIT002 as a reminder to remove the package. To silence it, add <NoWarn>$(NoWarn);PWTUNIT002</NoWarn> to your project.
  • It fails with error PWTUNIT003 if your TUnit version is older than 1.73.0. If you have to stay on an older TUnit, keep using version 0.1.x.

Migrating from Xunit.Combinatorial

This package was built to make migrating from xUnit with Xunit.Combinatorial easy, generating the same pairwise test cases for equivalent inputs. TUnit's built-in attribute keeps that promise:

Xunit.Combinatorial TUnit
[Theory, PairwiseData] [Test, PairwiseDataSource]
[Theory, CombinatorialData] [Test, MatrixDataSource]
[CombinatorialValues(1, 2, 3)] [Matrix(1, 2, 3)]
[CombinatorialRange(0, 5)] [MatrixRange<int>(0, 5)]
Bool/enum auto-generation Bool/enum auto-generation (same)

History

The pairwise algorithm in versions 0.1.x was a close port of Andrew Arnott's implementation in Xunit.Combinatorial. That implementation is itself derived from Charlie Poole's NUnit implementation, originally based on Bob Jenkins' "jenny" tool. The 0.1.x source code is available at the v0.1.28 tag.

License

This project is licensed under the MIT License - see LICENSE for details.

Versions 0.1.x also contained the pairwise algorithm derived from Xunit.Combinatorial, which is licensed under the Microsoft Public License (Ms-PL). Those versions include its license text in ThirdPartyNotices.txt.

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 is compatible.  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 is compatible.  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 is compatible.  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.
  • .NETStandard 2.0

    • No dependencies.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.