mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-09-19 01:58:14 +08:00
style(wxapi): clean code
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using Xunit;
|
||||
using Xunit;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
{
|
||||
@@ -11,10 +10,10 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
string iv = "KEWv/gyiIwAfHvjrLeaX6w==";
|
||||
string key = "YZJqKnNFi0KAiKUc0ggC2g==";
|
||||
string cipherText = "Gu2PVnxVWl+jK4F8c0liGxfkB5Bj3m5HRvwgEIk1Yb+36RZ3Bg7YmUnud/ooiHz0PQroipsH7GCjlGwUeT04NwmrFaP1y3dRYPLpS43ed9QZWcFIFo+8vTs3Zco6S98DUvaNEAs8duhz/BzfBOZaIHMziRqEtPFI0ZDzCgJluBirJ6Wl3UkygZ5/QLo3KA53qGdip7K48Rq8XbCwuidTCw==";
|
||||
|
||||
|
||||
string expectedPlainData = "{\"phoneNumber\":\"186****5613\",\"purePhoneNumber\":\"186****5613\",\"countryCode\":\"86\",\"watermark\":{\"timestamp\":1634545675,\"appid\":\"wxc****17e87e0e0a7\"}}";
|
||||
string actualPlainData = Utilities.AESUtility.DecryptWithCBC(encodingKey: key, encodingIV: iv, encodingCipherText: cipherText);
|
||||
|
||||
|
||||
Assert.Equal(expectedPlainData, actualPlainData, ignoreCase: true);
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
|
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
|
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
|
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
@@ -35,7 +31,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
ToUserOpenId = TestConfigs.WechatOpenId,
|
||||
MessageType = "text",
|
||||
MessageContentForText = new Models.CgibinMessageMassPreviewRequest.Types.TextMessage()
|
||||
{
|
||||
{
|
||||
Content = "FAKE_CONTENT"
|
||||
},
|
||||
AccessToken = TestConfigs.WechatAccessToken
|
||||
|
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
@@ -18,9 +14,9 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
ExpiresIn = 30,
|
||||
ActionType = "QR_STR_SCENE",
|
||||
Action = new Models.CgibinQrcodeCreateRequest.Types.Action()
|
||||
{
|
||||
{
|
||||
Scene = new Models.CgibinQrcodeCreateRequest.Types.Action.Types.Scene()
|
||||
{
|
||||
{
|
||||
SceneString = "FAKE_SCENESTR"
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
@@ -15,9 +12,9 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
var request = new Models.CgibinTagsCreateRequest()
|
||||
{
|
||||
AccessToken = TestConfigs.WechatAccessToken,
|
||||
Tag = new Models.CgibinTagsCreateRequest.Types.Tag()
|
||||
{
|
||||
Name = "FAKE_TAGNAME"
|
||||
Tag = new Models.CgibinTagsCreateRequest.Types.Tag()
|
||||
{
|
||||
Name = "FAKE_TAGNAME"
|
||||
}
|
||||
};
|
||||
var response = await TestClients.Instance.ExecuteCgibinTagsCreateAsync(request);
|
||||
|
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
|
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
@@ -20,7 +17,6 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
var response = await TestClients.Instance.ExecuteCgibinUserInfoAsync(request);
|
||||
|
||||
Assert.NotEmpty(response.OpenId);
|
||||
Assert.NotEmpty(response.Nickname);
|
||||
Assert.True(response.IsSubscribed);
|
||||
}
|
||||
|
||||
@@ -30,8 +26,8 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
var request = new Models.CgibinUserInfoBatchGetRequest()
|
||||
{
|
||||
AccessToken = TestConfigs.WechatAccessToken,
|
||||
UserList = new Models.CgibinUserInfoBatchGetRequest.Types.User[]
|
||||
{
|
||||
UserList = new Models.CgibinUserInfoBatchGetRequest.Types.User[]
|
||||
{
|
||||
new Models.CgibinUserInfoBatchGetRequest.Types.User() { OpenId = TestConfigs.WechatOpenId }
|
||||
}
|
||||
};
|
||||
@@ -39,7 +35,6 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
|
||||
Assert.NotEmpty(response.UserList);
|
||||
Assert.NotEmpty(response.UserList.First().OpenId);
|
||||
Assert.NotEmpty(response.UserList.First().Nickname);
|
||||
Assert.True(response.UserList.First().IsSubscribed);
|
||||
}
|
||||
|
||||
|
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
|
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
|
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
@@ -34,7 +31,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
Assert.NotNull(response.AccessToken);
|
||||
Assert.NotNull(response.RefreshToken);
|
||||
}
|
||||
|
||||
|
||||
[Fact(DisplayName = "测试用例:调用 API [GET] /sns/jscode2session")]
|
||||
public async Task TestExecuteSnsJsCode2Session()
|
||||
{
|
||||
|
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
|
@@ -1,10 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
|
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
@@ -13,7 +9,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
public async Task TestDeliveryRequestSignature()
|
||||
{
|
||||
var client = new WechatApiClient(new WechatApiClientOptions()
|
||||
{
|
||||
{
|
||||
AppId = "",
|
||||
AppSecret = "",
|
||||
ImmeDeliveryAppKey = "test_shop_id",
|
||||
|
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.Linq;
|
||||
using Xunit;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
|
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
using Xunit;
|
||||
using Xunit;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
{
|
||||
|
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using Xunit;
|
||||
using Xunit;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
{
|
||||
|
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
@@ -13,7 +9,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
public async Task TestMidasRequestSignature()
|
||||
{
|
||||
var client = new WechatApiClient(new WechatApiClientOptions()
|
||||
{
|
||||
{
|
||||
AppId = "wx1234567",
|
||||
AppSecret = "",
|
||||
MidasAppKey = "zNLgAGgqsEWJOg1nFVaO5r7fAlIQxr1u"
|
||||
|
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using Xunit;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
{
|
||||
|
@@ -1,15 +1,13 @@
|
||||
using System;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
{
|
||||
class TestClients
|
||||
internal class TestClients
|
||||
{
|
||||
static TestClients()
|
||||
{
|
||||
Instance = new WechatApiClient(new WechatApiClientOptions()
|
||||
{
|
||||
{
|
||||
AppId = TestConfigs.WechatAppId,
|
||||
AppSecret = TestConfigs.WechatAppSecret
|
||||
AppSecret = TestConfigs.WechatAppSecret
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -4,7 +4,7 @@ using System.Text.Json;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.UnitTests
|
||||
{
|
||||
class TestConfigs
|
||||
internal class TestConfigs
|
||||
{
|
||||
static TestConfigs()
|
||||
{
|
||||
|
Reference in New Issue
Block a user