Class ValidationErrorAssertions
Contains assertion methods for Error.UnprocessableContent.
public class ValidationErrorAssertions : ReferenceTypeAssertions<Error.UnprocessableContent, ValidationErrorAssertions>
- Inheritance
-
ValidationErrorAssertions
- Inherited Members
- Extension Methods
Constructors
ValidationErrorAssertions(UnprocessableContent)
Initializes a new instance of the ValidationErrorAssertions class.
public ValidationErrorAssertions(Error.UnprocessableContent error)
Parameters
errorError.UnprocessableContent
Properties
Identifier
Returns the type of the subject the assertion applies on. It should be a user-friendly name as it is included in the failure message.
protected override string Identifier { get; }
Property Value
Methods
HaveFieldCount(int, string, params object[])
Asserts that the error has the specified number of distinct field paths with violations.
public AndConstraint<ValidationErrorAssertions> HaveFieldCount(int expectedCount, string because = "", params object[] becauseArgs)
Parameters
expectedCountintThe expected number of distinct fields with violations.
becausestringA formatted phrase explaining why the assertion is needed.
becauseArgsobject[]Zero or more objects to format using the placeholders in
because.
Returns
HaveFieldError(string, string, params object[])
Asserts that the error contains a field violation for the specified field.
public AndConstraint<ValidationErrorAssertions> HaveFieldError(string fieldName, string because = "", params object[] becauseArgs)
Parameters
fieldNamestringThe field name (plain or JSON pointer form, e.g. "email" or "/email").
becausestringA formatted phrase explaining why the assertion is needed.
becauseArgsobject[]Zero or more objects to format using the placeholders in
because.
Returns
HaveFieldErrorWithDetail(string, string, string, params object[])
Asserts that the error contains a field violation with the specified detail for the specified field.
public AndConstraint<ValidationErrorAssertions> HaveFieldErrorWithDetail(string fieldName, string expectedDetail, string because = "", params object[] becauseArgs)
Parameters
fieldNamestringThe field name.
expectedDetailstringThe expected error detail for the field.
becausestringA formatted phrase explaining why the assertion is needed.
becauseArgsobject[]Zero or more objects to format using the placeholders in
because.