xtd 1.0.0
Loading...
Searching...
No Matches
xtd::tunit::test Class Referencefinal
Inheritance diagram for xtd::tunit::test:
xtd::object

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::string &name, const std::function< void()> &method, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current()) noexcept
 Creates a new test instance with specified name, method and stack frame.
 test (const xtd::string &name, const std::function< void()> &method, bool ignore, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current()) noexcept
 Creates a new test instance with specified name, method and stack frame.

Public Properties

auto aborted () const noexcept -> bool
 Gets a value that represent an aborted test.
auto actual () const noexcept -> const xtd::string &
 Gets the actual value string.
auto elapsed_time () const noexcept -> xtd::time_span
 Gets the elapsed time of the test method.
auto expect () const noexcept -> const xtd::string &
 Gets the expect value string.
auto failed () const noexcept -> bool
 Gest a value that represent an failed test.
auto ignored () const noexcept -> bool
 Get a value that represent an ignored test.
auto not_started () const noexcept -> bool
 Get a value that represent a not started test.
auto succeed () const noexcept -> bool
 Gets a value that represent an succeed test.
auto stack_frame () const noexcept -> const xtd::diagnostics::stack_frame &
 Gets the stack frame of the test method.
auto start_time () const noexcept -> const xtd::date_time &
 Gets the start time of the test method.
auto method () const noexcept -> std::function< void()>
 Gets the test method.
auto message () const noexcept -> const xtd::string &
 Gets the message.
auto name () const noexcept -> const xtd::string &
 Gets the name of the test method.
auto user_message () const noexcept -> const xtd::string &
 Gets the user message.

Additional Inherited Members

 object ()=default
 Create a new instance of the ultimate base class object.
virtual auto equals (const object &obj) const noexcept -> bool
 Determines whether the specified object is equal to the current object.
virtual auto get_hash_code () const noexcept -> xtd::usize
 Serves as a hash function for a particular type.
virtual auto get_type () const noexcept -> type_object
 Gets the type of the current instance.
template<typename object_t>
auto memberwise_clone () const -> xtd::unique_ptr_object< object_t >
 Creates a shallow copy of the current object.
virtual auto to_string () const -> xtd::string
 Returns a xtd::string that represents the current object.
template<typename object_a_t, typename object_b_t>
static auto equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool
 Determines whether the specified object instances are considered equal.
template<typename object_a_t, typename object_b_t>
static auto reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool
 Determines whether the specified object instances are the same instance.

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::string & name,
const std::function< void()> & method,
const xtd::diagnostics::stack_frame & stack_frame = xtd::diagnostics::stack_frame::current() )
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::string & name,
const std::function< void()> & method,
bool ignore,
const xtd::diagnostics::stack_frame & stack_frame = xtd::diagnostics::stack_frame::current() )
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()

auto xtd::tunit::test::aborted ( ) const -> bool
nodiscardnoexcept

Gets a value that represent an aborted test.

Returns
true is the test is aborted; otherwise false.

◆ actual()

auto xtd::tunit::test::actual ( ) const -> const xtd::string &
nodiscardnoexcept

Gets the actual value string.

Returns
The actual value string. Can be empty.

◆ elapsed_time()

auto xtd::tunit::test::elapsed_time ( ) const -> xtd::time_span
nodiscardnoexcept

Gets the elapsed time of the test method.

Returns
The elapsed time of the test method.

◆ expect()

auto xtd::tunit::test::expect ( ) const -> const xtd::string &
nodiscardnoexcept

Gets the expect value string.

Returns
The expect value string. Can be empty.

◆ failed()

auto xtd::tunit::test::failed ( ) const -> bool
nodiscardnoexcept

Gest a value that represent an failed test.

Returns
tru is the test is failed; otherwise false.

◆ ignored()

auto xtd::tunit::test::ignored ( ) const -> bool
nodiscardnoexcept

Get a value that represent an ignored test.

Returns
true is the test is ignored; otherwise false.

◆ not_started()

auto xtd::tunit::test::not_started ( ) const -> bool
nodiscardnoexcept

Get a value that represent a not started test.

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

◆ succeed()

auto xtd::tunit::test::succeed ( ) const -> bool
nodiscardnoexcept

Gets a value that represent an succeed test.

Returns
true is the test is succeed; otherwise false.

◆ stack_frame()

auto xtd::tunit::test::stack_frame ( ) const -> const xtd::diagnostics::stack_frame &
nodiscardnoexcept

Gets the stack frame of the test method.

Returns
The stack frame of the test method.

◆ start_time()

auto xtd::tunit::test::start_time ( ) const -> const xtd::date_time &
nodiscardnoexcept

Gets the start time of the test method.

Returns
The start time of the test method.

◆ method()

auto xtd::tunit::test::method ( ) const -> std::function< void()>
nodiscardnoexcept

Gets the test method.

Returns
The test method.

◆ message()

auto xtd::tunit::test::message ( ) const -> const xtd::string &
nodiscardnoexcept

Gets the message.

Returns
The message.

◆ name()

auto xtd::tunit::test::name ( ) const -> const xtd::string &
nodiscardnoexcept

Gets the name of the test method.

Returns
The nzme of the test method.

◆ user_message()

auto xtd::tunit::test::user_message ( ) const -> const xtd::string &
nodiscardnoexcept

Gets the user message.

Returns
The user message.

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