CODESTYLE: xUnit v3 + AwesomeAssertions, and ILoggerFactory-not-Serilog for libraries - #270
Merged
Merged
Conversation
…oggerFactory not Serilog Test projects: mandate xUnit v3+ (xunit.v3, not the legacy v2 xunit) and AwesomeAssertions for every assertion - native xUnit asserts are not allowed. Libraries: a NuGet library depends only on Microsoft.Extensions.Logging.Abstractions and exposes an ILoggerFactory seam; it never references Serilog (the app owns the concrete backend and injects it). Reference implementation: LanguageTags LogOptions. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates CODESTYLE.md to sharpen two C# governance rules: (1) require xUnit v3+ with AwesomeAssertions-only assertions, and (2) clarify that Serilog is an application concern while libraries log via Microsoft.Extensions.Logging.Abstractions with an ILoggerFactory seam.
Changes:
- Clarify structured logging guidance: Serilog as the application backend; libraries log only through
Microsoft.Extensions.Loggingabstractions and expose anILoggerFactoryseam. - Tighten testing conventions: require
xunit.v3(or later) and require AwesomeAssertions for all assertions (no native xUnitAssert.*).
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Use the Microsoft.Extensions.Logging abstraction in examples: LogError (not Serilog's .Error), and drop Serilog from the generic GlobalUsings example in favor of Microsoft.Extensions.Logging. Addresses Copilot review on the same-doc inconsistencies. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Uh oh!
There was an error while loading. Please reload this page.
…stency Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Uh oh!
There was an error while loading. Please reload this page.
ptr727 added a commit
that referenced
this pull request
Jul 9, 2026
…logging rules (#271) Promotion of `develop` -> `main`, batching the docs/governance PRs since the last promotion: - **#268** — AGENTS.md `## Communicating with the User` (clickable PR links; numbered questions). - **#269** — AGENTS.md `## Supported Development Platforms` (#228 §0: cross-platform by default, narrow only for a hard dependency/runtime ceiling). - **#270** — CODESTYLE.md: xUnit v3 + AwesomeAssertions (no native asserts); NuGet libraries log via `ILoggerFactory`, not Serilog. Diff is only `AGENTS.md` + `CODESTYLE.md`; no code. `spec/validate.py` green. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two C# rule sharpenings in CODESTYLE.md, both from maintainer directives.
Testing Conventions — was "xUnit with AwesomeAssertions"; now explicit:
xunit.v3package, never the legacy v2xunit).Assert.Equal,Assert.True, ...) are not allowed.Error Handling and Logging — clarified that Serilog is the application's concrete backend, and strengthened the library rule:
Microsoft.Extensions.Logging.Abstractionsand exposes anILoggerFactoryseam (settable factory defaulting toNullLoggerFactory,SetFactory/TrySetFactory); it never references Serilog or a sink.SerilogLoggerFactory), injecting it. Reference:LanguageTags(LogOptions+LanguageTagsCreate/LoggerFactory).Additive/sharpening only; markdownlint clean; CRLF preserved.
Fleet audit (backlog to follow): violators are Utilities (xUnit v2 + native asserts; library ships Serilog) and AudioCleaner (xUnit v2 + native asserts). LanguageTags, PlexCleaner, NxWitness, PhotoCleaner, MediaTools already comply.
🤖 Generated with Claude Code