public async Task ValidRequestTest() { var httpClient = Substitute.For <IHttpClient>(); var httpResponse = Substitute.For <IWebApiResponse>(); httpResponse.Content.Returns("{\"testkey\":\"testvalue\"}"); httpResponse.StatusCode.Returns(HttpStatusCode.OK); httpResponse.ResponseHeaders.Returns(new Dictionary <string, string> { { "response", "here" } }); httpClient.RequestAsync(Arg.Any <IWebApiRequest>(), CancellationToken.None).Returns(Task.FromResult(httpResponse)); var content = new TestContentClass { Testkey = "testvalue" }; var connection = new Connection(string.Empty, default, new NullCacheMethod(), httpClient: httpClient);
public async Task ValidRequestTest() { var httpClient = Substitute.For <IHttpClient>(); var httpResponse = new WebApiResponse( "{\"testkey\":\"testvalue\"}", HttpStatusCode.OK, CacheState.FromLive, new Dictionary <string, string> { { "response", "here" } }); httpClient.RequestAsync(Arg.Any <IWebApiRequest>()).Returns(_ => httpResponse); var content = new TestContentClass { Testkey = "testvalue" }; var connection = new Connection(string.Empty, default, new NullCacheMethod(), httpClient: httpClient);