private async Task <XmlRpcResponse> ReadResponseAsync(HttpResponseMessage httpResponse) { var responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); var responseModelReader = new ResponseModelReader(new ValueReaders(XmlEncoding)); return(await responseModelReader.ReadAsync(new MemoryStream(XmlEncoding.GetBytes(responseContent)), false).ConfigureAwait(false)); }
public async void Read_ValidResponse_ReturnsCorrectModel() { var stringValue = new StringValue("Test1234"); var readers = A.Fake <IValueReaders>(); A.CallTo(() => readers.ReadValue(A <XElement> .Ignored)).Returns(stringValue); var reader = new ResponseModelReader(readers); var model = await reader.ReadAsync(new MemoryStream(Encoding.UTF8.GetBytes(XmlRpcResponseData)), false); Assert.Single(model.Results); var result = model.Results.First(); Assert.Single(result.Values); Assert.Same(stringValue, result.Values.First()); }