示例#1
0
        public void ExecuteAsync_Should_Return_Null_For_Null_ApiRequest()
        {
            IApiCaller apiCaller = GetApiCaller();
            var        response  = AsyncHelper.RunSync(() => apiCaller.ExecuteAsync(null));

            Assert.Null(response);
        }
示例#2
0
        public void ExecuteAsync_Should_Call_Api()
        {
            var apiRequest = new ApiRequest(Method.GET)
            {
                Uri = new Uri("https://reqres.in/api/users/2"),
            };
            IApiCaller apiCaller = GetApiCaller();
            var        response  = AsyncHelper.RunSync(() => apiCaller.ExecuteAsync(apiRequest));

            Assert.NotNull(response);
        }
示例#3
0
        public void ExecuteAsync_Should_Return_Null_For_Invalid_URI_In_ApiRequest()
        {
            var apiRequest = new ApiRequest(Method.GET)
            {
                Uri = new Uri("http://r.in/api/users/2"),
            };
            IApiCaller apiCaller = GetApiCaller();
            var        response  = AsyncHelper.RunSync(() => apiCaller.ExecuteAsync(apiRequest));

            Assert.Null(response);
        }
示例#4
0
 internal static void SetupExecuteAsync(Mock <IApiCaller> mockApiCaller, IApiCaller innerApiCaller = null)
 {
     innerApiCaller = innerApiCaller ?? new FileReaderApiCaller();
     mockApiCaller.Setup(mock => mock.ExecuteAsync(It.IsAny <ApiRequest>()))
     .Returns <ApiRequest>((rq) => innerApiCaller.ExecuteAsync(rq));
 }