Interface IGuardClauseCommand
Namespace: AutoFixture.Idioms
Assembly: AutoFixture.Idioms.dll
Represents an action which can be invoked to verify whether or not an expectation about Guard Clause behavior is met, and what to do if that is not the case.
public interface IGuardClauseCommandRemarks
This interface is a rather specialized interface supporting the implementation of `GuardClauseAssertion`.
Properties
RequestedParameterName
Gets the name of the requested parameter.
string RequestedParameterName { get; }Property Value
Remarks
The RequestedParameterName property identifies the name of parameter which should be supplied to the `Object)` method.
RequestedType
Gets the type of the requested value.
Type RequestedType { get; }Property Value
Remarks
The RequestedType property identifies the type of object which should be supplied to the `Object)` method.
Methods
CreateException(string)
Creates an exception which communicates that an error occured for a specific input value.
Exception CreateException(string value)Parameters
value string
A string representation of the value.
Returns
An exception which communicates the cause of the error.
Remarks
The value is a string representation of the value supplied to the
`Object)` method. Together with the context contained within any
implementation of `IGuardClauseCommand` this value can be used to build an exception message.
CreateException(string, Exception)
Creates an exception which communicates that an error occured for a specific input value.
Exception CreateException(string value, Exception innerException)Parameters
value string
A string representation of the value.
innerException Exception
The exception that is the cause of the current exception.
Returns
An exception which communicates the cause of the error.
Remarks
The value is a string representation of the value supplied to the
`Object)` method. Together with the context contained within any
implementation of `IGuardClauseCommand` this value can be used to build an exception message.
CreateException(string, string, Exception)
Creates an exception which communicates that an error occured for a specific input value.
Exception CreateException(string value, string customError, Exception innerException)Parameters
value string
A string representation of the value.
customError string
A custom explanation of the guard clause failure.
innerException Exception
The exception that is the cause of the current exception.
Returns
An exception which communicates the cause of the error.
Remarks
The value is a string representation of the value supplied to the
`Object)` method. Together with the passed customError and context
contained within any implementation of `IGuardClauseCommand` this value can be used to
build an exception message.
Execute(object)
Executes the action with the specified value.
void Execute(object value)Parameters
value object
The value with wich the action is executed.
Remarks
The value is expected to be compatible with
`RequestedType`. It should be possible to cast the value to the requested type.