internal static async Task <object> ReadAsync(ODataMediaTypeFormatter formatter, string entity, Type valueType, HttpRequestMessage request, string mediaType) { using (StringContent content = new StringContent(entity)) { content.Headers.ContentType = MediaTypeHeaderValue.Parse(mediaType); using (Stream stream = await content.ReadAsStreamAsync()) { return(await formatter.ReadFromStreamAsync(valueType, stream, content, new Mock <IFormatterLogger>().Object)); } } }