/// <summary> /// Tests whether action result contains the same content type as the provided MediaTypeHeaderValue. /// </summary> /// <param name="contentType">Expected content type as <see cref="MediaTypeHeaderValue"/>.</param> protected void ValidateContainingOfContentType(MediaTypeHeaderValue contentType) { ContentTypeValidator.ValidateContainingOfContentType( this.ActionResult, contentType, this.ThrowNewFailedValidationException); }
/// <summary> /// Tests whether the <see cref="ActionResult"/> /// contains the content type provided as <see cref="MediaTypeHeaderValue"/>. /// </summary> /// <param name="baseTestBuilderWithOutputResult"> /// Instance of <see cref="IBaseTestBuilderWithOutputResult{TOutputResultTestBuilder}"/> type. /// </param> /// <param name="contentType">Content type as <see cref="MediaTypeHeaderValue"/>.</param> /// <returns>The same output <see cref="ActionResult"/> test builder.</returns> public static TOutputResultTestBuilder ContainingContentType <TOutputResultTestBuilder>( this IBaseTestBuilderWithOutputResult <TOutputResultTestBuilder> baseTestBuilderWithOutputResult, MediaTypeHeaderValue contentType) where TOutputResultTestBuilder : IBaseTestBuilderWithActionResult { var actualBuilder = GetActualBuilder(baseTestBuilderWithOutputResult); ValidateObjectResult(actualBuilder); ContentTypeValidator.ValidateContainingOfContentType( actualBuilder.TestContext.MethodResult, contentType, actualBuilder.ThrowNewFailedValidationException); return(actualBuilder.ResultTestBuilder); }