Stage 6 · Lesson 6 of 8
Tests with xUnit
is a common .NET test . Create a test project with dotnet new xunit, reference your core , and run everything with dotnet test. A [Fact] is a single test.
A [Theory] with [InlineData(...)] rows runs one test over many inputs. Assertions read clearly: Assert.Equal(42.5m, ledger.MonthlyTotal()), Assert.Throws<ArgumentException>(() => Parse("abc")), and Assert.Equal(expected, actual, precision) for doubles, where the precision allows for tiny rounding differences.
Test the core logic in the , with no files or network inside, and cover such as an empty list and invalid values. Name tests after behaviour, such as RejectsNegativeAmounts, so a failure explains itself.
A question to check yourself, an AI practice session and 2 cheat sheet entries come when you add the roadmap to your account. Add it
Resources for this stage
Start with
- GitHub repoFreeProject Based Learning
Community maintained · Beginner
Follow one guided build in your language, then build your own without a guide
Keep handy
Also worth your time
How to present each project: the problem, stack, challenges and results
- Build Your Own XGo deeper
When you want a harder build: a shell, a key-value store or a tiny Git, from scratch