Skip to content

Upgrade to xUnit v3 4.0.0, add core specimen generators, and overhaul documentation - #56

Merged
perkops merged 6 commits into
mainfrom
feature/nuget-update
Aug 24, 2026
Merged

Upgrade to xUnit v3 4.0.0, add core specimen generators, and overhaul documentation#56
perkops merged 6 commits into
mainfrom
feature/nuget-update

Conversation

@davidkallesen

@davidkallesen davidkallesen commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Package upgrades

  • xunit.v3.extensibility.core 3.2.2 → 4.0.0 (and xunit.v3 4.0.0 in the test project)
  • NSubstitute 5.3.0 → 6.2.0
  • AwesomeAssertions 9.4.0 → 9.6.0
  • Microsoft.NET.Test.Sdk 18.6.0 → 18.9.0
  • Microsoft.SourceLink.GitHub 10.0.300 → 10.0.400
  • Meziantou.Analyzer 3.0.104 → 3.0.177, SonarAnalyzer.CSharp 10.27 → 10.32

NU1608

AutoFixture.AutoNSubstitute 4.18.1 declares NSubstitute (>= 2.0.3 && < 6.0.0), so
resolving NSubstitute 6.2.0 raises NU1608. The used API surface is compatible, so the
warning is suppressed — but scoped to the resolved NSubstitute reference rather
than suppressed globally, with an inline comment recording the condition for removal
(an AutoFixture release declaring NSubstitute 6 support). The build is warning-free.

New specimen generators

Three types that previously either failed to generate or produced unusable values:

  • TimeOnlyGenerator — derives from a generated DateTime
  • UriGenerator — deterministic, readable absolute URIs with sanitised segments
  • TimeProviderGenerator — a fixed provider with a stable GetUtcNow() and UTC
    local zone, making [Frozen] TimeProvider a practical way to pin the clock

Covered by new tests in CustomizationsTests.

Documentation

  • README restructured around onboarding: a 30-second before/after example now
    leads, followed by a cheat sheet, common recipes, a built-in specimen support
    table, and a troubleshooting FAQ. The rationale sections were demoted rather than
    removed.
  • New docs/working-with.md: long-form guide covering the four data attributes,
    [Frozen] semantics (including exact-type promotion and the deliberate
    non-promotion across interfaces), [AutoRegister], the FixtureFactory pipeline,
    and the helper extensions. Kept separate so the README stays onboarding-first.
  • Documented three behaviours that existed in code but nowhere in the docs:
    AddTimeout's debugger bypass, AwaitTasks, and CompareDateTimeUsingCloseTo's
    1000 ms default and overload shapes.
  • Added missing XML docs to AutoRegisterAttribute and ImmutableObjectCustomization;
    fixed a typo in StringExtensions.

@davidkallesen
davidkallesen requested a review from perkops August 24, 2026 07:02
@davidkallesen
davidkallesen force-pushed the feature/nuget-update branch 2 times, most recently from 7b08640 to 938bc15 Compare August 24, 2026 07:05
- Updated xunit.v3 from 3.2.2 to 4.0.0 in test project
- Updated xunit.v3.extensibility.core from 3.2.2 to 4.0.0 in src project
- Suppressed NU1608 warning for AutoFixture.AutoNSubstitute dependency constraint
  (AutoFixture.AutoNSubstitute 4.18.1 hasn't officially declared NSubstitute 6.x
  support but they are compatible in practice)
- Updated README.md to reflect new xunit version in installation example
- Applied editor config formatting updates
Extends the built-in specimen coverage of FixtureFactory with three
generators following the existing [AutoRegister] + ISpecimenBuilder
pattern, so they are discovered automatically with no user action.

- TimeOnlyGenerator: mirrors DateOnlyGenerator via TimeOnly.FromDateTime,
  closing the gap where DateOnly was supported but its sibling was not
- UriGenerator: produces readable absolute URIs on the reserved
  example.org domain instead of AutoFixture's noisy defaults, improving
  assertion failure messages
- TimeProviderGenerator: returns a fixed provider reporting a stable
  fixture-generated UTC instant with LocalTimeZone set to UTC, making
  time-dependent code deterministic and enabling [Frozen] TimeProvider
  to share one instant between the SUT and the assertions

No new package dependencies were taken; the fixed provider is internal
rather than depending on Microsoft.Extensions.TimeProvider.Testing, to
keep the core package dependency-light.

Also fixes a copy-paste error in the DateOnlyGenerator XML summary,
which incorrectly read "has not been canceled".

Adds 5 tests to CustomizationsTests, including coverage of frozen
TimeProvider reuse and Uri uniqueness.
Documents AutoRegisterAttribute (contract, discovery, example) and
ImmutableObjectCustomization (rationale, supported types), and fixes a
typo in StringExtensions.

Narrows NU1608 from a solution-wide NoWarn to a scoped PackageReference
on NSubstitute, with a documented removal trigger, so future constraint
violations are not hidden.
Leads with a 30-second before/after example and demotes the rationale
below the usage content, so a new user sees the payoff first.

Adds a cheat sheet, common recipes, a built-in specimen support table,
a troubleshooting/FAQ section and a version compatibility table, and
rewrites the table of contents to match.
…behaviour

Add docs/working-with.md, a long-form companion to the README covering the
four data attributes, [Frozen] semantics (including exact-type promotion and
the deliberate non-promotion across interfaces), [AutoRegister] discovery and
its constraints, the FixtureFactory customization pipeline, and the helper
extensions.
@perkops
perkops merged commit 12fb363 into main Aug 24, 2026
3 checks passed
@perkops
perkops deleted the feature/nuget-update branch August 24, 2026 07:47
Sign up for free to 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