From 9091e98a66b330c468858ce854283b7c52db0bfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=9F=B3=E5=A4=B4?= Date: Mon, 18 Nov 2024 16:49:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E6=93=8D=E4=BD=9C=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E5=A4=9A=E8=BF=90=E8=A1=8C=E6=97=B6=E7=89=88=E6=9C=AC=E7=9F=A9?= =?UTF-8?q?=E9=98=B5=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test.yml | 13 +++++++++---- XUnitTest.Core/IO/CsvFileTests.cs | 2 +- XUnitTest.Core/Serialization/JsonTestBase.cs | 6 +++--- XUnitTest.Core/Web/JwtBuilderTests.cs | 2 ++ XUnitTest.Core/XUnitTest.Core.csproj | 2 +- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f4fce89b4..5f0e5cbec 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,21 +9,26 @@ on: jobs: test: - runs-on: windows-latest + runs-on: ${{ matrix.os }} strategy: matrix: - dotnet-version: [ '4.6.2', '5.x', '6.x', '7.x', '8.x', '9.x' ] + os: [ubuntu-latest, windows-latest, macos-latest] + target-framework: [ 'net6.0', 'net8.0', 'net9.0' ] steps: - uses: actions/checkout@v4 - name: Setup dotNET uses: actions/setup-dotnet@v4 with: - dotnet-version: ${{ matrix.dotnet-version }} + dotnet-version: | + 6.x + 7.x + 8.x + 9.x - name: Build run: | dotnet build -c Release - name: Test run: | - dotnet test + dotnet test -f ${{ matrix.target-framework }} diff --git a/XUnitTest.Core/IO/CsvFileTests.cs b/XUnitTest.Core/IO/CsvFileTests.cs index f2f699070..974c6f6cd 100644 --- a/XUnitTest.Core/IO/CsvFileTests.cs +++ b/XUnitTest.Core/IO/CsvFileTests.cs @@ -116,7 +116,7 @@ public void BigString() } var txt = ms.ToArray().ToStr(); - var lines = txt.Split(Environment.NewLine); + var lines = txt.Split([Environment.NewLine], StringSplitOptions.None); Assert.Equal(6, lines.Length); Assert.Equal("Code,Name,Enable,CreateTime", lines[0]); Assert.Equal($"1234,Stone,1,{((DateTime)list[0][3]).ToFullString()}", lines[1]); diff --git a/XUnitTest.Core/Serialization/JsonTestBase.cs b/XUnitTest.Core/Serialization/JsonTestBase.cs index 8c69c9f5c..19a09014a 100644 --- a/XUnitTest.Core/Serialization/JsonTestBase.cs +++ b/XUnitTest.Core/Serialization/JsonTestBase.cs @@ -62,7 +62,7 @@ protected void CheckModel(Model[] models) Assert.Equal("/uploader/swiperPic/405621836.jpg", m.AdImgUrl); Assert.Equal(typeof(NewLife.Common.PinYin), m.Type); Assert.Equal(DateTimeOffset.Parse("2022-11-29T14:13:17.8763881+08:00"), m.Offset); -#if NET6_0_OR_GREATER +#if NET7_0_OR_GREATER Assert.Equal(DateOnly.Parse("2022-11-29"), m.Date); Assert.Equal(TimeOnly.Parse("14:13:17.8763881"), m.Time); #endif @@ -81,7 +81,7 @@ protected void CheckModel(Model[] models) Assert.Equal("/uploader/swiperPic/1978468752.jpg", m.AdImgUrl); Assert.Equal(typeof(String), m.Type); Assert.Equal(DateTimeOffset.Parse("2022-11-29T14:13:17.8763881+08:00"), m.Offset); -#if NET6_0_OR_GREATER +#if NET7_0_OR_GREATER Assert.Equal(DateOnly.Parse("2022-11-29"), m.Date); Assert.Equal(TimeOnly.Parse("14:13:17.8763881"), m.Time); #endif @@ -101,7 +101,7 @@ protected class Model public String AdImgUrl { get; set; } public Type Type { get; set; } public DateTimeOffset Offset { get; set; } -#if NET6_0_OR_GREATER +#if NET7_0_OR_GREATER public DateOnly Date { get; set; } public TimeOnly Time { get; set; } #endif diff --git a/XUnitTest.Core/Web/JwtBuilderTests.cs b/XUnitTest.Core/Web/JwtBuilderTests.cs index 4167f3283..4b57e13c9 100644 --- a/XUnitTest.Core/Web/JwtBuilderTests.cs +++ b/XUnitTest.Core/Web/JwtBuilderTests.cs @@ -363,6 +363,7 @@ public void RS512() Assert.True(builder2["admin"].ToBoolean()); } +#if NETCOREAPP [Fact] public void ES256() { @@ -502,6 +503,7 @@ public void ES512() Assert.Equal("NewLife", builder2["name"]); Assert.True(builder2["admin"].ToBoolean()); } +#endif [Fact] public void Decode() diff --git a/XUnitTest.Core/XUnitTest.Core.csproj b/XUnitTest.Core/XUnitTest.Core.csproj index 922eee5be..8b3f4ad67 100644 --- a/XUnitTest.Core/XUnitTest.Core.csproj +++ b/XUnitTest.Core/XUnitTest.Core.csproj @@ -1,6 +1,6 @@  - net462;net5.0;net6.0;net7.0;net8.0;net9.0 + net462;net6.0;net8.0;net9.0 false XUnitTest pdbonly