C# Class MyTested.AspNetCore.Mvc.Utilities.Validators.ContentTypeValidator

Validator class containing content type validation logic.
Mostrar archivo Open project: ivaylokenov/MyTested.AspNetCore.Mvc

Public Methods

Method Description
ValidateContainingOfContentType ( dynamic result, Microsoft.Net.Http.Headers.MediaTypeHeaderValue expectedContentType, Action failedValidationAction ) : void

Validates whether action result ContentTypes contains the provided content type from action result containing such property.

ValidateContentType ( dynamic result, string expectedContentType, Action failedValidationAction ) : void

Validates whether ContentType is the same as the provided one from action result containing such property.

ValidateContentType ( string expectedContentType, string actualContentType, Action failedValidationAction ) : void

Validates whether two content types are the same.

ValidateContentTypes ( dynamic result, IEnumerable contentTypes, Action failedValidationAction ) : void

Validates whether action result ContentTypes contains the provided content types from action result containing such property.

Private Methods

Method Description
SortContentTypes ( IEnumerable contentTypes ) : IList
TryGetContentTypesCollection ( dynamic actionResult ) : IEnumerable

Method Details

ValidateContainingOfContentType() public static method

Validates whether action result ContentTypes contains the provided content type from action result containing such property.
public static ValidateContainingOfContentType ( dynamic result, Microsoft.Net.Http.Headers.MediaTypeHeaderValue expectedContentType, Action failedValidationAction ) : void
result dynamic Component result with ContentTypes.
expectedContentType Microsoft.Net.Http.Headers.MediaTypeHeaderValue Expected content type.
failedValidationAction Action Action to call in case of failed validation.
return void

ValidateContentType() public static method

Validates whether ContentType is the same as the provided one from action result containing such property.
public static ValidateContentType ( dynamic result, string expectedContentType, Action failedValidationAction ) : void
result dynamic Component result with ContentType.
expectedContentType string Expected content type.
failedValidationAction Action Action to call in case of failed validation.
return void

ValidateContentType() public static method

Validates whether two content types are the same.
public static ValidateContentType ( string expectedContentType, string actualContentType, Action failedValidationAction ) : void
expectedContentType string Expected content type.
actualContentType string Actual content type.
failedValidationAction Action Action to call in case of failed validation.
return void

ValidateContentTypes() public static method

Validates whether action result ContentTypes contains the provided content types from action result containing such property.
public static ValidateContentTypes ( dynamic result, IEnumerable contentTypes, Action failedValidationAction ) : void
result dynamic Component result with ContentTypes.
contentTypes IEnumerable Expected content types.
failedValidationAction Action Action to call in case of failed validation.
return void