mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-07-19 07:29:12 +08:00
test(tenpayv2): 补充发起退款接口的单元测试用例
This commit is contained in:
parent
ad9c8dab8d
commit
ba9665f62e
1
test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/.gitignore
vendored
Normal file
1
test/SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
appsettings.local.json
|
@ -7,7 +7,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests
|
|||||||
public class TestCase_ApiExecuteExecutePayTransactionsTests
|
public class TestCase_ApiExecuteExecutePayTransactionsTests
|
||||||
{
|
{
|
||||||
[Fact(DisplayName = "测试用例:调用 API [POST] /pay/micropay")]
|
[Fact(DisplayName = "测试用例:调用 API [POST] /pay/micropay")]
|
||||||
public async Task TestCase_ApiExecuteExecutePayTests()
|
public async Task TestCase_ApiExecuteExecuteCreatePayMicroPayTests()
|
||||||
{
|
{
|
||||||
var request = new Models.CreatePayMicroPayRequest()
|
var request = new Models.CreatePayMicroPayRequest()
|
||||||
{
|
{
|
||||||
@ -23,5 +23,23 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests
|
|||||||
Assert.NotNull(response.ReturnMessage);
|
Assert.NotNull(response.ReturnMessage);
|
||||||
Assert.NotNull(response.TransactionId);
|
Assert.NotNull(response.TransactionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact(DisplayName = "测试用例:调用 API [POST] /secapi/pay/refund")]
|
||||||
|
public async Task TestCase_ApiExecuteCreatePayRefundTests()
|
||||||
|
{
|
||||||
|
var request = new Models.CreatePayRefundRequest()
|
||||||
|
{
|
||||||
|
OutTradeNumber = "TSET_OUTTRADENO",
|
||||||
|
OutRefundNumber = "TEST_OTN_" + DateTimeOffset.Now.ToString("yyyyMMddHHmmssfff"),
|
||||||
|
TotalFee = 1,
|
||||||
|
RefundFee = 1,
|
||||||
|
Description = "TEST_DESC"
|
||||||
|
};
|
||||||
|
var response = await TestClients.Instance.ExecuteCreatePayRefundAsync(request);
|
||||||
|
|
||||||
|
Assert.NotNull(response.ReturnCode);
|
||||||
|
Assert.NotNull(response.ReturnMessage);
|
||||||
|
Assert.NotNull(response.RefundId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
{
|
{
|
||||||
MerchantId = TestConfigs.WechatMerchantId,
|
MerchantId = TestConfigs.WechatMerchantId,
|
||||||
MerchantSecret = TestConfigs.WechatMerchantSecret,
|
MerchantSecret = TestConfigs.WechatMerchantSecret,
|
||||||
|
MerchantCertificateBytes = TestConfigs.WechatMerchantCertificateBytes,
|
||||||
AppId = TestConfigs.WechatAppId
|
AppId = TestConfigs.WechatAppId
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests
|
|||||||
WechatAppId = config.GetProperty("AppId").GetString()!;
|
WechatAppId = config.GetProperty("AppId").GetString()!;
|
||||||
WechatMerchantId = config.GetProperty("MerchantId").GetString()!;
|
WechatMerchantId = config.GetProperty("MerchantId").GetString()!;
|
||||||
WechatMerchantSecret = config.GetProperty("MerchantSecret").GetString()!;
|
WechatMerchantSecret = config.GetProperty("MerchantSecret").GetString()!;
|
||||||
|
WechatMerchantCertificateBytes = config.GetProperty("MerchantCertificateBase64String").GetBytesFromBase64();
|
||||||
WechatOpenId = config.GetProperty("OpenId").GetString()!;
|
WechatOpenId = config.GetProperty("OpenId").GetString()!;
|
||||||
|
|
||||||
ProjectSourceDirectory = jdoc.RootElement.GetProperty("ProjectSourceDirectory").GetString()!;
|
ProjectSourceDirectory = jdoc.RootElement.GetProperty("ProjectSourceDirectory").GetString()!;
|
||||||
@ -35,6 +36,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests
|
|||||||
public static readonly string WechatAppId;
|
public static readonly string WechatAppId;
|
||||||
public static readonly string WechatMerchantId;
|
public static readonly string WechatMerchantId;
|
||||||
public static readonly string WechatMerchantSecret;
|
public static readonly string WechatMerchantSecret;
|
||||||
|
public static readonly byte[] WechatMerchantCertificateBytes;
|
||||||
public static readonly string WechatOpenId;
|
public static readonly string WechatOpenId;
|
||||||
|
|
||||||
public static readonly string ProjectSourceDirectory;
|
public static readonly string ProjectSourceDirectory;
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
"AppId": "请在此填写用于测试的微信 AppId",
|
"AppId": "请在此填写用于测试的微信 AppId",
|
||||||
"MerchantId": "请在此填写用于测试的微信商户号",
|
"MerchantId": "请在此填写用于测试的微信商户号",
|
||||||
"MerchantSecret": "请在此填写用于测试的微信商户 API 密钥",
|
"MerchantSecret": "请在此填写用于测试的微信商户 API 密钥",
|
||||||
|
"MerchantCertificateBase64String": "请在此填写用于测试的微信商户证书内容的 Base64 字节数组",
|
||||||
"OpenId": "请在此填写用于测试的微信用户唯一标识"
|
"OpenId": "请在此填写用于测试的微信用户唯一标识"
|
||||||
},
|
},
|
||||||
"ProjectSourceDirectory": "请输入当前 SDK 项目所在的目录完整路径,如 C:\\Project\\src\\SKIT.FlurlHttpClient.Wechat.TenpayV2\\",
|
"ProjectSourceDirectory": "请输入当前 SDK 项目所在的目录完整路径,如 C:\\Project\\src\\SKIT.FlurlHttpClient.Wechat.TenpayV2\\",
|
||||||
|
Loading…
Reference in New Issue
Block a user