/// <summary> /// Test async /// </summary> /// <param name="httpRequestService">the httpRequestService</param> public async Task TestAsync(IHttpRequestService httpRequestService) { foreach (var testCase in this) { if (testCase.Arranges.Expected != null && testCase.Arranges.Expected.HttpRequest != null) { testCase.Arranges.Expected.HttpResponse = await httpRequestService.GetResponseAsync(testCase.Arranges.Expected.HttpRequest); } if (testCase.Arranges.Actual != null) { testCase.Arranges.Actual.HttpResponse = await httpRequestService.GetResponseAsync(testCase.Arranges.Actual.HttpRequest); } testCase.Assert(testCase.Arranges.Expected, testCase.Arranges.Actual); } }
/// <summary> /// Test async /// </summary> /// <param name="httpRequestService">the httpRequestService</param> /// <param name="hookForActual">the hookForActual</param> /// <param name="hookForExpected">the hookForExpected</param> public async Task TestAsync(IHttpRequestService httpRequestService, Action <HttpClient> hookForActual = null, Action <HttpClient> hookForExpected = null) { foreach (var testCase in this) { if (testCase.Arranges.Expected != null && testCase.Arranges.Expected.HttpRequest != null) { testCase.Arranges.Expected.HttpResponse = await httpRequestService.GetResponseAsync(testCase.Arranges.Expected.HttpRequest, hookForExpected); } if (testCase.Arranges.Actual != null) { testCase.Arranges.Actual.HttpResponse = await httpRequestService.GetResponseAsync(testCase.Arranges.Actual.HttpRequest, hookForActual); } testCase.Assert(testCase.Arranges.Expected, testCase.Arranges.Actual); } }