Skip to content

10.0.0

Latest

Choose a tag to compare

@jhartmann123 jhartmann123 released this 25 Nov 12:39
· 4 commits to main since this release

Relase notes

Framework

This release of Fusonic.Extensions only supports .NET 10. Do not upgrade if you don't intend to use .NET 10.

Dropped libraries

The libraries

  • Fusonic.Extensions.UnitTests.ServiceProvider
  • Fusonic.Extensions.UnitTests.SimpleInjector

got dropped. Their extensions got moved to the parent project Fusonic.Extensions.UnitTests.
When using SimpleInjector, no transient build dependency is delivered with Fusonic.Extensions.UnitTests, so you must reference it yourselves.

Testing

Libraries related to testing received the biggest changes:

  • As FluentAssertions is not free anymore, we switched to its fork AwesomeAssertions
  • All XUnit extensions got migrated to XUnit v3. XUnit v2 is no longer supported.
  • As XUnit v3 now supports an single assembly-wide startup class, we moved to TestContainers for providing external services for testing, like a PostgreSQL database

XUnit migration

To migrate from XUnit v2 to XUnit v3, follow those steps:

Change the following NuGet references

  • Replace xunit with xunit.v3.mtp-v2 info
    • Alternative: Transient dependency via extensions (without xunit.v3.assert)
    • Alternative: Reference xunit.v3.core.mtp-v2 and xunit.analyzers for xunit without assertions
  • Add <OutputType>Exe</OutputType> in test projects
  • Replace coverlet.collector with Microsoft.Testing.Extensions.CodeCoverage -> MTP coverage
  • Add Microsoft.Testing.Extensions.TrxReport for test results in MR
  • When using FluentAssertions, consider migrating to AwesomeAssertions, as outlined below

Code changes

  • Add to TestBase.cs: public CancellationToken CancellationToken => TestContext.Current.CancellationToken; because of xUnit1051
    • Alternative: Supress warning by setting it to suggestion in .editorconfig
      • dotnet_diagnostic.xUnit1051.severity = suggestion # xUnit1051: Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken
  • Test database handling was simplified. Test database template creation is now intended to be done in the TestStartup of a test assembly.
    • Example
    • Documentation
    • TestStorageSettings don't exist anymore. Only connection strings are passed directly to the stores.
    • Call CreateTemplate in TestStartup

Pipeline

  • Remove include to fusonic/devops/images/gitlab-ci-tools/dotnet_test.yml
  • Remove dotnet:check-warnings and extends on .dotnet-test
  • Add test components:
include:
  - component: $CI_SERVER_FQDN/fusonic/devops/components/dotnet-test/dotnet-test@2.0.0
    inputs:
      sln-path: Extensions.slnx
  - component: $CI_SERVER_FQDN/fusonic/devops/components/dotnet-test/dotnet-check-warnings@2.0.0
    inputs:
      sln-path: Extensions.slnx

When you start to use TestContainers, ensure that docker:dind gets started with the tests:

dotnet:test:
  services:
    - docker:${DOCKER_VERSION}-dind-rootless

See .gitlab-ci.yml for an example.

AwesomeAssertions migration

The migration from FluentAssertions to AwesomeAssertions is pretty simple:

  • Remove packages FluentAssertions.*
  • Add AwesomeAssertions
  • Optionally add AwesomeAssertions.Analyzers
  • Globally search and replace FluentAssertions with AwesomeAssertions

The only breaking changes we experienced were renames like

  • GreaterOrEqualTo -> GreaterThanOrEqualTo
  • LowerOrEqualTo -> LowerThanOrEqualTo

TestContainers

For unit tests that require external services like databases we now utilize the test startup of XUnit v3, instead of relying on services running on local dev or the CI pipeline.

This simplifies the setup a bit, especially for local developers that now just can start the tests without having to start any other services beforehand.

Examples are documentend in the readme for the unit tests.

List of changes

Features ⭐

  • cop#97: XUnit v3 support

Improvements 💡

  • Added ServiceProvider support for Mediator
  • #60: Document DbContextFactory, added TestContainers
  • Moved DB template creation to TestStartup; Simplified test store

Routine work 🪛

  • Updated to .NET10
  • Migrate Solution to new slnx
  • Replaced FluentAssertions with AwesomeAssertions
  • Updated packages

Miscellaneous ❓

  • Updated .editorconfig with some new settings
  • Updated .editorconfig to include .csproj