.NET 10 introduces file-based C# programs that can be run with `dotnet run <file.cs>`. This article demonstrates how to create single-file test suites using xUnit v3 by adding package references with `#:package` syntax, implementing a test runner with callbacks for test results, and writing test classes in the same file. The

11m read timeFrom ardalis.com
Post cover image
Table of contents
IntroductionBuilding xUnit Tests as File-Based C# ProgramsReferencing Other ProjectsCleaning Up the Boilerplate CodeBenefits of File-Based TestsConclusionResources

Sort: