Skip to content

CODESTYLE: xUnit v3 + AwesomeAssertions, and ILoggerFactory-not-Serilog for libraries - #270

Merged
ptr727 merged 3 commits into
developfrom
feature/codestyle-csharp-test-logging
Jul 9, 2026
Merged

CODESTYLE: xUnit v3 + AwesomeAssertions, and ILoggerFactory-not-Serilog for libraries#270
ptr727 merged 3 commits into
developfrom
feature/codestyle-csharp-test-logging

Conversation

@ptr727

Copy link
Copy Markdown
Owner

Two C# rule sharpenings in CODESTYLE.md, both from maintainer directives.

Testing Conventions — was "xUnit with AwesomeAssertions"; now explicit:

  • xUnit v3 or later (the xunit.v3 package, never the legacy v2 xunit).
  • AwesomeAssertions for every assertion; native xUnit asserts (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:

  • A NuGet library depends only on Microsoft.Extensions.Logging.Abstractions and exposes an ILoggerFactory seam (settable factory defaulting to NullLoggerFactory, SetFactory/TrySetFactory); it never references Serilog or a sink.
  • The application owns the concrete logger and bridges it (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

…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>
CopilotAI review requested due to automatic review settings July 9, 2026 23:04

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.Logging abstractions and expose an ILoggerFactory seam.
  • Tighten testing conventions: require xunit.v3 (or later) and require AwesomeAssertions for all assertions (no native xUnit Assert.*).

Comment threadCODESTYLE.md Outdated
Comment threadCODESTYLE.md
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>
CopilotAI review requested due to automatic review settings July 9, 2026 23:08

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment threadCODESTYLE.md Outdated
…stency
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
CopilotAI review requested due to automatic review settings July 9, 2026 23:10

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@ptr727
ptr727 merged commit 86ed881 into developJul 9, 2026
7 checks passed
@ptr727
ptr727 deleted the feature/codestyle-csharp-test-logging branch July 9, 2026 23:12
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)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@ptr727