diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..2913f42 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,35 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [10.0.0] - 2025-11-15 + +### Breaking Changes +- **Upgraded to .NET 10.0** - This version targets `net10.0` exclusively +- **Dropped support for all previous .NET versions** - .NET 9.0, 8.0, and earlier are no longer supported +- Users must upgrade to .NET 10.0 SDK to use this version + +### Changed +- Updated all Microsoft.Extensions.* packages from 9.0.10 to 10.0.0 +- Updated xUnit packages from 3.1.0 to 3.2.0 +- Updated Microsoft.NET.Test.Sdk from 18.0.0 to 18.0.1 +- Updated Azure DevOps build pipelines to use .NET 10.0.100 SDK + +### Fixed +- Fixed lambda parameter naming conflict with C# `scoped` keyword in example tests + +### Migration Guide +To migrate from version 9.x to 10.0.0: +1. Install .NET 10.0 SDK on your development machine +2. Update your project's `TargetFramework` to `net10.0` +3. Update package reference to version 10.0.0 or later: + ```xml + + ``` +4. Rebuild and test your project + +## [9.2.2] - Previous Release +- See git history for changes prior to version 10.0.0 diff --git a/Directory.Packages.props b/Directory.Packages.props index d6a8c27..16de102 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,23 +5,23 @@ - - - - - - - - - - + + + + + + + + + + - - + + - + \ No newline at end of file diff --git a/README.md b/README.md index fd2d97e..4cdf631 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ![Nuget](https://img.shields.io/nuget/v/Xunit.Microsoft.DependencyInjection) ![Nuget](https://img.shields.io/nuget/dt/Xunit.Microsoft.DependencyInjection) -# Xunit Dependency Injection framework - .NET 9.0 +# Xunit Dependency Injection framework - .NET 10.0 Xunit does not support any built-in dependency injection features, therefore developers have to come up with a solution to recruit their favourite dependency injection framework in their tests. @@ -15,7 +15,7 @@ This library brings **Microsoft's dependency injection container** to Xunit by l ## ✨ Key Features - 🎯 **Multiple injection patterns** - Choose the approach that fits your team's style -- 🔑 **Keyed services support** - Full .NET 9.0 keyed services integration +- 🔑 **Keyed services support** - Full .NET 10.0 keyed services integration - ⚙️ **Configuration integration** - Support for `appsettings.json`, user secrets, and environment variables - 🧪 **Service lifetime management** - Transient, Scoped, and Singleton services work as expected - 📦 **Microsoft.Extensions ecosystem** - Built on the same DI container used by ASP.NET Core @@ -26,13 +26,14 @@ This library brings **Microsoft's dependency injection container** to Xunit by l * For **xUnit** packages use Xunit.Microsoft.DependencyInjection versions **up to** 9.0.5 * For **xUnit.v3** packages use Xunit.Microsoft.DependencyInjection versions **from** 9.1.0 +* For **.NET 10.0** use Xunit.Microsoft.DependencyInjection version **10.0.0 or later** Also please check the [migration guide](https://xunit.net/docs/getting-started/v3/migration) from xUnit for test authors. ### Example on how to reference xunit.v3 ```xml - + ``` ## Getting started @@ -40,7 +41,7 @@ Also please check the [migration guide](https://xunit.net/docs/getting-started/v ### Prerequisites Before you begin, ensure you have: -- **.NET 9.0 SDK** installed on your development machine +- **.NET 10.0 SDK** installed on your development machine - **Visual Studio 2022** or **Visual Studio Code** with C# extension - Basic understanding of dependency injection concepts - Familiarity with xUnit testing framework diff --git a/azure-pipeline-PR.yml b/azure-pipeline-PR.yml index 66263a5..1c51d44 100644 --- a/azure-pipeline-PR.yml +++ b/azure-pipeline-PR.yml @@ -1,5 +1,5 @@ variables: - Major: 9 + Major: 10 Minor: 0 Patch: 0 BuildConfiguration: Release @@ -14,10 +14,10 @@ pool: steps: - script: echo Build Number $(name) - task: UseDotNet@2 - displayName: 'Use .NET 9.0 sdk' + displayName: 'Use .NET 10.0 sdk' inputs: packageType: sdk - version: 9.0.306 + version: 10.0.100 installationPath: $(Agent.ToolsDirectory)/dotnet - script: echo Started restoring the source code - task: DotNetCoreCLI@2 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 290cd5b..a5b6364 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,7 +1,7 @@ variables: - Major: 9 - Minor: 2 - Revision: 2 + Major: 10 + Minor: 0 + Revision: 0 BuildConfiguration: Release name: $(Major).$(Minor).$(Revision) @@ -22,10 +22,10 @@ pool: steps: - script: echo Build Number $(name) - task: UseDotNet@2 - displayName: 'Use .NET 9.0 sdk' + displayName: 'Use .NET 10.0 sdk' inputs: packageType: sdk - version: 9.0.306 + version: 10.0.100 installationPath: $(Agent.ToolsDirectory)/dotnet - script: echo Started restoring the source code - task: DotNetCoreCLI@2 diff --git a/examples/Xunit.Microsoft.DependencyInjection.ExampleTests/AdvancedDependencyInjectionTests.cs b/examples/Xunit.Microsoft.DependencyInjection.ExampleTests/AdvancedDependencyInjectionTests.cs index 41de463..fbddbc7 100644 --- a/examples/Xunit.Microsoft.DependencyInjection.ExampleTests/AdvancedDependencyInjectionTests.cs +++ b/examples/Xunit.Microsoft.DependencyInjection.ExampleTests/AdvancedDependencyInjectionTests.cs @@ -177,12 +177,12 @@ public void TestComplexFuncPatternWithMultipleServices() { // Arrange - Create a complex function that uses multiple services Func complexOperation = - (scoped, singleton, calc) => + (scopedSvc, singletonSvc, calc) => { - scoped.Increment(); - singleton.IncrementGlobal(); - return $"Scoped: {scoped.InstanceId}, Singleton: {singleton.InstanceId}, " + - $"ScopedCounter: {scoped.Counter}, GlobalCounter: {singleton.GlobalCounter}"; + scopedSvc.Increment(); + singletonSvc.IncrementGlobal(); + return $"Scoped: {scopedSvc.InstanceId}, Singleton: {singletonSvc.InstanceId}, " + + $"ScopedCounter: {scopedSvc.Counter}, GlobalCounter: {singletonSvc.GlobalCounter}"; }; // Act - Execute complex operation diff --git a/examples/Xunit.Microsoft.DependencyInjection.ExampleTests/Xunit.Microsoft.DependencyInjection.ExampleTests.csproj b/examples/Xunit.Microsoft.DependencyInjection.ExampleTests/Xunit.Microsoft.DependencyInjection.ExampleTests.csproj index 6e9ec25..371fa70 100644 --- a/examples/Xunit.Microsoft.DependencyInjection.ExampleTests/Xunit.Microsoft.DependencyInjection.ExampleTests.csproj +++ b/examples/Xunit.Microsoft.DependencyInjection.ExampleTests/Xunit.Microsoft.DependencyInjection.ExampleTests.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 latest false enable diff --git a/src/Xunit.Microsoft.DependencyInjection.csproj b/src/Xunit.Microsoft.DependencyInjection.csproj index 4aecafa..e047a27 100644 --- a/src/Xunit.Microsoft.DependencyInjection.csproj +++ b/src/Xunit.Microsoft.DependencyInjection.csproj @@ -1,12 +1,12 @@  - net9.0 + net10.0 latest enable enable - 9.2.2 + 10.0.0 Xunit.Microsoft.DependencyInjection