ShorturlRequestTestTest.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using JCSoft.WX.Framework.Models.ApiRequests;
  7. using JCSoft.WX.Framework.Models.ApiResponses;
  8. using Xunit;
  9. namespace FrameworkCoreTest
  10. {
  11. public class ShorturlRequestTestTest : MockPostApiBaseTest<ShorturlRequest, ShorturlResponse>
  12. {
  13. protected override ShorturlRequest InitRequestObject()
  14. {
  15. return new ShorturlRequest
  16. {
  17. AccessToken = "123",
  18. Action = ConvertType.Long2Short,
  19. Url = "http://www.jamesying.com"
  20. };
  21. }
  22. protected override string GetReturnResult(bool errResult)
  23. {
  24. if (errResult) return s_errmsg;
  25. return "{\"errcode\":0,\"errmsg\":\"ok\",\"short_url\":\"http:\\/\\/w.url.cn\\/s\\/AvCo6Ih\"}";
  26. }
  27. public override ShorturlResponse GetResponse()
  28. {
  29. return mock_client.Object.Execute(Request);
  30. }
  31. }
  32. }