Skip to content

Fluent Assertions 8 compatibility#37

Open
drew-cooper wants to merge 7 commits into
fluentassertions:mainfrom
drew-cooper:fa8-compatibility
Open

Fluent Assertions 8 compatibility#37
drew-cooper wants to merge 7 commits into
fluentassertions:mainfrom
drew-cooper:fa8-compatibility

Conversation

@drew-cooper

Copy link
Copy Markdown
Contributor

Summary

Resolves issue #36

  • Phase 1: Update TargetFrameworks to match FA8 (net47;net6.0;netstandard2.0;netstandard2.1), drop EOL net5.0/netcoreapp3.1/net472/net48; bump FluentAssertions 6.5.0 → 8.10.0, Autofac 6.3.0 → 7.1.0 (last version supporting netstandard2.0), GitVersion.MsBuild 5.8.1 → 6.0.2; update SDK floor to 8.0.100; bump all test package versions.
  • Phase 2: Thread AssertionChain through all assertion classes — FA8 changed ReferenceTypeAssertions to require it in the constructor. Entry points use AssertionChain.GetOrCreate(); child objects receive CurrentAssertionChain. Replace the removed Execute.Assertion API in ResolveAssertions and BuilderAssertions.
  • Phase 3: Set next-version: 8.0.0 in GitVersion.yml; add fallback <Version>8.0.0-pre.1</Version> for local builds where GitVersion cannot run.

Test plan

  • dotnet build FluentAssertions.Autofac/FluentAssertions.Autofac.csproj -f net6.0 — succeeds
  • dotnet test FluentAssertions.Autofac.Tests/FluentAssertions.Autofac.Tests.csproj — 39 passed
  • dotnet test SampleLib/SampleLib.csproj — 6 passed
  • Verify NuGet package version metadata shows 8.0.0-pre.1 (or GitVersion-derived equivalent)

🤖 Generated with Claude Code

drew-cooper and others added 7 commits July 10, 2026 13:31
- Update TargetFrameworks to match FA8: net47;net6.0;netstandard2.0;netstandard2.1
  (drop EOL net5.0, netcoreapp3.1, net472, net48)
- Bump FluentAssertions 6.5.0 → 8.10.0
- Bump Autofac 6.3.0 → 7.1.0 (last version supporting netstandard2.0)
- Bump GitVersion.MsBuild 5.8.1 → 6.0.2
- Update test/sample projects to net8.0, bump all test package versions
- Update global.json SDK floor to 8.0.100
- Update CI workflow: actions v4, Java 21, .NET 8/9 SDKs
- Update copyright year to 2026

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
FA8 changed ReferenceTypeAssertions to require an AssertionChain parameter.
All assertion classes and their constructors are updated accordingly:

- All classes: add AssertionChain assertionChain to constructor, pass to base(subject, assertionChain)
- All factory methods (Have, Resolve, Registered, etc.): pass CurrentAssertionChain to child assertion objects
- AutofacAssertionExtensions: entry points use AssertionChain.GetOrCreate()
- ResolveAssertions: replace Execute.Assertion (removed in FA8) with CurrentAssertionChain
- BuilderAssertions: same Execute.Assertion replacement
- TypeScanningAssertions: thread chain through Where/Except; replace Subject.Should().Have() with
  direct constructor call to avoid creating a secondary chain
- Update test/sample TargetFramework to net10.0 to match installed runtime

All 45 tests pass (39 unit + 6 sample).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Set next-version: 8.0.0 in GitVersion.yml so CI targets 8.0.0 series
- Add fallback <Version>8.0.0-pre.1</Version> to solution.targets for
  local/sandbox builds where GitVersion cannot run (CI overrides this)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
global.json floors the SDK at 8.0.100, so the runner installs .NET 8
and only has the .NET 8 runtime. The _build.exe was compiled for net6.0
which is not present, causing the CI run to fail immediately.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Nuke 6.x uses BinaryFormatter for deep-cloning tool settings objects
(SettingsEntityExtensions.NewInstance). BinaryFormatter is permanently
disabled in .NET 8, causing a NotSupportedException the moment any
.SetXxx() fluent call is made on a settings object.

Nuke 7+ rewrote settings cloning without BinaryFormatter.

Changes:
- Bump Nuke.Common 6.0.1 → 8.1.4
- Bump GitVersion.Tool download 5.8.1 → 6.0.2 (match MsBuild task)
- Remove [CheckBuildProjectConfigurations] (removed in Nuke 7)
- Fix DeleteDirectory: static FileSystemTasks call → AbsolutePath extension

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
windows-latest does not have .NET 10; use net8.0 which is pre-installed.
Also align the Framework constant in Build.cs to net8.0 so dotnet test
--framework matches the test project's TFM.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
GitVersion.MsBuild 6.0.2 only ships net6.0/net8.0 tool binaries; building
netstandard2.0, netstandard2.1, and net47 TFMs fails with MSB3073 because
tools/<tfm>/gitversion.dll doesn't exist. The Nuke build already injects
version properties via --property:AssemblyVersion etc., so the package
reference is redundant.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant