/// <summary>
        /// Asserts that the response content type is of the MIME-type 'application/xml' or the specified override.
        /// </summary>
        /// <param name="response">The <see cref="BrowserResponse"/> that the assert should be made on.</param>
        /// <param name="assertions">Additional assertions on the XML object.</param>
        /// <param name="contentType">The expected content type.</param>
        /// <returns>An XElement.</returns>
        public static XElement ShouldBeXml(this BrowserResponse response, Action<XElement> assertions = null, string contentType = "application/xml")
        {
            response.AssertStatusCode(HttpStatusCode.OK);
            response.AssertContentType(contentType);

            XElement xml;

            try
            {
                xml = response.AsXml();
            }
            catch (Exception exception)
            {
                throw new AssertException("Failed to convert response body into XML.", exception);
            }

            assertions.TryInvoke(xml);

            return xml;
        }
        /// <summary>
        /// Asserts that the response content type is of the MIME-type 'text/html'.
        /// </summary>
        /// <param name="response">The <see cref="BrowserResponse"/> that the assert should be made on.</param>
        /// <param name="assertions">Additional assertions on the CQ object.</param>
        /// <returns>The CQ object.</returns>
        public static CQ ShouldBeHtml(this BrowserResponse response, Action<CQ> assertions = null)
        {
            response.AssertStatusCode(HttpStatusCode.OK);
            response.AssertContentType("text/html");

            CQ document;

            try
            {
                document = response.AsCsQuery();
            }
            catch (Exception exception)
            {
                throw new AssertException("Failed to convert response body into a CQ object.", exception);
            }

            assertions.TryInvoke(document);

            return document;
        }
        /// <summary>
        /// Asserts that the response content type is of the MIME-type 'application/json' or the specified override.
        /// </summary>
        /// <param name="response">The <see cref="BrowserResponse"/> that the assert should be made on.</param>
        /// <param name="assertions">Additional assertions on the JSON object.</param>
        /// <param name="contentType">The expected content type.</param>
        /// <returns>The JSON object.</returns>
        public static dynamic ShouldBeJson(this BrowserResponse response, Action<dynamic> assertions = null, string contentType = "application/json")
        {
            response.AssertStatusCode(HttpStatusCode.OK);
            response.AssertContentType(contentType);

            dynamic json;

            try
            {
                json = response.AsJson();
            }
            catch (Exception exception)
            {
                throw new AssertException("Failed to convert response body into JSON.", exception);
            }

            if (assertions != null)
            {
                assertions(json);
            }

            return json;
        }