Learn Minimal APIs from start to finish. Perfect for beginners.

xUnit code examples

xUnit v3 examples: Assert.Skip, TestContext & TheoryDataRow
xUnit v3 examples: Assert.Skip, TestContext & TheoryDataRow

Download a code example from xUnit v3 that includes features such as Assert.Skip, Assert.SkipWhen, Assert.SkipUnless, TestContext and TheoryDataRow.

Exploring xUnit: Theory, Assert methods and Fixtures
Exploring xUnit: Theory, Assert methods and Fixtures

Download xUnit code examples so you can run unit tests with different Theory attributes, different assert methods and learn how to run tests with fixtures.

Using Moq in an xUnit project to unit test a .NET project
Using Moq in an xUnit project to unit test a .NET project

Download an xUnit and a .NET class library project that uses the Moq mocking framework to mock objects as part of unit tests.

xUnit project example for unit testing in .NET and C#
xUnit project example for unit testing in .NET and C#

Download an xUnit test project to help you unit test your C# code in a .NET project. It includes Fact and Theory examples alongside different Assert methods.

TimeProvider example for mocking time and timer in xUnit
TimeProvider example for mocking time and timer in xUnit

A .NET 8 xUnit project which uses the TimeProvider and FakeTimeProvider class to mock time and a timer in unit tests.