Summer.Batch.Common.Util.Assert Class Reference

Static Assert Helper. More...

Static Public Member Functions

static void IsTrue (bool expression, string message=null)
 Asserts a boolean expression. More...
 
static void IsNull (object obj, string message=null)
 Asserts that an object is null. More...
 
static void NotNull (object obj, string message=null)
 Asserts that an object is not null. More...
 
static void HasLength (string text, string message=null)
 Asserts that a string is not null and is not empty. More...
 
static void HasText (string text, string message=null)
 Asserts that a string is not null and contains at least one non-whitespace character. More...
 
static void DoesNotContain (string textToSearch, string substring, string message=null)
 Asserts that a string does not contain a substring. More...
 
static void NotEmpty (object[] array, string message=null)
 Asserts that an array is not null and that its length is greater than zero. More...
 
static void NoNullElements (object[] array, string message=null)
 Asserts that an array has no null elements. More...
 
static void NotEmpty< T > (ICollection< T > collection, string message=null)
 Asserts that a dictionary is not empty. More...
 
static void NotEmpty< TKey, TValue > (IDictionary< TKey, TValue > dictionary, string message=null)
 Asserts that a dictionary is not empty. More...
 
static void IsInstanceOf (Type type, object obj, string message=null)
 Asserts than an object is instance of a type. More...
 
static void IsAssignable (Type superType, Type subType, string message=null)
 Asserts that a supertype is assignable from a subtype. More...
 
static void State (bool expression, string message=null)
 Asserts than an expression evaluates to true. More...
 

Detailed Description

Static Assert Helper.

Member Function Documentation

static void Summer.Batch.Common.Util.Assert.DoesNotContain ( string  textToSearch,
string  substring,
string  message = null 
)
static

Asserts that a string does not contain a substring.

Parameters
textToSearchthe string to search
substringthe substring to find
messagethe message to use if assertion fails
Exceptions
ArgumentException if the substring is found in text
static void Summer.Batch.Common.Util.Assert.HasLength ( string  text,
string  message = null 
)
static

Asserts that a string is not null and is not empty.

Parameters
textthe string to check
messagethe message to use if assertion fails
Exceptions
ArgumentException if the string is null or empty
static void Summer.Batch.Common.Util.Assert.HasText ( string  text,
string  message = null 
)
static

Asserts that a string is not null and contains at least one non-whitespace character.

Parameters
textthe string to check
messagethe message to use if assertion fails
Exceptions
ArgumentException if the string is null or does not contain text
static void Summer.Batch.Common.Util.Assert.IsAssignable ( Type  superType,
Type  subType,
string  message = null 
)
static

Asserts that a supertype is assignable from a subtype.

Parameters
superTypethe supertype to check
subTypethe subtype to check
messagethe message to use if assertion fails

///

Exceptions
ArgumentException if supertype is not assignable from subtype
static void Summer.Batch.Common.Util.Assert.IsInstanceOf ( Type  type,
object  obj,
string  message = null 
)
static

Asserts than an object is instance of a type.

Parameters
typethe type the object must be instance of
objthe object to check
messagethe message to use if assertion fails
Exceptions
ArgumentException if the object is not an instance of type
static void Summer.Batch.Common.Util.Assert.IsNull ( object  obj,
string  message = null 
)
static

Asserts that an object is null.

Parameters
objthe object to check
messagethe message to use if assertion fails
Exceptions
ArgumentException if the object is not null
static void Summer.Batch.Common.Util.Assert.IsTrue ( bool  expression,
string  message = null 
)
static

Asserts a boolean expression.

Parameters
expressiona boolean expression
messagethe message to use if assertion fails
Exceptions
ArgumentException if the expression is evaluated to false
static void Summer.Batch.Common.Util.Assert.NoNullElements ( object[]  array,
string  message = null 
)
static

Asserts that an array has no null elements.

Parameters
arraythe array to check
messagethe message to use if assertion fails
Exceptions
ArgumentException if the array is null or contains a null element
static void Summer.Batch.Common.Util.Assert.NotEmpty ( object[]  array,
string  message = null 
)
static

Asserts that an array is not null and that its length is greater than zero.

Parameters
arraythe array to check
messagethe message to use if assertion fails
Exceptions
ArgumentException if the array is null or empty
static void Summer.Batch.Common.Util.Assert.NotEmpty< T > ( ICollection< T >  collection,
string  message = null 
)
static

Asserts that a dictionary is not empty.

Template Parameters
T The type of the elements in the dictionary
Parameters
collectionthe dictionary to check
messagethe message to use if assertion fails
Exceptions
ArgumentException if the collection is null or empty
static void Summer.Batch.Common.Util.Assert.NotEmpty< TKey, TValue > ( IDictionary< TKey, TValue >  dictionary,
string  message = null 
)
static

Asserts that a dictionary is not empty.

Template Parameters
TKey the type of the keys
TValue the type of the values
Parameters
dictionarythe dictionary to check
messagethe message to use if assertion fails
Exceptions
ArgumentException if the dictionary is null or empty
static void Summer.Batch.Common.Util.Assert.NotNull ( object  obj,
string  message = null 
)
static

Asserts that an object is not null.

Parameters
objthe object to check
messagethe message to use if assertion fails
Exceptions
ArgumentNullException if the object is null
static void Summer.Batch.Common.Util.Assert.State ( bool  expression,
string  message = null 
)
static

Asserts than an expression evaluates to true.

Parameters
expressionthe expression to check
messagethe message to use if assertion fails
Exceptions
InvalidOperationException if expression evaluates to false

The documentation for this class was generated from the following file:
  • Summer.Batch.Common/Util/Assert.cs