From d5decbfd74f681e5c2bbd9934d0c34b1b6bed2b3 Mon Sep 17 00:00:00 2001 From: Romfos Date: Sat, 30 Nov 2024 14:00:48 +0100 Subject: [PATCH] Added .NET 9 to test matrix (#848) * Added .NET 9 to test matrix * Update changelog --- .github/workflows/release_documentation.yml | 3 +-- .github/workflows/release_packages.yml | 3 +-- .github/workflows/test.yml | 6 ++++-- CHANGELOG.md | 2 +- build/build.fs | 3 +-- build/build.fsproj | 8 ++++---- src/NSubstitute/Core/ThreadLocalContext.cs | 4 ++-- ...rmattingCallsWhenThrowingReceivedCallsExceptions.cs | 10 +++++----- .../NSubstitute.Acceptance.Specs.csproj | 4 ++-- 9 files changed, 21 insertions(+), 22 deletions(-) diff --git a/.github/workflows/release_documentation.yml b/.github/workflows/release_documentation.yml index 90bff66e..f379948e 100644 --- a/.github/workflows/release_documentation.yml +++ b/.github/workflows/release_documentation.yml @@ -12,8 +12,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: | - 8.0.x + dotnet-version: 9.0.x - name: Setup Ruby for documentation build uses: ruby/setup-ruby@v1 diff --git a/.github/workflows/release_packages.yml b/.github/workflows/release_packages.yml index 770e9859..1a8bf1eb 100644 --- a/.github/workflows/release_packages.yml +++ b/.github/workflows/release_packages.yml @@ -12,8 +12,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: | - 8.0.x + dotnet-version: 9.0.x - name: Build package run: dotnet pack src/NSubstitute/NSubstitute.csproj -p:CI=true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fb82bd71..3829d735 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: os: [windows-latest, ubuntu-latest, macOS-latest] - framework: [net8.0] + framework: [net9.0, net8.0] include: - os: windows-latest framework: net462 @@ -24,6 +24,7 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: | + 9.0.x 8.0.x - name: Build @@ -42,6 +43,7 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: | + 9.0.x 8.0.x # used for documentation @@ -63,7 +65,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.x + dotnet-version: 9.0.x - name: Format run: dotnet format --verify-no-changes \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 03288747..038590a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ * [UPDATE] Update github actions steps versions * [UPDATE] Remove legacy obsolete API * [UPDATE] Mark as obsolete api CompatArg with pre c# 7.0 support - +* [NEW] Added .NET 9 to test matrix ### 5.3.0 (October 2024) diff --git a/build/build.fs b/build/build.fs index 3d6250cc..e7c4b15f 100644 --- a/build/build.fs +++ b/build/build.fs @@ -1,7 +1,6 @@ open System open System.Diagnostics open System.IO -open System.Text.RegularExpressions open Fake.Core open Fake.Core.TargetOperators @@ -17,7 +16,7 @@ let description = Target.description module FileReaderWriter = let Read file = File.ReadAllText(file) - let Write file text = File.WriteAllText(file, text) + let Write file (text: string) = File.WriteAllText(file, text) let TransformFile file target (f : string -> string) = Read file |> f diff --git a/build/build.fsproj b/build/build.fsproj index 4f3604de..f46710b0 100644 --- a/build/build.fsproj +++ b/build/build.fsproj @@ -1,7 +1,7 @@  - net8.0 + net9.0 Exe buildOutput @@ -14,9 +14,9 @@ - - - + + + diff --git a/src/NSubstitute/Core/ThreadLocalContext.cs b/src/NSubstitute/Core/ThreadLocalContext.cs index 73e1100b..8120bb00 100644 --- a/src/NSubstitute/Core/ThreadLocalContext.cs +++ b/src/NSubstitute/Core/ThreadLocalContext.cs @@ -19,7 +19,7 @@ public class ThreadLocalContext : IThreadLocalContext public ThreadLocalContext() { _lastCallRouter = new RobustThreadLocal(); - _argumentSpecifications = new RobustThreadLocal>(() => new List()); + _argumentSpecifications = new RobustThreadLocal>(() => []); _getArgumentsForRaisingEvent = new RobustThreadLocal?>(); _currentQuery = new RobustThreadLocal(); _pendingSpecificationInfo = new RobustThreadLocal(); @@ -102,7 +102,7 @@ public IList DequeueAllArgumentSpecifications() } else { - _argumentSpecifications.Value = new List(); + _argumentSpecifications.Value = []; } return queue; diff --git a/tests/NSubstitute.Acceptance.Specs/FormattingCallsWhenThrowingReceivedCallsExceptions.cs b/tests/NSubstitute.Acceptance.Specs/FormattingCallsWhenThrowingReceivedCallsExceptions.cs index 70a72a0b..2ced7bfa 100644 --- a/tests/NSubstitute.Acceptance.Specs/FormattingCallsWhenThrowingReceivedCallsExceptions.cs +++ b/tests/NSubstitute.Acceptance.Specs/FormattingCallsWhenThrowingReceivedCallsExceptions.cs @@ -21,8 +21,8 @@ public class When_no_calls_are_made_to_the_expected_member : Context { protected override void ConfigureContext() { - Sample.AnotherMethod(new List()); - Sample.AnotherMethod(new List()); + Sample.AnotherMethod([]); + Sample.AnotherMethod([]); } protected override void ExpectedCall() @@ -67,12 +67,12 @@ public void Should_report_non_matching_calls() public class When_calls_have_been_made_to_expected_member_but_with_some_different_args : Context { - readonly IList _strings = new List { "a", "b" }; + readonly IList _strings = ["a", "b"]; protected override void ConfigureContext() { - Sample.SampleMethod("different", 1, new List()); - Sample.SampleMethod("string", 7, new List()); + Sample.SampleMethod("different", 1, []); + Sample.SampleMethod("string", 7, []); } protected override void ExpectedCall() diff --git a/tests/NSubstitute.Acceptance.Specs/NSubstitute.Acceptance.Specs.csproj b/tests/NSubstitute.Acceptance.Specs/NSubstitute.Acceptance.Specs.csproj index af32e4a7..83d6ee65 100644 --- a/tests/NSubstitute.Acceptance.Specs/NSubstitute.Acceptance.Specs.csproj +++ b/tests/NSubstitute.Acceptance.Specs/NSubstitute.Acceptance.Specs.csproj @@ -1,12 +1,12 @@  - net8.0;net462 + net9.0;net8.0;net462 - +