GetCurrentSelfmenuInfoTest.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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.Api
  10. {
  11. public class GetCurrentSelfmenuInfoTest : MockPostApiBaseTest<GetCurrentSelfmenuInfoRequest, GetCurrentSelfmenuInfoResponse>
  12. {
  13. [Fact]
  14. public void GetCurrentSelfmenuTest()
  15. {
  16. MockSetup(false);
  17. var response = mock_client.Object.Execute(Request);
  18. Assert.IsType<GetCurrentSelfmenuInfoResponse>(response);
  19. //Console.WriteLine(response.IsError);
  20. }
  21. protected override GetCurrentSelfmenuInfoRequest InitRequestObject()
  22. {
  23. return new GetCurrentSelfmenuInfoRequest
  24. {
  25. AccessToken = "123"
  26. };
  27. }
  28. protected override string GetReturnResult(bool errResult)
  29. {
  30. if (errResult) return s_errmsg;
  31. // return @"{
  32. // ""is_menu_open"": 1,
  33. // ""selfmenu_info"": {
  34. // ""button"": [
  35. // {
  36. // ""type"": ""click"",
  37. // ""name"": ""今日歌曲"",
  38. // ""key"": ""V1001_TODAY_MUSIC""
  39. // },
  40. // {
  41. // ""name"": ""菜单"",
  42. // ""sub_button"": {
  43. // ""list"": [
  44. // {
  45. // ""type"": ""view"",
  46. // ""name"": ""搜索"",
  47. // ""url"": ""http://www.soso.com/""
  48. // },
  49. // {
  50. // ""type"": ""view"",
  51. // ""name"": ""视频"",
  52. // ""url"": ""http://v.qq.com/""
  53. // },
  54. // {
  55. // ""type"": ""click"",
  56. // ""name"": ""赞一下我们"",
  57. // ""key"": ""V1001_GOOD""
  58. // }
  59. // ]
  60. // }
  61. // }
  62. // ]
  63. // }
  64. // }";
  65. return @"{
  66. ""is_menu_open"": 1,
  67. ""selfmenu_info"": {
  68. ""button"": [
  69. {
  70. ""name"": ""button"",
  71. ""sub_button"": {
  72. ""list"": [
  73. {
  74. ""type"": ""view"",
  75. ""name"": ""view_url"",
  76. ""url"": ""http://www.qq.com""
  77. },
  78. {
  79. ""type"": ""news"",
  80. ""name"": ""news"",
  81. ""news_info"": {
  82. ""list"": [
  83. {
  84. ""title"": ""MULTI_NEWS"",
  85. ""author"": ""JIMZHENG"",
  86. ""digest"": ""text"",
  87. ""show_cover"": 0,
  88. ""cover_url"": ""http://mmbiz.qpic.cn/mmbiz/GE7et87vE9vicuCibqXsX9GPPLuEtBfXfK0HKuBIa1A1cypS0uY1wickv70iaY1gf3I1DTszuJoS3lAVLvhTcm9sDA/0"",
  89. ""content_url"": ""http://mp.weixin.qq.com/s?__biz=MjM5ODUwNTM3Ng==&mid=204013432&idx=1&sn=80ce6d9abcb832237bf86c87e50fda15#rd"",
  90. ""source_url"": """"
  91. },
  92. {
  93. ""title"": ""MULTI_NEWS1"",
  94. ""author"": ""JIMZHENG"",
  95. ""digest"": ""MULTI_NEWS1"",
  96. ""show_cover"": 1,
  97. ""cover_url"": ""http://mmbiz.qpic.cn/mmbiz/GE7et87vE9vicuCibqXsX9GPPLuEtBfXfKnmnpXYgWmQD5gXUrEApIYBCgvh2yHsu3ic3anDUGtUCHwjiaEC5bicd7A/0"",
  98. ""content_url"": ""http://mp.weixin.qq.com/s?__biz=MjM5ODUwNTM3Ng==&mid=204013432&idx=2&sn=8226843afb14ecdecb08d9ce46bc1d37#rd"",
  99. ""source_url"": """"
  100. }
  101. ]
  102. }
  103. },
  104. {
  105. ""type"": ""video"",
  106. ""name"": ""video"",
  107. ""value"": ""http://61.182.130.30/vweixinp.tc.qq.com/1007_114bcede9a2244eeb5ab7f76d951df5f.f10.mp4?vkey=77A42D0C2015FBB0A3653D29C571B5F4BBF1D243FBEF17F09C24FF1F2F22E30881BD350E360BC53F&sha=0&save=1""
  108. },
  109. {
  110. ""type"": ""voice"",
  111. ""name"": ""voice"",
  112. ""value"": ""nTXe3aghlQ4XYHa0AQPWiQQbFW9RVtaYTLPC1PCQx11qc9UB6CiUPFjdkeEtJicn""
  113. }
  114. ]
  115. }
  116. },
  117. {
  118. ""type"": ""text"",
  119. ""name"": ""text"",
  120. ""value"": ""This is text!""
  121. },
  122. {
  123. ""type"": ""img"",
  124. ""name"": ""photo"",
  125. ""value"": ""ax5Whs5dsoomJLEppAvftBUuH7CgXCZGFbFJifmbUjnQk_ierMHY99Y5d2Cv14RD""
  126. }
  127. ]
  128. }
  129. }";
  130. }
  131. }
  132. }