From 8394843255cb9225a822e5607d94d791b95ca075 Mon Sep 17 00:00:00 2001 From: James Wampler Date: Thu, 6 Aug 2026 03:28:59 +0000 Subject: [PATCH] Set NUnit and Assert.That as the testing standard in CLAUDE.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaces xUnit + FluentAssertions with NUnit, asserting through Assert.That and the constraint model. Adds concrete examples for the shapes that come up most here — collection equality, null checks, expected exceptions — plus a note on Assert.Multiple, since a plain chain stops at the first failure and hides the rest of a broken case. Documentation only. The existing 44 tests are still xUnit + FluentAssertions and now predate the standard; migrating them is a separate change. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01S56bfZMGe1hnhpWP4CjjNw --- CLAUDE.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CLAUDE.md b/CLAUDE.md index 0213087..1af19a1 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -49,7 +49,11 @@ Novel Software: software for planning and writing a novel. ASP.NET Core 10, C#, - Don't write tests just for coverage. Call out missing coverage rather than cover stuff not valuable to end user. - Code not cleanly unit-testable → mark `[ExcludeFromCodeCoverage]` or exclude namespace from coverage in .runsettings file - BDD-style unit tests, end-to-end as possible. e.g. `Deleting_a_scene_leaves_its_beats_alone` -- xUnit + FluentAssertions +- NUnit. No FluentAssertions — assert with `Assert.That` and NUnit's constraint model: + `Assert.That(beat.SceneId, Is.Null)`, `Assert.That(listed, Has.Count.EqualTo(3))`, + `Assert.That(titles, Is.EqualTo(new[] { "First", "Second" }))` +- Grouping related asserts in `Assert.Multiple` beats a chain that stops at the first failure +- Expected exceptions: `Assert.That(() => service.Foo(), Throws.TypeOf())` - Tests run against real in-memory SQLite via `TestDatabase`, not the EF InMemory provider — cascade deletes and query translation must be exercised, and the InMemory provider fakes both - Model calls are faked at the `IAgentModelClient` seam (see `ScriptedModelClient`). Never hit the Anthropic API from a test. - No "Mock" in mocked object names