GetCurrentAutoreplyInfoTest.cs 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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 GetCurrentAutoreplyInfoTest : MockPostApiBaseTest<GetCurrentAutoreplyInfoRequest, GetCurrentAutoreplyInfoResponse>
  12. {
  13. [Fact]
  14. public void MockCurrentAutoreplyInfoTest()
  15. {
  16. MockSetup(false);
  17. var response = mock_client.Object.Execute(Request);
  18. Assert.IsType<GetCurrentAutoreplyInfoResponse>(response);
  19. }
  20. protected override GetCurrentAutoreplyInfoRequest InitRequestObject()
  21. {
  22. return new GetCurrentAutoreplyInfoRequest
  23. {
  24. AccessToken = "123"
  25. };
  26. }
  27. protected override string GetReturnResult(bool errResult)
  28. {
  29. if (errResult) return s_errmsg;
  30. return @"{
  31. ""is_add_friend_reply_open"": 1,
  32. ""is_autoreply_open"": 1,
  33. ""add_friend_autoreply_info"": {
  34. ""type"": ""text"",
  35. ""content"": ""Thanks for your attention!""
  36. },
  37. ""message_default_autoreply_info"": {
  38. ""type"": ""text"",
  39. ""content"": ""Hello, this is autoreply!""
  40. },
  41. ""keyword_autoreply_info"": {
  42. ""list"": [
  43. {
  44. ""rule_name"": ""autoreply-news"",
  45. ""create_time"": 1423028166,
  46. ""reply_mode"": ""reply_all"",
  47. ""keyword_list_info"": [
  48. {
  49. ""type"": ""text"",
  50. ""match_mode"": ""contain"",
  51. ""content"": ""news测试""//此处content即为关键词内容
  52. }
  53. ],
  54. ""reply_list_info"": [
  55. {
  56. ""type"": ""news"",
  57. ""news_info"": {
  58. ""list"": [
  59. {
  60. ""title"": ""it's news"",
  61. ""author"": ""jim"",
  62. ""digest"": ""it's digest"",
  63. ""show_cover"": 1,
  64. ""cover_url"": ""http://mmbiz.qpic.cn/mmbiz/GE7et87vE9vicuCibqXsX9GPPLuEtBfXfKbE8sWdt2DDcL0dMfQWJWTVn1N8DxI0gcRmrtqBOuwQHeuPKmFLK0ZQ/0"",
  65. ""content_url"": ""http://mp.weixin.qq.com/s?__biz=MjM5ODUwNTM3Ng==&mid=203929886&idx=1&sn=628f964cf0c6d84c026881b6959aea8b#rd"",
  66. ""source_url"": ""http://www.url.com""
  67. }
  68. ]
  69. }
  70. },
  71. {
  72. ""type"": ""news"",
  73. ""news_info"": {
  74. ""list"": [
  75. {
  76. ""title"": ""MULTI_NEWS"",
  77. ""author"": ""JIMZHENG"",
  78. ""digest"": ""text"",
  79. ""show_cover"": 0,
  80. ""cover_url"": ""http://mmbiz.qpic.cn/mmbiz/GE7et87vE9vicuCibqXsX9GPPLuEtBfXfK0HKuBIa1A1cypS0uY1wickv70iaY1gf3I1DTszuJoS3lAVLvhTcm9sDA/0"",
  81. ""content_url"": ""http://mp.weixin.qq.com/s?__biz=MjM5ODUwNTM3Ng==&mid=204013432&idx=1&sn=80ce6d9abcb832237bf86c87e50fda15#rd"",
  82. ""source_url"": """"
  83. },
  84. {
  85. ""title"": ""MULTI_NEWS4"",
  86. ""author"": ""JIMZHENG"",
  87. ""digest"": ""MULTI_NEWSMULTI_NEWSMULTI_NEWSMULTI_NEWSMULTI_NEWSMULT"",
  88. ""show_cover"": 1,
  89. ""cover_url"": ""http://mmbiz.qpic.cn/mmbiz/GE7et87vE9vicuCibqXsX9GPPLuEtBfXfKbE8sWdt2DDcL0dMfQWJWTVn1N8DxI0gcRmrtqBOuwQHeuPKmFLK0ZQ/0"",
  90. ""content_url"": ""http://mp.weixin.qq.com/s?__biz=MjM5ODUwNTM3Ng==&mid=204013432&idx=5&sn=b4ef73a915e7c2265e437096582774af#rd"",
  91. ""source_url"": """"
  92. }
  93. ]
  94. }
  95. }
  96. ]
  97. },
  98. {
  99. ""rule_name"": ""autoreply-voice"",
  100. ""create_time"": 1423027971,
  101. ""reply_mode"": ""random_one"",
  102. ""keyword_list_info"": [
  103. {
  104. ""type"": ""text"",
  105. ""match_mode"": ""contain"",
  106. ""content"": ""voice测试""
  107. }
  108. ],
  109. ""reply_list_info"": [
  110. {
  111. ""type"": ""voice"",
  112. ""content"": ""NESsxgHEvAcg3egJTtYj4uG1PTL6iPhratdWKDLAXYErhN6oEEfMdVyblWtBY5vp""
  113. }
  114. ]
  115. },
  116. {
  117. ""rule_name"": ""autoreply-text"",
  118. ""create_time"": 1423027926,
  119. ""reply_mode"": ""random_one"",
  120. ""keyword_list_info"": [
  121. {
  122. ""type"": ""text"",
  123. ""match_mode"": ""contain"",
  124. ""content"": ""text测试""
  125. }
  126. ],
  127. ""reply_list_info"": [
  128. {
  129. ""type"": ""text"",
  130. ""content"": ""hello!text!""
  131. }
  132. ]
  133. },
  134. {
  135. ""rule_name"": ""autoreply-video"",
  136. ""create_time"": 1423027801,
  137. ""reply_mode"": ""random_one"",
  138. ""keyword_list_info"": [
  139. {
  140. ""type"": ""text"",
  141. ""match_mode"": ""equal"",
  142. ""content"": ""video测试""
  143. }
  144. ],
  145. ""reply_list_info"": [
  146. {
  147. ""type"": ""video"",
  148. ""content"": ""http://61.182.133.153/vweixinp.tc.qq.com/1007_114bcede9a2244eeb5ab7f76d951df5f.f10.mp4?vkey=7183E5C952B16C3AB1991BA8138673DE1037CB82A29801A504B64A77F691BF9DF7AD054A9B7FE683&sha=0&save=1""
  149. }
  150. ]
  151. }
  152. ]
  153. }
  154. }";
  155. }
  156. }
  157. }