DotNetCore.SKIT.FlurlHttpCl.../test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/TestCase_ApiExecuteBillTests.cs

53 lines
1.9 KiB
C#
Raw Normal View History

2021-05-10 15:30:00 +08:00
using System;
using System.Threading.Tasks;
using Xunit;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests
{
2022-03-11 17:21:28 +08:00
public class TestCase_ApiExecuteBillTests
2021-05-10 15:30:00 +08:00
{
2022-01-21 13:10:56 +08:00
[Fact(DisplayName = "测试用例:调用 API [GET] /bill/tradebill")]
public async Task TestExecuteGetBillTradeBill()
2021-05-10 15:30:00 +08:00
{
var request = new Models.GetBillTradeBillRequest()
{
BillDateString = "2021-04-05"
};
var response = await TestClients.Instance.ExecuteGetBillTradeBillAsync(request);
Assert.True(response.IsSuccessful());
Assert.NotNull(response.HashType);
Assert.NotNull(response.HashValue);
Assert.NotNull(response.DownloadUrl);
}
2022-01-21 13:10:56 +08:00
[Fact(DisplayName = "测试用例:调用 API [GET] /bill/fundflowbill")]
public async Task TestExecuteGetBillFundflowBill()
2021-05-10 15:30:00 +08:00
{
var request = new Models.GetBillFundflowBillRequest()
{
BillDateString = DateTimeOffset.Now.AddDays(-1).ToString("yyyy-MM-dd")
};
var response = await TestClients.Instance.ExecuteGetBillFundflowBillAsync(request);
Assert.True(response.IsSuccessful());
Assert.NotNull(response.HashType);
Assert.NotNull(response.HashValue);
Assert.NotNull(response.DownloadUrl);
}
2022-01-21 13:10:56 +08:00
[Fact(DisplayName = "测试用例:调用 API [GET] /billdownload/file")]
public async Task TestExecuteDownloadBillFile()
2021-05-10 15:30:00 +08:00
{
var request = new Models.DownloadBillFileRequest()
{
DownloadUrl = "https://api.mch.weixin.qq.com/v3/billdownload/file?token=FAKE_TOKEN"
};
var response = await TestClients.Instance.ExecuteDownloadBillFileAsync(request);
Assert.True(response.IsSuccessful());
Assert.NotEmpty(response.RawBytes);
}
}
}