xtd 0.2.0
Loading...
Searching...
No Matches
xtd::tunit::test Class Referencefinal

Definition

Represents a test method.

Namespace
xtd::tunit
Library
xtd.tunit
Remarks
Typically this is a representation a test method in a test class.
This test contains among others: a name that represents the name of the method, a pointer to the method to call and a status on the state of the test.
Examples
test_class_without_helpers.cpp.

Public Constructors

 test ()=default
 Creates a new test instance.
 
 test (const xtd::ustring &name, const std::function< void()> &method, const xtd::diagnostics::stack_frame &stack_frame) noexcept
 Creates a new test instance with specified name, method and stack frame.
 
 test (const xtd::ustring &name, const std::function< void()> &method, bool ignore, const xtd::diagnostics::stack_frame &stack_frame) noexcept
 Creates a new test instance with specified name, method and stack frame.
 

Public Properties

bool aborted () const noexcept
 Gets a value that represent an aborted test.
 
const xtd::ustringactual () const noexcept
 Gets the actual value string.
 
xtd::time_span elapsed_time () const noexcept
 Gets the elapsed time of the test method.
 
const xtd::ustringexpect () const noexcept
 Gets the expect value string.
 
bool failed () const noexcept
 Gest a value that represent an failed test.
 
bool ignored () const noexcept
 Get a value that represent an ignored test.
 
bool not_started () const noexcept
 Get a value that represent a not started test.
 
bool succeed () const noexcept
 Gets a value that represent an succeed test.
 
const xtd::diagnostics::stack_frame stack_frame () const noexcept
 Gets the stack frame of the test method.
 
const xtd::date_timestart_time () const noexcept
 Gets the start time of the test method.
 
std::function< void()> method () const noexcept
 Gets the test method.
 
const xtd::ustringmessage () const noexcept
 Gets the message.
 
const xtd::ustringname () const noexcept
 Gets the name of the test method.
 
const xtd::ustringuser_message () const noexcept
 Gets the user message.
 

Constructor & Destructor Documentation

◆ test() [1/3]

xtd::tunit::test::test ( )
default

Creates a new test instance.

◆ test() [2/3]

xtd::tunit::test::test ( const xtd::ustring name,
const std::function< void()> &  method,
const xtd::diagnostics::stack_frame stack_frame 
)
noexcept

Creates a new test instance with specified name, method and stack frame.

Parameters
nameRepresents the name of the method. Generally is the same name as the method name.
methodThe method that contains the test.
stack_frameThe stack frame of the method.

◆ test() [3/3]

xtd::tunit::test::test ( const xtd::ustring name,
const std::function< void()> &  method,
bool  ignore,
const xtd::diagnostics::stack_frame stack_frame 
)
noexcept

Creates a new test instance with specified name, method and stack frame.

Parameters
nameRepresents the name of the method. Generally is the same name as the method name.
methodThe method that contains the test.
ignoredIf true, the test will be ignored during tests execution; otherwise, the test will be taken into account during tests execution.
stack_frameThe stack frame of the method.

Member Function Documentation

◆ aborted()

bool xtd::tunit::test::aborted ( ) const
noexcept

Gets a value that represent an aborted test.

Returns
true is the test is aborted; otherwise false.

◆ actual()

const xtd::ustring & xtd::tunit::test::actual ( ) const
noexcept

Gets the actual value string.

Returns
The actual value string. Can be empty.

◆ elapsed_time()

xtd::time_span xtd::tunit::test::elapsed_time ( ) const
noexcept

Gets the elapsed time of the test method.

Returns
The elapsed time of the test method.

◆ expect()

const xtd::ustring & xtd::tunit::test::expect ( ) const
noexcept

Gets the expect value string.

Returns
The expect value string. Can be empty.

◆ failed()

bool xtd::tunit::test::failed ( ) const
noexcept

Gest a value that represent an failed test.

Returns
tru is the test is failed; otherwise false.

◆ ignored()

bool xtd::tunit::test::ignored ( ) const
noexcept

Get a value that represent an ignored test.

Returns
true is the test is ignored; otherwise false.

◆ message()

const xtd::ustring & xtd::tunit::test::message ( ) const
noexcept

Gets the message.

Returns
The message.

◆ method()

std::function< void()> xtd::tunit::test::method ( ) const
noexcept

Gets the test method.

Returns
The test method.

◆ name()

const xtd::ustring & xtd::tunit::test::name ( ) const
noexcept

Gets the name of the test method.

Returns
The nzme of the test method.

◆ not_started()

bool xtd::tunit::test::not_started ( ) const
noexcept

Get a value that represent a not started test.

Returns
true is the test is not started; otherwise false.

◆ stack_frame()

const xtd::diagnostics::stack_frame xtd::tunit::test::stack_frame ( ) const
noexcept

Gets the stack frame of the test method.

Returns
The stack frame of the test method.

◆ start_time()

const xtd::date_time & xtd::tunit::test::start_time ( ) const
noexcept

Gets the start time of the test method.

Returns
The start time of the test method.

◆ succeed()

bool xtd::tunit::test::succeed ( ) const
noexcept

Gets a value that represent an succeed test.

Returns
true is the test is succeed; otherwise false.

◆ user_message()

const xtd::ustring & xtd::tunit::test::user_message ( ) const
noexcept

Gets the user message.

Returns
The user message.

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