public void ExecuteAsync_Should_Return_Null_For_Null_ApiRequest() { IApiCaller apiCaller = GetApiCaller(); var response = AsyncHelper.RunSync(() => apiCaller.ExecuteAsync(null)); Assert.Null(response); }
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); }
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); }
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)); }