ClientTest.cs 1010 B

1234567891011121314151617181920212223242526272829303132
  1. using NUnit.Framework;
  2. using Alipay.EasySDK.Factory;
  3. using Alipay.EasySDK.Base.Image.Models;
  4. using Alipay.EasySDK.Kernel.Util;
  5. namespace UnitTest.Base.Image
  6. {
  7. public class ClientTest
  8. {
  9. [SetUp]
  10. public void SetUp()
  11. {
  12. Factory.SetOptions(TestAccount.Mini.CONFIG);
  13. }
  14. [Test]
  15. public void TestUpload()
  16. {
  17. AlipayOfflineMaterialImageUploadResponse response = Factory.Base.Image().Upload(
  18. "测试图片", TestAccount.GetSolutionBasePath() + "/UnitTest/Fixture/sample.png");
  19. Assert.IsTrue(ResponseChecker.Success(response));
  20. Assert.AreEqual(response.Code, "10000");
  21. Assert.AreEqual(response.Msg, "Success");
  22. Assert.IsNull(response.SubCode);
  23. Assert.IsNull(response.SubMsg);
  24. Assert.NotNull(response.HttpBody);
  25. Assert.NotNull(response.ImageId);
  26. Assert.IsTrue(response.ImageUrl.StartsWith("https://"));
  27. }
  28. }
  29. }