C# Class HttpServer.Check

Design by contract validator
ファイルを表示 Open project: 3di/3di-viewer-rei-libs

Public Methods

Method Description
Between ( int min, int max, int value, string messageOrParamName ) : void

Value must be between (or equal) min and max

Between ( int min, int max, string value, string messageOrParamName ) : void

Betweens the specified min.

Between ( int min, int max, string value, string messageOrParamName, bool required ) : void

Betweens the specified min.

False ( bool statement, string messageOrParamName ) : void

The specified statement/parameter must be false.

Max ( System.DateTime max, System.DateTime value, string messageOrParamName ) : void

Checks if the value is less or equal.

Max ( int max, int value, string messageOrParamName ) : void

Checks if the value is less or equal.

Max ( int max, string value, string messageOrParamName ) : void

Checks if the value is less or equal.

Max ( int max, string value, string messageOrParamName, bool required ) : void

Checks if the value is less or equal.

Min ( System.DateTime min, System.DateTime value, string messageOrParamName ) : void

Checks if the value is equal or larger.

Min ( int min, int value, string messageOrParamName ) : void

Checks if the value is equal or larger.

Min ( int min, string value, string messageOrParamName ) : void

Checks if the value is equal or larger.

Min ( int min, string value, string messageOrParamName, bool required ) : void

Checks if the value is equal or larger.

Min ( long min, long value, string messageOrParamName ) : void

Checks if the value is equal or larger.

NotEmpty ( string value, string messageOrParamName ) : void

The specified string may not be null or empty.

NotEqual ( object value, object paramValue, string messageOrParamName ) : void

Two values can't be equal.

value and paramValue are both required.

Require ( object value, string messageOrParamName ) : void

Parameter is required (may not be null).

True ( bool statement, string messageOrParamName ) : void

The specified statement/parameter must be true.

Type ( Type type, object instance, string messageOrParamName ) : void

Check if the specified type can be assigned from the parameter type.

Private Methods

Method Description
Check ( ) : System
Throw ( string messageOrParamName, string message ) : void

Method Details

Between() public static method

Value must be between (or equal) min and max
If contract fails.
public static Between ( int min, int max, int value, string messageOrParamName ) : void
min int minimum value.
max int maximum value.
value int parameter value.
messageOrParamName string parameter name, or a error message.
return void

Between() public static method

Betweens the specified min.
If contract fails.
public static Between ( int min, int max, string value, string messageOrParamName ) : void
min int minimum value.
max int maximum value.
value string parameter value to check. May not be null.
messageOrParamName string parameter name, or a error message.
return void

Between() public static method

Betweens the specified min.
If contract fails.
public static Between ( int min, int max, string value, string messageOrParamName, bool required ) : void
min int minimum value.
max int maximum value.
value string parameter value.
messageOrParamName string parameter name, or a error message.
required bool may be null if this parameter is false.
return void

False() public static method

The specified statement/parameter must be false.
If statement is true.
public static False ( bool statement, string messageOrParamName ) : void
statement bool statement/parameter to evaluate.
messageOrParamName string Name of the message or param.
return void

Max() public static method

Checks if the value is less or equal.
If contract fails.
public static Max ( System.DateTime max, System.DateTime value, string messageOrParamName ) : void
max System.DateTime max value.
value System.DateTime parameter value.
messageOrParamName string parameter name, or a error message.
return void

Max() public static method

Checks if the value is less or equal.
If contract fails.
public static Max ( int max, int value, string messageOrParamName ) : void
max int maximum value.
value int parameter value.
messageOrParamName string parameter name, or a error message.
return void

Max() public static method

Checks if the value is less or equal.
If contract fails.
public static Max ( int max, string value, string messageOrParamName ) : void
max int maximum value.
value string parameter value.
messageOrParamName string parameter name, or a error message.
return void

Max() public static method

Checks if the value is less or equal.
If contract fails.
public static Max ( int max, string value, string messageOrParamName, bool required ) : void
max int maximum value.
value string parameter value.
messageOrParamName string parameter name, or a error message.
required bool may be null if this parameter is false.
return void

Min() public static method

Checks if the value is equal or larger.
If contract fails.
public static Min ( System.DateTime min, System.DateTime value, string messageOrParamName ) : void
min System.DateTime minimum value.
value System.DateTime parameter value.
messageOrParamName string parameter name, or a error message.
return void

Min() public static method

Checks if the value is equal or larger.
If contract fails.
public static Min ( int min, int value, string messageOrParamName ) : void
min int minimum value.
value int parameter value.
messageOrParamName string parameter name, or a error message.
return void

Min() public static method

Checks if the value is equal or larger.
If contract fails.
public static Min ( int min, string value, string messageOrParamName ) : void
min int minimum value.
value string parameter value (may not be null).
messageOrParamName string parameter name, or a error message.
return void

Min() public static method

Checks if the value is equal or larger.
If contract fails.
public static Min ( int min, string value, string messageOrParamName, bool required ) : void
min int minimum value.
value string parameter value.
messageOrParamName string parameter name, or a error message.
required bool may be null if this parameter is false.
return void

Min() public static method

Checks if the value is equal or larger.
If contract fails.
public static Min ( long min, long value, string messageOrParamName ) : void
min long minimum value.
value long parameter value.
messageOrParamName string parameter name, or a error message.
return void

NotEmpty() public static method

The specified string may not be null or empty.
If contract fails.
public static NotEmpty ( string value, string messageOrParamName ) : void
value string parameter value.
messageOrParamName string parameter name, or a error message.
return void

NotEqual() public static method

Two values can't be equal.
value and paramValue are both required.
If contract fails.
public static NotEqual ( object value, object paramValue, string messageOrParamName ) : void
value object value/constant to compare to.
paramValue object parameter value.
messageOrParamName string parameter name, or a error message.
return void

Require() public static method

Parameter is required (may not be null).
If contract fails.
public static Require ( object value, string messageOrParamName ) : void
value object parameter value.
messageOrParamName string parameter name, or a error message.
return void

True() public static method

The specified statement/parameter must be true.
If statement is not true.
public static True ( bool statement, string messageOrParamName ) : void
statement bool statement/parameter to evaluate.
messageOrParamName string Name of the message or param.
return void

Type() public static method

Check if the specified type can be assigned from the parameter type.
public static Type ( Type type, object instance, string messageOrParamName ) : void
type Type Type that the parameter must be (or derive/implement).
instance object instance
messageOrParamName string error message or parameter name
return void