CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
System::TestTools Struct Reference

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

#include <test_tools.h>

Static Public Member Functions

template<typename T >
static auto IsNull (const T &obj) -> decltype(obj==nullptr)
 Checks if specific value is null. Version for all types which can be compared with nullptr. More...
 
static bool IsNull (...)
 Checks if specific value is null. Version for all other types. 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]

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.

◆ IsEmpty() [2/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.

◆ IsNull() [1/3]

static bool System::TestTools::IsNull (   ...)
inlinestatic

Checks if specific value is null. Version for all other types.

Returns
Always returns false.

◆ IsNull() [2/3]

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.

◆ IsNull() [3/3]

template<typename T >
static auto System::TestTools::IsNull ( const T &  obj) -> decltype(obj == nullptr)
inlinestatic

Checks if specific value is null. Version for all types which can be compared with nullptr.

Template Parameters
TType of value being checked.
Parameters
objValue to check for null.
Returns
Result of obj's comparation with nullptr

◆ 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.