mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-07-17 01:46:20 +08:00
test(tenpayv2): 补充若干单元测试用例
This commit is contained in:
parent
8486d3dafb
commit
db3aa0a8f3
@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
@ -6,8 +6,27 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests
|
|||||||
{
|
{
|
||||||
public class TestCase_ApiExecutePayTests
|
public class TestCase_ApiExecutePayTests
|
||||||
{
|
{
|
||||||
|
[Fact(DisplayName = "测试用例:调用 API [POST] /pay/unifiedorder")]
|
||||||
|
public async Task TestCase_ApiExecuteCreatePayUnifiedOrderTests()
|
||||||
|
{
|
||||||
|
var request = new Models.CreatePayUnifiedOrderRequest()
|
||||||
|
{
|
||||||
|
OutTradeNumber = "TEST_OTN_" + DateTimeOffset.Now.ToString("yyyyMMddHHmmssfff"),
|
||||||
|
Body = "TEST_BODY",
|
||||||
|
TotalFee = 1,
|
||||||
|
ClientIp = "127.0.0.7",
|
||||||
|
AppId = TestConfigs.WechatAppId,
|
||||||
|
OpenId = TestConfigs.WechatOpenId,
|
||||||
|
TradeType = "JSAPI",
|
||||||
|
NotifyUrl = "https://example.com"
|
||||||
|
};
|
||||||
|
var response = await TestClients.Instance.ExecuteCreatePayUnifiedOrderAsync(request);
|
||||||
|
|
||||||
|
Assert.NotNull(response.PrepayId);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact(DisplayName = "测试用例:调用 API [POST] /pay/micropay")]
|
[Fact(DisplayName = "测试用例:调用 API [POST] /pay/micropay")]
|
||||||
public async Task TestCase_ApiExecuteExecuteCreatePayMicroPayTests()
|
public async Task TestCase_ApiExecuteCreatePayMicroPayTests()
|
||||||
{
|
{
|
||||||
var request = new Models.CreatePayMicroPayRequest()
|
var request = new Models.CreatePayMicroPayRequest()
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests
|
||||||
|
{
|
||||||
|
public class TestCase_XmlUtilityTests
|
||||||
|
{
|
||||||
|
[Fact(DisplayName = "测试用例:XML2JSON")]
|
||||||
|
public void TestXmlConvertToJson()
|
||||||
|
{
|
||||||
|
string xml = "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
|
||||||
|
string json = Utilities.XmlUtility.ConvertToJson(xml); ;
|
||||||
|
|
||||||
|
JObject jObject = JObject.Parse(json)!;
|
||||||
|
Assert.Equal("SUCCESS", jObject["return_code"]!.ToString());
|
||||||
|
Assert.Equal("OK", jObject["return_msg"]!.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user