ClientTest.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using NUnit.Framework;
  2. using Alipay.EasySDK.Factory;
  3. using Alipay.EasySDK.Payment.Huabei.Models;
  4. using System;
  5. using Alipay.EasySDK.Kernel.Util;
  6. namespace UnitTest.Payment.HuaBei
  7. {
  8. public class ClientTest
  9. {
  10. [SetUp]
  11. public void SetUp()
  12. {
  13. Factory.SetOptions(TestAccount.Mini.CONFIG);
  14. }
  15. [Test]
  16. public void TestCrate()
  17. {
  18. string outTradeNo = Guid.NewGuid().ToString();
  19. HuabeiConfig config = new HuabeiConfig()
  20. {
  21. HbFqNum = "3",
  22. HbFqSellerPercent = "0"
  23. };
  24. AlipayTradeCreateResponse response = Factory.Payment.Huabei().Create("Iphone6 16G",
  25. outTradeNo, "88.88", "2088002656718920", config);
  26. Assert.IsTrue(ResponseChecker.Success(response));
  27. Assert.AreEqual(response.Code, "10000");
  28. Assert.AreEqual(response.Msg, "Success");
  29. Assert.Null(response.SubCode);
  30. Assert.Null(response.SubMsg);
  31. Assert.NotNull(response.HttpBody);
  32. Assert.AreEqual(response.OutTradeNo, outTradeNo);
  33. Assert.True(response.TradeNo.StartsWith("202"));
  34. }
  35. }
  36. }