MockApiBaseTest.cs 864 B

123456789101112131415161718192021222324252627282930313233
  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 abstract class MockApiBaseTest<TRequest, TResponse> : MockPostApiBaseTest<TRequest, TResponse>
  11. where TRequest : ApiRequest<TResponse>
  12. where TResponse : ApiResponse, new()
  13. {
  14. [Fact]
  15. public void Success()
  16. {
  17. MockSetup(false);
  18. var response = mock_client.Object.Execute(Request);
  19. Assert.False(response.IsError);
  20. }
  21. [Fact]
  22. public void Fail()
  23. {
  24. MockSetup(true);
  25. var response = mock_client.Object.Execute(Request);
  26. Assert.Equal(true, response.IsError);
  27. }
  28. }
  29. }