MenuDelconditionalTest.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using FrameworkCoreTest;
  2. using JCSoft.WX.Framework.Models.ApiRequests;
  3. using JCSoft.WX.Framework.Models.ApiResponses;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Text;
  7. using Xunit;
  8. namespace JCSoft.WX.FrameworkTest.Api
  9. {
  10. public class MenuDelconditionalTest : MockPostApiBaseTest<MenuDelconditionalRequest, MenuDelconditionalResponse>
  11. {
  12. [Fact]
  13. public void Success()
  14. {
  15. MockSetup(false);
  16. var response = mock_client.Object.Execute(Request);
  17. Assert.False(response.IsError);
  18. }
  19. [Fact]
  20. public void Error()
  21. {
  22. MockSetup(true);
  23. var response = mock_client.Object.Execute(Request);
  24. Assert.Equal(true, response.IsError);
  25. //Console.WriteLine(response);
  26. }
  27. protected override string GetReturnResult(bool errResult)
  28. {
  29. if (errResult)
  30. {
  31. return "{\"errcode\":40029,\"errmsg\":\"invalid code\"}";
  32. }
  33. return "{\"errcode\":0,\"errmsg\":\"ok\"}";
  34. }
  35. protected override MenuDelconditionalRequest InitRequestObject()
  36. {
  37. return new MenuDelconditionalRequest
  38. {
  39. AccessToken = "123",
  40. MenuId = "123123"
  41. };
  42. }
  43. }
  44. }