From 594003b7d5a8808d176e6ad0777b3229d51ba3a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Tegn=C3=A9r?= Date: Thu, 22 Jan 2026 14:45:02 +0100 Subject: [PATCH 1/2] Updated Test project to target net4.8. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Johannes Tegnér --- Personnummer.Tests/CoordinationNumberTests.cs | 4 ++-- Personnummer.Tests/Personnummer.Tests.csproj | 7 ++++++- Personnummer.Tests/PersonnummerTests.cs | 2 +- Personnummer.Tests/TestTimeProvider.cs | 4 ++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Personnummer.Tests/CoordinationNumberTests.cs b/Personnummer.Tests/CoordinationNumberTests.cs index 9566735..81235f4 100644 --- a/Personnummer.Tests/CoordinationNumberTests.cs +++ b/Personnummer.Tests/CoordinationNumberTests.cs @@ -196,7 +196,7 @@ public void TestMaleFemale(PersonnummerData ssn) [ClassData(typeof(ValidCnDataProvider))] public void TestSeparator(PersonnummerData ssn) { - string sep = ssn.SeparatedFormat.Contains('+') ? "+" : "-"; + string sep = ssn.SeparatedFormat.Contains("+") ? "+" : "-"; Assert.Equal(sep, Personnummer.Parse(ssn.LongFormat, new Personnummer.Options { AllowCoordinationNumber = true }).Separator); Assert.Equal(sep, Personnummer.Parse(ssn.SeparatedLong, new Personnummer.Options { AllowCoordinationNumber = true }).Separator); Assert.Equal(sep, Personnummer.Parse(ssn.SeparatedFormat, new Personnummer.Options { AllowCoordinationNumber = true }).Separator); @@ -227,7 +227,7 @@ public void TestIgnoreSeparatorWhenFormatting(PersonnummerData ssn) [ClassData(typeof(ValidCnDataProvider))] public void TestDateCn(PersonnummerData data) { - var expect = data.LongFormat[..4]; + var expect = data.LongFormat.Substring(0, 4); expect += data.LongFormat.Substring(4, 2); expect += (int.Parse(data.LongFormat.Substring(6, 2)) - 60).ToString("00"); diff --git a/Personnummer.Tests/Personnummer.Tests.csproj b/Personnummer.Tests/Personnummer.Tests.csproj index 14abb66..038aa0d 100644 --- a/Personnummer.Tests/Personnummer.Tests.csproj +++ b/Personnummer.Tests/Personnummer.Tests.csproj @@ -6,7 +6,7 @@ latestmajor - net10.0;net8.0;net9.0 + net48;net10.0;net8.0;net9.0 @@ -18,6 +18,11 @@ + + + + + diff --git a/Personnummer.Tests/PersonnummerTests.cs b/Personnummer.Tests/PersonnummerTests.cs index de5bde3..761a6ac 100644 --- a/Personnummer.Tests/PersonnummerTests.cs +++ b/Personnummer.Tests/PersonnummerTests.cs @@ -169,7 +169,7 @@ public void TestMaleFemale(PersonnummerData ssn) [ClassData(typeof(ValidSsnDataProvider))] public void TestSeparator(PersonnummerData ssn) { - string sep = ssn.SeparatedFormat.Contains('+') ? "+" : "-"; + string sep = ssn.SeparatedFormat.Contains("+") ? "+" : "-"; Assert.Equal(sep, Personnummer.Parse(ssn.LongFormat, new Personnummer.Options { AllowCoordinationNumber = true }).Separator); Assert.Equal(sep, Personnummer.Parse(ssn.SeparatedLong, new Personnummer.Options { AllowCoordinationNumber = true }).Separator); Assert.Equal(sep, Personnummer.Parse(ssn.SeparatedFormat, new Personnummer.Options { AllowCoordinationNumber = true }).Separator); diff --git a/Personnummer.Tests/TestTimeProvider.cs b/Personnummer.Tests/TestTimeProvider.cs index e003612..8e70ea5 100644 --- a/Personnummer.Tests/TestTimeProvider.cs +++ b/Personnummer.Tests/TestTimeProvider.cs @@ -14,8 +14,8 @@ namespace Personnummer.Tests; public class TestTimeProvider : TimeProvider { internal DateTimeOffset Now { get; set; } = new( - new DateOnly(2025, 1, 1), - new TimeOnly(0, 0, 0, 1), + 2025, 1, 1, + 0, 0, 0, 1, TimeSpan.Zero ); From f332575300c0b7895a73e13cbfcfdc0a121dfe6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Tegn=C3=A9r?= Date: Thu, 22 Jan 2026 14:45:24 +0100 Subject: [PATCH 2/2] Updated workflow to run jobs parallel for net and added netfx test. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Johannes Tegnér --- .github/workflows/csharp.yml | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/.github/workflows/csharp.yml b/.github/workflows/csharp.yml index cb785e0..6333c28 100644 --- a/.github/workflows/csharp.yml +++ b/.github/workflows/csharp.yml @@ -7,20 +7,35 @@ on: pull_request: jobs: - test: + test-fx: + runs-on: windows-latest + steps: + - name: Checkout code + uses: actions/checkout@v6 + - name: Set up dotnet ${{ matrix.version }}. + uses: actions/setup-dotnet@v5 + with: + dotnet-version: "10.0.x" + - name: Build + run: dotnet build --framework net48 + - name: Run test suite + run: dotnet test --framework net48 + test-net: + strategy: + matrix: + version: + - "8.0" + - "9.0" + - "10.0" runs-on: ubuntu-latest name: Test dotnet steps: - uses: actions/checkout@v6 - - name: Set up dotnet 8. - uses: actions/setup-dotnet@v5 - with: - dotnet-version: '8.0.x' - - name: Set up dotnet 10. + - name: Set up dotnet ${{ matrix.version }}. uses: actions/setup-dotnet@v5 with: - dotnet-version: '10.0.x' + dotnet-version: "${{ matrix.version }}.x" - name: Build - run: dotnet build + run: dotnet build --framework net${{ matrix.version }} - name: Run test suite - run: dotnet test + run: dotnet test --framework net${{ matrix.version }}