xtd 0.2.0
Loading...
Searching...
No Matches
xtd::tunit::base_assert Class Reference
Inheritance diagram for xtd::tunit::base_assert:
xtd::static_object xtd::tunit::assert xtd::tunit::assume xtd::tunit::collection_assert xtd::tunit::collection_assume xtd::tunit::collection_valid xtd::tunit::directory_assert xtd::tunit::directory_assume xtd::tunit::directory_valid xtd::tunit::file_assert xtd::tunit::file_assume xtd::tunit::file_valid xtd::tunit::string_assert xtd::tunit::string_assume xtd::tunit::string_valid xtd::tunit::valid

Definition

The base class for assert.

Namespace
xtd::tunit
Library
xtd.tunit
Examples
math_assert.cpp, math_assume.cpp, and math_valid.cpp.

Public Static Methods

static void abort (const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
 Abort current test. This is used by the other assert functions.
 
static void abort (const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
 Abort current test. This is used by the other assert functions.
 
static void fail (const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
 Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.
 
static void fail (const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
 Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.
 
static void ignore (const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
 Ignore current test. This is used by the other assert functions.
 
static void ignore (const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
 Ignore current test. This is used by the other assert functions.
 
static void succeed (const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
 Generates a success with a generic message. This is used by the other assert functions.
 
static void succeed (const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
 Generates a success with a generic message. This is used by the other assert functions.
 

Protected Methods

static void error ()
 Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.
 
static void error (const xtd::string &message)
 Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.
 
static void error (const xtd::string &actual, const xtd::string &expected, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
 Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.
 
static void fail (const xtd::string &actual, const xtd::string &expected, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
 Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.
 
template<typename value_t >
static xtd::string to_string (const value_t &value)
 Convert specified value to xtd::string.
 
template<typename value_t >
static xtd::string to_string (const value_t *value)
 Convert specified value to xtd::string.
 
template<typename collection_t >
static xtd::string join_items (const collection_t &collection)
 Join specified collection into xtd::string.
 
static xtd::string join_items (const xtd::string &str)
 Join specified string into xtd::string.
 

Member Function Documentation

◆ abort() [1/2]

static void xtd::tunit::base_assert::abort ( const xtd::diagnostics::stack_frame stack_frame = xtd::diagnostics::stack_frame::current())
static

Abort current test. This is used by the other assert functions.

Parameters
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::tunit::assert::abort(); // test throws an abort_error exception.
static void abort(const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Abort current test. This is used by the other assert functions.
Examples
math_assume.cpp.

◆ abort() [2/2]

static void xtd::tunit::base_assert::abort ( const xtd::string message,
const xtd::diagnostics::stack_frame stack_frame = xtd::diagnostics::stack_frame::current() 
)
static

Abort current test. This is used by the other assert functions.

Parameters
messageA user message to display if the assertion fails. This message can be seen in the unit test results.
stack_frameContains information about current file and current line.
Examples
xtd::tunit::assert::abort("User message..."); // test throws an abort_error exception.

◆ fail() [1/3]

static void xtd::tunit::base_assert::fail ( const xtd::diagnostics::stack_frame stack_frame = xtd::diagnostics::stack_frame::current())
static

Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.

Parameters
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::tunit::assert::fail(); // test throws an assert_error exception.
static void fail(const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.
Examples
math_assert.cpp, math_assume.cpp, and math_valid.cpp.

◆ fail() [2/3]

static void xtd::tunit::base_assert::fail ( const xtd::string message,
const xtd::diagnostics::stack_frame stack_frame = xtd::diagnostics::stack_frame::current() 
)
static

Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.

Parameters
messageA user message to display if the assertion fails. This message can be seen in the unit test results.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::tunit::assert::fail("User message..."); // test throws an assert_error exception.

◆ ignore() [1/2]

static void xtd::tunit::base_assert::ignore ( const xtd::diagnostics::stack_frame stack_frame = xtd::diagnostics::stack_frame::current())
static

Ignore current test. This is used by the other assert functions.

Parameters
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::tunit::assert::ignore(); // test throws an ignore_error exception.
static void ignore(const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Ignore current test. This is used by the other assert functions.

◆ ignore() [2/2]

static void xtd::tunit::base_assert::ignore ( const xtd::string message,
const xtd::diagnostics::stack_frame stack_frame = xtd::diagnostics::stack_frame::current() 
)
static

Ignore current test. This is used by the other assert functions.

Parameters
messageA user message to display if the assertion fails. This message can be seen in the unit test results.
stack_frameContains information about current file and current line.
Examples
xtd::tunit::assert::ignore("User message..."); // test throws an ignore_error exception.

◆ succeed() [1/2]

static void xtd::tunit::base_assert::succeed ( const xtd::diagnostics::stack_frame stack_frame = xtd::diagnostics::stack_frame::current())
static

Generates a success with a generic message. This is used by the other assert functions.

Parameters
messageA user message to display if the assertion fails. This message can be seen in the unit test results.
Examples
static void succeed(const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Generates a success with a generic message. This is used by the other assert functions.
Examples
math_assert.cpp, math_assume.cpp, and math_valid.cpp.

◆ succeed() [2/2]

static void xtd::tunit::base_assert::succeed ( const xtd::string message,
const xtd::diagnostics::stack_frame stack_frame = xtd::diagnostics::stack_frame::current() 
)
static

Generates a success with a generic message. This is used by the other assert functions.

Parameters
messageA user message to display if the assertion fails. This message can be seen in the unit test results.
stack_frameContains information about current file and current line.
Examples
xtd::tunit::assert::succeed("User message..."); // test ok.

◆ error() [1/3]

static void xtd::tunit::base_assert::error ( )
staticprotected

Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.

Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::tunit::assert::error(); // test throws an assert_error exception.
static void error()
Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.
Examples
math_valid.cpp.

◆ error() [2/3]

static void xtd::tunit::base_assert::error ( const xtd::string message)
staticprotected

Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.

Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::tunit::assert::error("User message..."); // test throws an assert_error exception.

◆ error() [3/3]

static void xtd::tunit::base_assert::error ( const xtd::string actual,
const xtd::string expected,
const xtd::string message,
const xtd::diagnostics::stack_frame stack_frame = xtd::diagnostics::stack_frame::current() 
)
staticprotected

Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.

Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::tunit::assert::error(actual_str, expected_str, "User message..."); // test throws an assert_error exception.

◆ fail() [3/3]

static void xtd::tunit::base_assert::fail ( const xtd::string actual,
const xtd::string expected,
const xtd::string message,
const xtd::diagnostics::stack_frame stack_frame = xtd::diagnostics::stack_frame::current() 
)
staticprotected

Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.

Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::tunit::assert::fail(actual_str, expected_str, "User message..."); // test throws an assert_error exception.

◆ to_string() [1/2]

template<typename value_t >
static xtd::string xtd::tunit::base_assert::to_string ( const value_t &  value)
inlinestaticprotected

Convert specified value to xtd::string.

Parameters
valueThe value to convert to xtd::string.
Returns
The xtd::string that contains the value.

◆ to_string() [2/2]

template<typename value_t >
static xtd::string xtd::tunit::base_assert::to_string ( const value_t *  value)
inlinestaticprotected

Convert specified value to xtd::string.

Parameters
valueThe value to convert to xtd::string.
Returns
The xtd::string that contains the value.

◆ join_items() [1/2]

template<typename collection_t >
static xtd::string xtd::tunit::base_assert::join_items ( const collection_t &  collection)
inlinestaticprotected

Join specified collection into xtd::string.

Parameters
collectionThe collection to join into xtd::string.
Returns
The xtd::string that contains the joined collection.

◆ join_items() [2/2]

static xtd::string xtd::tunit::base_assert::join_items ( const xtd::string str)
staticprotected

Join specified string into xtd::string.

Parameters
strThe joined to join into xtd::string.
Returns
The xtd::string that contains the joined string.

The documentation for this class was generated from the following file: