/// <summary> /// Validates the Formatters from action result containing one. /// </summary> /// <param name="actionResult">Action result with Formatters.</param> /// <param name="formattersBuilder">Formatters builder.</param> /// <param name="failedValidationAction">Action to call in case of failed validation.</param> public static void ValidateMediaTypeFormattersBuilder( dynamic actionResult, Action <IFormattersBuilder> formattersBuilder, Action <string, string, string> failedValidationAction) { RuntimeBinderValidator.ValidateBinding(() => { var newFormattersBuilder = new FormattersBuilder(); formattersBuilder(newFormattersBuilder); var expectedFormatters = newFormattersBuilder.GetMediaTypeFormatters(); expectedFormatters.ForEach(formatter => ValidateMediaTypeFormatter( actionResult, formatter, failedValidationAction)); }); }
/// <summary> /// Validates the Formatters from action result containing one. /// </summary> /// <param name="actionResult">Action result with Formatters.</param> /// <param name="formattersBuilder">Formatters builder.</param> /// <param name="failedValidationAction">Action to call in case of failed validation.</param> public static void ValidateMediaTypeFormattersBuilder( dynamic actionResult, Action<IFormattersBuilder> formattersBuilder, Action<string, string, string> failedValidationAction) { RuntimeBinderValidator.ValidateBinding(() => { var newFormattersBuilder = new FormattersBuilder(); formattersBuilder(newFormattersBuilder); var expectedFormatters = newFormattersBuilder.GetMediaTypeFormatters(); expectedFormatters.ForEach(formatter => ValidateMediaTypeFormatter( actionResult, formatter, failedValidationAction)); }); }