- Home
- .NET code examples
- xUnit v3 examples: Assert.Skip, TestContext & TheoryDataRow
xUnit v3 examples: Assert.Skip, TestContext & TheoryDataRow
xUnit 3 has been launched and including many features. These include assert methods for skipping tests, a new TestContext and new ways of adding theory data to unit tests.
This code example will allow you to try out the features for yourself.
You can learn more about xUnit v3 features, or watch the video:
Download the code example
You'll need to fill out the code example form. We will send you an email where you can download the code example.
The code example will be in a zip file.
Software
This is the software that will need to be installed onto your machine.
- Visual Studio 2022. Version 17.12.0 or above. It will work with the free community version.
- .NET 9 SDK. Version 9.0.0 or above.
How to run the unit tests
Open up RoundTheCode.XUnit3.sln in Visual Studio. Go to Test and Test Explorer in the top menu and run all the tests. They should all pass apart from the ones that are set up to skip.
In the RoundTheCode.XUnit3.UnitTests project, there is a test class for each of the features covered. These include:
SpeedConversionHelperSkipTests.cs-Skipassert methodsSpeedConversionHelperSkipAttributeTests.cs- UsingSkipproperties in theFactattributeSpeedConversionHelperTheoryDataRowTests.cs- TheTheoryDataRowtypeSpeedConversionHelperMatrixTheoryDataTests.cs- TheMatrixTheoryDatatypeSpeedConversionHelperTestContextTests.cs- TheTestContextinstance
Related code examples