feat: 移除基础依赖库,升级公共组件,并适配 .NET 6.0

This commit is contained in:
Fu Diwei
2021-11-09 15:23:23 +08:00
parent b11f6bb73b
commit acea1b477c
62 changed files with 149 additions and 221 deletions

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFrameworks>netcoreapp3.1; net6.0</TargetFrameworks>
<LangVersion>8.0</LangVersion>
</PropertyGroup>

View File

@@ -15,7 +15,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Ads.UnitTests
{
string rawData = "spidbff89d5138160943040012345678901234567890uFolxxiZbrZ/PRbyen5uK5D1kgIB2yHyDsfDGxxgeG";
string actualHash = Security.MD5Utility.Hash(rawData);
string actualHash = Utilities.MD5Utility.Hash(rawData);
string expectedHash = "32c03e8fcdb08e653e42805e302f70ed";
Assert.Equal(expectedHash, actualHash, ignoreCase: true);

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFrameworks>netcoreapp3.1; net6.0</TargetFrameworks>
<LangVersion>8.0</LangVersion>
</PropertyGroup>

View File

@@ -10,7 +10,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
{
string rawData = "jsapi_ticket=HoagFKDcsGMVCIY2vOjf9nGrZ3eaM0qXs5ROFN_3k_HrGc0VocemA6wMXkvrL-Ei4IitXxwKF62CJWR8mWXZ3Q&noncestr=e7b435f73835402da44f16640ddc8696&timestamp=1621348162&url=https://mp.weixin.qq.com/debug/cgi-bin/sandbox?t=jsapisign";
string actualHash = Security.SHA1Utility.Hash(rawData);
string actualHash = Utilities.SHA1Utility.Hash(rawData);
string expectedHash = "b214ea1f8ae019c207f8c6ffb843c8474cbab28c";
Assert.Equal(expectedHash, actualHash, ignoreCase: true);
@@ -22,7 +22,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
string secret = "zNLgAGgqsEWJOg1nFVaO5r7fAlIQxr1u";
string rawData = "appid=wx1234567&offer_id=12345678&openid=odkx20ENSNa2w5y3g_qOkOvBNM1g&pf=android&ts=1507530737&zone_id=1&org_loc=/cgi-bin/midas/getbalance&method=POST&secret=zNLgAGgqsEWJOg1nFVaO5r7fAlIQxr1u";
string actualHash = Security.HMACSHA256Utility.Hash(secret, rawData);
string actualHash = Utilities.HMACSHA256Utility.Hash(secret, rawData);
string expectedHash = "1ad64e8dcb2ec1dc486b7fdf01f4a15159fc623dc3422470e51cf6870734726b";
Assert.Equal(expectedHash, actualHash, ignoreCase: true);

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFrameworks>netcoreapp3.1; net6.0</TargetFrameworks>
<LangVersion>8.0</LangVersion>
</PropertyGroup>

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFrameworks>netcoreapp3.1; net6.0</TargetFrameworks>
<LangVersion>8.0</LangVersion>
</PropertyGroup>

View File

@@ -90,7 +90,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests
{
string rawData = "This is raw data string.";
string actualHash = Security.SHA256Utility.Hash(rawData);
string actualHash = Utilities.SHA256Utility.Hash(rawData);
string expectedHash = "5bd1e86d96a5ec138242ee3c743ea004bc8e215ef8ab72178133a6460034f216";
Assert.Equal(expectedHash, actualHash, ignoreCase: true);

View File

@@ -85,9 +85,9 @@ namespace SKIT.FlurlHttpClient.Wechat
if (name.EndsWith("Request"))
{
if (!typeof(IWechatRequest).IsAssignableFrom(modelType))
if (!typeof(ICommonRequest).IsAssignableFrom(modelType))
{
lstError.Add(new Exception($"`{name}` 类需实现自 `IWechatRequest`。"));
lstError.Add(new Exception($"`{name}` 类需实现自 `ICommonRequest`。"));
continue;
}
@@ -100,9 +100,9 @@ namespace SKIT.FlurlHttpClient.Wechat
if (name.EndsWith("Response"))
{
if (!typeof(IWechatResponse).IsAssignableFrom(modelType))
if (!typeof(ICommonResponse).IsAssignableFrom(modelType))
{
lstError.Add(new Exception($"`{name}` 类需实现自 `IWechatResponse`。"));
lstError.Add(new Exception($"`{name}` 类需实现自 `ICommonResponse`。"));
continue;
}
@@ -252,7 +252,7 @@ namespace SKIT.FlurlHttpClient.Wechat
.Where(e =>
e.IsPublic &&
e.IsStatic &&
typeof(IWechatClient).IsAssignableFrom(e.GetParameters().FirstOrDefault().ParameterType)
typeof(ICommonClient).IsAssignableFrom(e.GetParameters().FirstOrDefault().ParameterType)
)
.ToArray();
@@ -267,10 +267,10 @@ namespace SKIT.FlurlHttpClient.Wechat
continue;
}
// 第二个参数必为 IWechatRequest 子类
if (!typeof(IWechatRequest).IsAssignableFrom(lstParamInfo[1].ParameterType))
// 第二个参数必为 ICommonRequest 子类
if (!typeof(ICommonRequest).IsAssignableFrom(lstParamInfo[1].ParameterType))
{
lstError.Add(new Exception($"`{extType.Name}.{methodInfo.Name}` 方法第 1 个入参需实现自 `IWechatRequest`。"));
lstError.Add(new Exception($"`{extType.Name}.{methodInfo.Name}` 方法第 1 个入参需实现自 `ICommonRequest`。"));
continue;
}

View File

@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFrameworks>netcoreapp3.1; net6.0</TargetFrameworks>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\SKIT.FlurlHttpClient.Wechat\SKIT.FlurlHttpClient.Wechat.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="SKIT.FlurlHttpClient.Common" Version="2.0.0" />
</ItemGroup>
</Project>

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFrameworks>netcoreapp3.1; net6.0</TargetFrameworks>
<LangVersion>8.0</LangVersion>
</PropertyGroup>