Kabua.TypeSafe.xUnit 1.1.0

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

// Install Kabua.TypeSafe.xUnit as a Cake Tool
#tool nuget:?package=Kabua.TypeSafe.xUnit&version=1.1.0                

Logo

Type Safe xUnit

A Type Safe Data-Driven Extension for xUnit.net

Goal

The following goals were the inspiration behind this project's creation:

  1. Make unit testing a 1st-class citizen by using type-safe data-driven objects.
  2. To make xUnit data-driven features type safe, easy to use, and flexible, by employing real POCO objects.
  3. To make it easier to develop your own type-safe data-driven xUnit attributes, albeit not required.
  4. To make it easy to alter the test's display text on a global and per-test basis.
  5. To ensure that the sequence in which the data-driven tests were created corresponds to the order in which they are shown in the Test Runner.

Getting Started

First, the Kabua.TypeSafe.xUnit project supports both .net461 and .net6 and above.

Second, the easiest way to get started is to use the nuget packages from nuget.org.

Building the Code

These instructions will get a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

No installation is required. Even though this project references the xunit.assert and xunit.core nuget packages.

Installing and running the tests

  1. clone from GitHub
  2. open a CLI
  3. navigate to the Kabua.TypeSafe.xUnit.UnitTests project.
  4. run dotnet test. This will build the solution and then run all the xUnit tests.
Example

From the command prompt.

c:>mkdir temp\Kabua.TypeSafe.xUnit
c:>cd temp\Kabua.TypeSafe.xUnit
c:\temp\Kabua.TypeSafe.xUnit>git clone https://github.com/kabua/typesafe.xunit.git
c:\temp\Kabua.TypeSafe.xUnit>cd TypeSafe.xUnit\Kabua.TypeSafe.xUnit.UnitTests
c:\temp\Kabua.TypeSafe.xUnit\TypeSafe.xUnit\Kabua.TypeSafe.xUnit.UnitTests>dotnet test

Deployment

The Kabua.TypeSafe.xUnit project supports both .net4.61 and .net6 and above. The package is release on www.nuget.org

How to use

The Kabua.TypeSafe.xUnit.UnitTests, which can be found here, contains over 50 detailed examples on how to use the rich type-safe data-driven attributes for xUnit.

How the Unit Test Examples Are Structured

To learn how to utilize these new type-safe data-driven attributes, read the examples from the first source file to the last. As concepts in later files build on earlier ones.

To improve readability, we format files as follows:

  • Prefixed files with F0x_ (e.g., F01_ to F50_) and include a descriptive name.
  • Files can include many classes. Class names begin with C_XX_YY_, where X is the file number, and Y in a numbered class. For example: C20_02_, indicates the second class in the F20_* file.
  • To aid with Test Runner formatting, we prefix all tests with T0x_, such as T01_, T02_, etc.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Tristen Fielding - Initial author - Kabua
  • Billie Thompson - Initial README work - PurpleBooth

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License so that everyone can use it - see the LICENSE file for details.

Acknowledgments

  • Hat tip to anyone whose code was used
  • Inspiration
  • etc
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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 Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 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.1.0 105 7/12/2024
1.0.1 89 6/12/2024
1.0.0 221 11/29/2023

1) Added built-in support for several types of display names, by defining a new enum called DisplayNameFormat. See:  F02_Use_FormattedTheory_to_control_DisplayNameFormat.cs for examples.
2) Added support for subclassing and/or using interfaces for test data classes. See:  F11_Support_Subclasses_and_Interfaces.cs for examples.