/// <summary> /// Tests whether the collected attributes contain <see cref="ProducesAttribute"/>. /// </summary> /// <param name="controllerActionAttributesTestBuilder"> /// Instance of <see cref="IControllerActionAttributesTestBuilder{TAttributesTestBuilder}"/> type. /// </param> /// <param name="ofContentTypes">Expected content types.</param> /// <returns>The same attributes test builder.</returns> public static TAttributesTestBuilder SpecifyingProduction <TAttributesTestBuilder>( this IControllerActionAttributesTestBuilder <TAttributesTestBuilder> controllerActionAttributesTestBuilder, IEnumerable <string> ofContentTypes) where TAttributesTestBuilder : IControllerActionAttributesTestBuilder <TAttributesTestBuilder> { var actualBuilder = (BaseAttributesTestBuilder <TAttributesTestBuilder>)controllerActionAttributesTestBuilder; actualBuilder.ContainingAttributeOfType <ProducesAttribute>(); actualBuilder.Validations.Add(attrs => { var consumesAttribute = actualBuilder.GetAttributeOfType <ProducesAttribute>(attrs); ContentTypeValidator.ValidateAttributeContentTypes( consumesAttribute, ofContentTypes, actualBuilder.ThrowNewAttributeAssertionException); }); return(actualBuilder.AttributesTestBuilder); }