C# Class BuildLight.Core.CodeContracts.ParameterCheck

Precondition checking for methods.
Datei anzeigen Open project: SouthsideSoftware/BuildLight

Public Methods

Method Description
ParameterRequired ( object parameter, string parameterName ) : void

Throws a Precondition exception if the provided object is null

StringRequiredAndNotWhitespace ( string parameter, string parameterName ) : void

Throw a Precondition exception if the provided string is null, empty or contains only whitespace.

Private Methods

Method Description
GetParameterRequiredErrorMessage ( string parameterName ) : string
ParameterNameRequired ( string parameterName ) : void
Require ( bool assertion, string message ) : void

Method Details

ParameterRequired() public static method

Throws a Precondition exception if the provided object is null
/// The object is null /// - or - /// The parameter name is null, empty or all whitespace ///
public static ParameterRequired ( object parameter, string parameterName ) : void
parameter object The object to test.
parameterName string The name of the parameter.
return void

StringRequiredAndNotWhitespace() public static method

Throw a Precondition exception if the provided string is null, empty or contains only whitespace.
/// The parameter is null, empty or contains only whitespace. /// - or - /// The parameter name is null, empty or all whitespace ///
public static StringRequiredAndNotWhitespace ( string parameter, string parameterName ) : void
parameter string Teh string parameter to check.
parameterName string The name of the string parameter (used in error messages).
return void