ClientTest.cs 806 B

12345678910111213141516171819202122232425262728293031
  1. using NUnit.Framework;
  2. using Alipay.EasySDK.Factory;
  3. using Alipay.EasySDK.Kernel;
  4. namespace UnitTest.Util.AES
  5. {
  6. public class ClientTest
  7. {
  8. [SetUp]
  9. public void SetUp()
  10. {
  11. Config config = TestAccount.Mini.GetConfig();
  12. config.EncryptKey = "aa4BtZ4tspm2wnXLb1ThQA==";
  13. Factory.SetOptions(config);
  14. }
  15. [Test]
  16. public void TestDecrypt()
  17. {
  18. string plainText = Factory.Util.AES().Decrypt("ILpoMowjIQjfYMR847rnFQ==");
  19. Assert.AreEqual(plainText, "test1234567");
  20. }
  21. [Test]
  22. public void TestEncrypt()
  23. {
  24. string cipherText = Factory.Util.AES().Encrypt("test1234567");
  25. Assert.AreEqual(cipherText, "ILpoMowjIQjfYMR847rnFQ==");
  26. }
  27. }
  28. }