コード例 #1
0
        /// <summary>
        /// Gets the deserialized representation of the JSON in the response body.
        /// </summary>
        /// <typeparam name="TModel">The type that the JSON response body should be deserialized to.</typeparam>
        /// <param name="bodyWrapper">An instance of the <see cref="BrowserResponseBodyWrapper"/> that the extension should be invoked on.</param>
        /// <value>A <typeparamref name="TModel"/> instance representation of the HTTP response body.</value>
        public static TModel DeserializeJson <TModel>(this BrowserResponseBodyWrapper bodyWrapper)
        {
            var serializer =
                new JavaScriptSerializer();

            return(serializer.Deserialize <TModel>(bodyWrapper.AsString()));
        }
コード例 #2
0
        /// <summary>
        /// Gets the HTTP response body as a <see cref="XmlDocument"/>
        /// </summary>
        /// <param name="bodyWrapper">An instance of the <see cref="BrowserResponseBodyWrapper"/> that the extension should be invoked on.</param>
        /// <value>A <see cref="XmlDocument"/> representation of the HTTP response body.</value>
        public static XmlDocument AsXmlDocument(this BrowserResponseBodyWrapper bodyWrapper)
        {
            var document = new XmlDocument();

            document.LoadXml(bodyWrapper.AsString());

            return document;
        }