初始化仓库

This commit is contained in:
wangxiaowei
2025-04-22 14:09:52 +08:00
commit 8b100110bb
5155 changed files with 664201 additions and 0 deletions

View File

@ -0,0 +1,32 @@
using NUnit.Framework;
using Alipay.EasySDK.Factory;
using Alipay.EasySDK.Base.Image.Models;
using Alipay.EasySDK.Kernel.Util;
namespace UnitTest.Base.Image
{
public class ClientTest
{
[SetUp]
public void SetUp()
{
Factory.SetOptions(TestAccount.Mini.CONFIG);
}
[Test]
public void TestUpload()
{
AlipayOfflineMaterialImageUploadResponse response = Factory.Base.Image().Upload(
"测试图片", TestAccount.GetSolutionBasePath() + "/UnitTest/Fixture/sample.png");
Assert.IsTrue(ResponseChecker.Success(response));
Assert.AreEqual(response.Code, "10000");
Assert.AreEqual(response.Msg, "Success");
Assert.IsNull(response.SubCode);
Assert.IsNull(response.SubMsg);
Assert.NotNull(response.HttpBody);
Assert.NotNull(response.ImageId);
Assert.IsTrue(response.ImageUrl.StartsWith("https://"));
}
}
}

View File

@ -0,0 +1,42 @@
using NUnit.Framework;
using Alipay.EasySDK.Factory;
using Alipay.EasySDK.Base.OAuth.Models;
using Alipay.EasySDK.Kernel.Util;
namespace UnitTest.Base.OAuth
{
public class ClientTest
{
[SetUp]
public void SetUp()
{
Factory.SetOptions(TestAccount.Mini.CONFIG);
}
[Test]
public void TestGetToken()
{
AlipaySystemOauthTokenResponse response = Factory.Base.OAuth().GetToken("1234567890");
Assert.IsFalse(ResponseChecker.Success(response));
Assert.AreEqual(response.Code, "40002");
Assert.AreEqual(response.Msg, "Invalid Arguments");
Assert.AreEqual(response.SubCode, "isv.code-invalid");
Assert.AreEqual(response.SubMsg, "授权码code无效");
Assert.NotNull(response.HttpBody);
}
[Test]
public void TestRefreshToken()
{
AlipaySystemOauthTokenResponse response = Factory.Base.OAuth().RefreshToken("1234567890");
Assert.IsFalse(ResponseChecker.Success(response));
Assert.AreEqual(response.Code, "40002");
Assert.AreEqual(response.Msg, "Invalid Arguments");
Assert.AreEqual(response.SubCode, "isv.refresh-token-invalid");
Assert.AreEqual(response.SubMsg, "刷新令牌refresh_token无效");
Assert.NotNull(response.HttpBody);
}
}
}

View File

@ -0,0 +1,31 @@
using NUnit.Framework;
using Alipay.EasySDK.Factory;
using Alipay.EasySDK.Base.Qrcode.Models;
using Alipay.EasySDK.Kernel.Util;
namespace UnitTest.Base.Qrcode
{
public class ClientTest
{
[SetUp]
public void SetUp()
{
Factory.SetOptions(TestAccount.Mini.CONFIG);
}
[Test]
public void TestCreate()
{
AlipayOpenAppQrcodeCreateResponse response = Factory.Base.Qrcode().Create(
"https://opendocs.alipay.com", "ageIndex=1", "文档站点");
Assert.IsTrue(ResponseChecker.Success(response));
Assert.AreEqual(response.Code, "10000");
Assert.AreEqual(response.Msg, "Success");
Assert.Null(response.SubCode);
Assert.Null(response.SubMsg);
Assert.NotNull(response.HttpBody);
Assert.NotNull(response.QrCodeUrl);
}
}
}

View File

@ -0,0 +1,32 @@
using NUnit.Framework;
using Alipay.EasySDK.Factory;
using Alipay.EasySDK.Base.Video.Models;
using Alipay.EasySDK.Kernel.Util;
namespace UnitTest.Base.Video
{
public class ClientTest
{
[SetUp]
public void SetUp()
{
Factory.SetOptions(TestAccount.Mini.CONFIG);
}
[Test]
public void TestUpload()
{
AlipayOfflineMaterialImageUploadResponse response = Factory.Base.Video().Upload(
"测试视频", TestAccount.GetSolutionBasePath() + "/UnitTest/Fixture/sample.mp4");
Assert.IsTrue(ResponseChecker.Success(response));
Assert.AreEqual(response.Code, "10000");
Assert.AreEqual(response.Msg, "Success");
Assert.IsNull(response.SubCode);
Assert.IsNull(response.SubMsg);
Assert.NotNull(response.HttpBody);
Assert.NotNull(response.ImageId);
Assert.IsTrue(response.ImageUrl.StartsWith("https://"));
}
}
}