System::TestTools Struct Reference

Provides a set of useful methods that check some basic properties of different types and functions. More...

Static Public Member Functions

template<typename T >
static std::enable_if< std::is_arithmetic< T >::value||std::is_enum< T >::value, bool >::type IsNull (T obj)
 Checks if specific value is null. Version for arithmetic and enum types. More...
 
template<typename T >
static std::enable_if<!std::is_arithmetic< T >::value &&!std::is_enum< T >::value, bool >::type IsNull (const T &obj)
 Checks if specific value is null. Version for non-arithmetic and non-enum value types. More...
 
template<typename T >
static bool IsNull (const SharedPtr< T > &obj)
 Checks if specific value is null. Version for non-arithmetic value types. More...
 
template<typename K , typename V >
static bool IsNull (System::Collections::Generic::KeyValuePair< K, V > &kvp)
 Checks if specific value is null. Version for key-value pairs. More...
 
static bool IsEmpty (const System::String &str)
 Checks if string is empty. More...
 
template<typename T >
static bool IsEmpty (const SharedPtr< T > &collection)
 Checks if collection is empty. More...
 
template<typename T >
static bool IsNullOrEmpty (const SharedPtr< T > &collection)
 Checks if collection is null or empty. More...
 
static bool IsNullOrEmpty (const System::String &str)
 Checks if string is null or empty. More...
 
static bool IsNull (const System::String &str)
 Checks if string is null. More...
 
static bool AssertThrows (const std::function< void()> &func)
 Checks if function throws exception of any type. More...
 

Detailed Description

Provides a set of useful methods that check some basic properties of different types and functions.

Member Function Documentation

◆ AssertThrows()

static bool System::TestTools::AssertThrows ( const std::function< void()> &  func)
inlinestatic

Checks if function throws exception of any type.

Parameters
funcFunction to check for throwing.
Returns
True if function throws, false otherwise.

◆ IsEmpty() [1/2]

static bool System::TestTools::IsEmpty ( const System::String str)
inlinestatic

Checks if string is empty.

Parameters
strString to check for being empty.
Returns
True if string is empty (null-length), false otherwise.

◆ IsEmpty() [2/2]

template<typename T >
static bool System::TestTools::IsEmpty ( const SharedPtr< T > &  collection)
inlinestatic

Checks if collection is empty.

Template Parameters
TCollection type.
Parameters
collectionCollection to check.
Returns
True if collection has zero element count, false otherwise.

◆ IsNull() [1/5]

template<typename T >
static std::enable_if<std::is_arithmetic<T>::value || std::is_enum<T>::value, bool>::type System::TestTools::IsNull ( obj)
inlinestatic

Checks if specific value is null. Version for arithmetic and enum types.

Template Parameters
TType of value being checked.
Parameters
objValue to check for null.
Returns
Always returns false.

◆ IsNull() [2/5]

template<typename T >
static std::enable_if<!std::is_arithmetic<T>::value && !std::is_enum<T>::value, bool>::type System::TestTools::IsNull ( const T &  obj)
inlinestatic

Checks if specific value is null. Version for non-arithmetic and non-enum value types.

Template Parameters
TType of value being checked.
Parameters
objValue to check for null.
Returns
True if object is compared to nullptr as true, false otherwise.

◆ IsNull() [3/5]

template<typename T >
static bool System::TestTools::IsNull ( const SharedPtr< T > &  obj)
inlinestatic

Checks if specific value is null. Version for non-arithmetic value types.

Template Parameters
TType of value being checked.
Parameters
objValue to check for null.
Returns
True if object is compared to nullptr as true, false otherwise.

◆ IsNull() [4/5]

template<typename K , typename V >
static bool System::TestTools::IsNull ( System::Collections::Generic::KeyValuePair< K, V > &  kvp)
inlinestatic

Checks if specific value is null. Version for key-value pairs.

Template Parameters
KKey type.
VValue type.
Parameters
kvpPair object.
Returns
True if pair is considered null, false otherwise.

◆ IsNull() [5/5]

static bool System::TestTools::IsNull ( const System::String str)
inlinestatic

Checks if string is null.

Parameters
strString to check.
Returns
True if string is considered null, false otherwise.

◆ IsNullOrEmpty() [1/2]

template<typename T >
static bool System::TestTools::IsNullOrEmpty ( const SharedPtr< T > &  collection)
inlinestatic

Checks if collection is null or empty.

Template Parameters
TCollection type.
Parameters
collectionCollection to check.
Returns
True if collection is null or has zero element count, false otherwise.

◆ IsNullOrEmpty() [2/2]

static bool System::TestTools::IsNullOrEmpty ( const System::String str)
inlinestatic

Checks if string is null or empty.

Parameters
strString to check.
Returns
True if string is null or has zero length, false otherwise.