test(tenpayv3): 完善关于加解密请求或响应模型中敏感信息字段的单元测试用例

This commit is contained in:
Fu Diwei
2023-01-18 23:28:56 +08:00
parent 6e66f988de
commit 65ed7eefd7
3 changed files with 1654 additions and 215 deletions

View File

@@ -10,33 +10,31 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests
{
await TestClients.InitializeCertificateManagerAsync();
var request = new Models.QueryCertificatesRequest() { AlgorithmType = "RSA" };
var response = await TestClients.InstanceUseRSA.ExecuteQueryCertificatesAsync(request);
var request1 = new Models.QueryCertificatesRequest() { AlgorithmType = "RSA" };
var response1 = await TestClients.InstanceUseRSA.ExecuteQueryCertificatesAsync(request1);
Assert.True(response1.RawStatus == 200);
Assert.True(response1.RawHeaders.Count > 0);
Assert.True(response1.RawBytes.Length > 0);
Assert.True(TestClients.InstanceUseRSA.VerifyResponseSignature(response1));
Assert.NotNull(response1.WechatpayRequestId);
Assert.NotNull(response1.WechatpayNonce);
Assert.NotNull(response1.WechatpayTimestamp);
Assert.NotNull(response1.WechatpaySignature);
Assert.NotNull(response1.WechatpaySignatureType);
Assert.NotNull(response1.WechatpayCertificateSerialNumber);
Assert.True(response.RawStatus == 200);
Assert.True(response.RawHeaders.Count > 0);
Assert.True(response.RawBytes.Length > 0);
Assert.True(TestClients.InstanceUseRSA.VerifyResponseSignature(response));
Assert.NotNull(response.WechatpayRequestId);
Assert.NotNull(response.WechatpayNonce);
Assert.NotNull(response.WechatpayTimestamp);
Assert.NotNull(response.WechatpaySignature);
Assert.NotNull(response.WechatpaySignatureType);
Assert.NotNull(response.WechatpayCertificateSerialNumber);
request = new Models.QueryCertificatesRequest() { AlgorithmType = "SM2" };
response = await TestClients.InstanceUseSM2.ExecuteQueryCertificatesAsync(request);
Assert.True(response.RawStatus == 200);
Assert.True(response.RawHeaders.Count > 0);
Assert.True(response.RawBytes.Length > 0);
Assert.True(TestClients.InstanceUseSM2.VerifyResponseSignature(response));
Assert.NotNull(response.WechatpayRequestId);
Assert.NotNull(response.WechatpayNonce);
Assert.NotNull(response.WechatpayTimestamp);
Assert.NotNull(response.WechatpaySignature);
Assert.NotNull(response.WechatpaySignatureType);
Assert.NotNull(response.WechatpayCertificateSerialNumber);
var request2 = new Models.QueryCertificatesRequest() { AlgorithmType = "SM2" };
var response2 = await TestClients.InstanceUseSM2.ExecuteQueryCertificatesAsync(request2);
Assert.True(response2.RawStatus == 200);
Assert.True(response2.RawHeaders.Count > 0);
Assert.True(response2.RawBytes.Length > 0);
Assert.True(TestClients.InstanceUseSM2.VerifyResponseSignature(response2));
Assert.NotNull(response2.WechatpayRequestId);
Assert.NotNull(response2.WechatpayNonce);
Assert.NotNull(response2.WechatpayTimestamp);
Assert.NotNull(response2.WechatpaySignature);
Assert.NotNull(response2.WechatpaySignatureType);
Assert.NotNull(response2.WechatpayCertificateSerialNumber);
}
}
}