Class ReflectionExceptionUnwrappingCommand
Namespace: AutoFixture.Idioms
Assembly: AutoFixture.Idioms.dll
Decorates another IGuardClauseCommand and unwraps
TargetInvocationException occurances from the Object) method.
public class ReflectionExceptionUnwrappingCommand : IGuardClauseCommandInheritance
object ← ReflectionExceptionUnwrappingCommand
Implements
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Constructors
ReflectionExceptionUnwrappingCommand(IGuardClauseCommand)
Initializes a new instance of the ReflectionExceptionUnwrappingCommand
class.
public ReflectionExceptionUnwrappingCommand(IGuardClauseCommand command)Parameters
command IGuardClauseCommand
The decorated command.
Properties
Command
Gets the decorated command supplied via the constructor.
public IGuardClauseCommand Command { get; }Property Value
RequestedParameterName
Gets the name of the requested parameter.
public 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.
public 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.
public 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.
public 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.
public 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 on the decorated Command. If a
TargetInvocationException is thrown, it's unwrapped and its
InnerException is thrown instead.
public void Execute(object value)Parameters
value object
The value with wich the action is executed.