MockGetcallbackipTestTest.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 MockGetcallbackipTestTest : MockPostApiBaseTest<GetcallbackipRequest, GetcallbackipResponse>
  12. {
  13. [Fact]
  14. public void MockCallbackiptest()
  15. {
  16. MockSetup(false);
  17. var response = mock_client.Object.Execute(Request);
  18. Assert.Equal(2, response.IPList.Count());
  19. foreach (var ip in response.IPList)
  20. {
  21. Console.WriteLine(ip);
  22. }
  23. }
  24. protected override GetcallbackipRequest InitRequestObject()
  25. {
  26. return new GetcallbackipRequest()
  27. {
  28. AccessToken = "123"
  29. };
  30. }
  31. protected override string GetReturnResult(bool errResult)
  32. {
  33. if (errResult) return s_errmsg;
  34. return "{\"ip_list\":[\"127.0.0.1\",\"127.0.0.1\"]}";
  35. }
  36. }
  37. }