public async Task HandleCodeSearchResponseInMachine() { var response = new HttpResponseMessage(); var clientState = new ClientState(); response.RequestMessage = new HttpRequestMessage(); response.RequestMessage.Properties[HttpClientExtensions.PropertyKeyLinkRelation] = "codesearch"; response.Content = new StringContent("Fake content"); var task = Task.FromResult<HttpResponseMessage>(response); CodeSearchLink.CodeSearchResults result = null; var httpMachine = new HttpResponseMachine(); httpMachine.AddResponseHandler(clientState.HandleResponseAsync, System.Net.HttpStatusCode.OK); await task.ApplyRepresentationToAsync(httpMachine); Assert.NotNull(clientState.SearchResult); }
public async Task HandleCodeSearchResponse() { var response = new HttpResponseMessage(); var clientState = new ClientState(); response.RequestMessage = new HttpRequestMessage(); response.RequestMessage.Properties[HttpClientExtensions.PropertyKeyLinkRelation] = "codesearch"; response.Content = new StringContent("Fake content"); var task = Task.FromResult<HttpResponseMessage>(response); CodeSearchLink.CodeSearchResults result = null; await task.ApplyRepresentationToAsync(clientState); Assert.NotNull(clientState.SearchResult); }