MenuCreateRequestTest.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. using FrameworkCoreTest;
  2. using JCSoft.WX.Framework.Models;
  3. using JCSoft.WX.Framework.Models.ApiRequests;
  4. using JCSoft.WX.Framework.Models.ApiResponses;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Text;
  8. namespace JCSoft.WX.FrameworkTest.Api
  9. {
  10. public class MenuCreateRequestTest :
  11. MockPostApiBaseTest<MenuCreateRequest, MenuCreateResponse>
  12. {
  13. protected MenuCreateRequestTest()
  14. {
  15. }
  16. protected override string GetReturnResult(bool errResult)
  17. {
  18. if (errResult)
  19. {
  20. return "{\"errcode\":40029,\"errmsg\":\"invalid code\"}";
  21. }
  22. return @"{
  23. ""recordlist"": [
  24. {
  25. ""worker"": "" test1"",
  26. ""openid"": ""oDF3iY9WMaswOPWjCIp_f3Bnpljk"",
  27. ""opercode"": 2002,
  28. ""time"": 1400563710,
  29. ""text"": "" 您好,客服test1为您服务。""
  30. },
  31. {
  32. ""worker"": "" test1"",
  33. ""openid"": ""oDF3iY9WMaswOPWjCIp_f3Bnpljk"",
  34. ""opercode"": 2003,
  35. ""time"": 1400563731,
  36. ""text"": "" 你好,有什么事情? ""
  37. },
  38. ]
  39. }";
  40. }
  41. protected override MenuCreateRequest InitRequestObject()
  42. {
  43. return new MenuCreateRequest
  44. {
  45. Buttons = new List<ClickButton>
  46. {
  47. new ClickButton
  48. {
  49. Type = ClickButtonType.click,
  50. Name = "关注我",
  51. Key = "Key_Follow_Me"
  52. },
  53. new ClickButton
  54. {
  55. Type = ClickButtonType.view,
  56. Url = "http://inday.cnblogs.com",
  57. Name = "我的博客"
  58. },
  59. new ClickButton
  60. {
  61. Name="主菜单",
  62. SubButton = new List<ClickButton>
  63. {
  64. new ClickButton
  65. {
  66. Type = ClickButtonType.scancode_push,
  67. Name = "扫一扫",
  68. Key = "Event_Scan"
  69. },
  70. new ClickButton
  71. {
  72. Type = ClickButtonType.pic_sysphoto,
  73. Name = "系统拍照发图",
  74. Key = "Event_SysPhoto"
  75. },
  76. new ClickButton
  77. {
  78. Type = ClickButtonType.pic_weixin,
  79. Name = "微信相册发图",
  80. Key = "Event_Pic_WeiXin"
  81. },
  82. new ClickButton
  83. {
  84. Type = ClickButtonType.location_select,
  85. Name = "发送位置",
  86. Key = "Event_Location_Select"
  87. },
  88. new ClickButton
  89. {
  90. Type = ClickButtonType.miniprogram,
  91. Name = "我的小程序",
  92. Url ="http://inday.cnblogs.com",
  93. MiniProgramAppId = "wx286b93c14bbf93aa",
  94. MiniProgramPagePath = "pages/lunar/index"
  95. }
  96. }
  97. }
  98. }
  99. };
  100. }
  101. }
  102. }