C# Класс HttpServer.Check

Design by contract validator
Показать файл Открыть проект

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
Check ( ) : System
Throw ( string messageOrParamName, string message ) : void

Описание методов

Between() публичный статический Метод

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.
Результат void

Between() публичный статический Метод

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.
Результат void

Between() публичный статический Метод

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.
Результат void

False() публичный статический Метод

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.
Результат void

Max() публичный статический Метод

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.
Результат void

Max() публичный статический Метод

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.
Результат void

Max() публичный статический Метод

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.
Результат void

Max() публичный статический Метод

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.
Результат void

Min() публичный статический Метод

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.
Результат void

Min() публичный статический Метод

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.
Результат void

Min() публичный статический Метод

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.
Результат void

Min() публичный статический Метод

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.
Результат void

Min() публичный статический Метод

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.
Результат void

NotEmpty() публичный статический Метод

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.
Результат void

NotEqual() публичный статический Метод

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.
Результат void

Require() публичный статический Метод

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.
Результат void

True() публичный статический Метод

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.
Результат void

Type() публичный статический Метод

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
Результат void