C# Class Pathoschild.DesignByContract.HasTypeAttribute

Inheritance: System.Attribute, IParameterPrecondition, IReturnValuePrecondition
Exibir arquivo Open project: Pathoschild/DesignByContract

Public Methods

Method Description
HasTypeAttribute ( ) : System

Construct a contract precondition that a value must implement an expected type.

OnParameterPrecondition ( ParameterMetadata parameter, object value ) : void

Validate the requirement on a single method parameter or property setter value.

OnReturnValuePrecondition ( ReturnValueMetadata returnValue, object value ) : void

Validate the requirement on a method or property return value.

Protected Methods

Method Description
GetError ( Type actualType ) : string

Get a contract violation error message.

HasType ( object value, Type types ) : bool

Get whether the value implements an expected type.

Method Details

GetError() protected method

Get a contract violation error message.
protected GetError ( Type actualType ) : string
actualType System.Type The type of the value.
return string

HasType() protected method

Get whether the value implements an expected type.
protected HasType ( object value, Type types ) : bool
value object The value to check.
types System.Type The expected types that the value must implement.
return bool

HasTypeAttribute() public method

Construct a contract precondition that a value must implement an expected type.
public HasTypeAttribute ( ) : System
return System

OnParameterPrecondition() public method

Validate the requirement on a single method parameter or property setter value.
The contract requirement was not met.
public OnParameterPrecondition ( ParameterMetadata parameter, object value ) : void
parameter Pathoschild.DesignByContract.Framework.ParameterMetadata The parameter metadata.
value object The parameter value.
return void

OnReturnValuePrecondition() public method

Validate the requirement on a method or property return value.
The contract requirement was not met.
public OnReturnValuePrecondition ( ReturnValueMetadata returnValue, object value ) : void
returnValue Pathoschild.DesignByContract.Framework.ReturnValueMetadata The return value metadata.
value object The return value.
return void