From ee93a8dd9a4b4fad4eb1a9a2e11ae6e06bffaf8e Mon Sep 17 00:00:00 2001 From: Erik Zhang Date: Wed, 28 Dec 2022 05:32:32 +0800 Subject: [PATCH] .NET 7 (#2836) * .NET 7 * Fix UT --- .github/workflows/main.yml | 2 +- benchmarks/Neo.Benchmarks/Neo.Benchmarks.csproj | 2 +- src/Directory.Build.props | 2 +- src/Neo/Neo.csproj | 2 +- tests/Directory.Build.props | 8 ++++---- tests/Neo.UnitTests/Neo.UnitTests.csproj | 6 +++--- tests/Neo.UnitTests/SmartContract/UT_KeyBuilder.cs | 6 +++--- tests/Neo.UnitTests/Wallets/UT_KeyPair.cs | 5 +++-- 8 files changed, 17 insertions(+), 16 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fb71ca2890..05cc47a22f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,7 +6,7 @@ on: pull_request: env: - DOTNET_VERSION: 6.0.x + DOTNET_VERSION: 7.0.x jobs: diff --git a/benchmarks/Neo.Benchmarks/Neo.Benchmarks.csproj b/benchmarks/Neo.Benchmarks/Neo.Benchmarks.csproj index a97f47a304..12b6e861e4 100644 --- a/benchmarks/Neo.Benchmarks/Neo.Benchmarks.csproj +++ b/benchmarks/Neo.Benchmarks/Neo.Benchmarks.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net7.0 Neo enable false diff --git a/src/Directory.Build.props b/src/Directory.Build.props index c107e19bfa..6805999b7c 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -5,7 +5,7 @@ 2015-2022 The Neo Project 3.5.0 The Neo Project - net6.0 + net7.0 https://github.com/neo-project/neo MIT git diff --git a/src/Neo/Neo.csproj b/src/Neo/Neo.csproj index a671c484ad..09e05249e5 100644 --- a/src/Neo/Neo.csproj +++ b/src/Neo/Neo.csproj @@ -10,7 +10,7 @@ - + diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index 734a0f50c6..6b92aa5fae 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -2,15 +2,15 @@ - net6.0 + net7.0 false - - - + + + diff --git a/tests/Neo.UnitTests/Neo.UnitTests.csproj b/tests/Neo.UnitTests/Neo.UnitTests.csproj index b415956da2..c19e2d2a58 100644 --- a/tests/Neo.UnitTests/Neo.UnitTests.csproj +++ b/tests/Neo.UnitTests/Neo.UnitTests.csproj @@ -5,9 +5,9 @@ - - - + + + diff --git a/tests/Neo.UnitTests/SmartContract/UT_KeyBuilder.cs b/tests/Neo.UnitTests/SmartContract/UT_KeyBuilder.cs index 39c2018f25..84caf06144 100644 --- a/tests/Neo.UnitTests/SmartContract/UT_KeyBuilder.cs +++ b/tests/Neo.UnitTests/SmartContract/UT_KeyBuilder.cs @@ -6,7 +6,7 @@ namespace Neo.UnitTests.SmartContract [TestClass] public class UT_KeyBuilder { - private struct a + private struct A { public int x; } @@ -28,11 +28,11 @@ public void Test() Assert.AreEqual("010000000203040000000000000000000000000000000000000000", key.ToArray().ToHexString()); key = new KeyBuilder(1, 2); - key = key.Add(new a() { x = 123 }); + key = key.Add(new A() { x = 123 }); Assert.AreEqual("01000000027b000000", key.ToArray().ToHexString()); key = new KeyBuilder(1, 0); - key = key.AddBigEndian(new a() { x = 1 }); + key = key.AddBigEndian(new A() { x = 1 }); Assert.AreEqual("010000000000000001", key.ToArray().ToHexString()); } } diff --git a/tests/Neo.UnitTests/Wallets/UT_KeyPair.cs b/tests/Neo.UnitTests/Wallets/UT_KeyPair.cs index e14bb83fd7..5e5996ff0a 100644 --- a/tests/Neo.UnitTests/Wallets/UT_KeyPair.cs +++ b/tests/Neo.UnitTests/Wallets/UT_KeyPair.cs @@ -98,8 +98,9 @@ public void TestGetHashCode() { byte[] privateKey = { 0x01,0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}; - KeyPair keyPair = new KeyPair(privateKey); - keyPair.GetHashCode().Should().Be(1544360595); + KeyPair keyPair1 = new KeyPair(privateKey); + KeyPair keyPair2 = new KeyPair(privateKey); + keyPair1.GetHashCode().Should().Be(keyPair2.GetHashCode()); } [TestMethod]