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