xtd - Reference Guide  0.1.0
Modern c++17 framework to create console, gui and unit test applications on Windows, macOS and Linux.
xtd::tunit::ostream_event_listener Class Reference

The ostream_unit_test class is a specialisation of event_listener class for writing events in std::ostream. More...

#include <ostream_event_listener.h>

Inheritance diagram for xtd::tunit::ostream_event_listener:
xtd::tunit::event_listener

Public Member Functions

 ostream_event_listener (std::ostream &os) noexcept
 Creates new instance ostream event lister with ostream specified. More...
 
virtual void on_class_cleanup_end (const xtd::tunit::class_event_args &e) const
 Occurs when class cleanup is ended. More...
 
virtual void on_class_cleanup_start (const xtd::tunit::class_event_args &e) const
 Occurs when class cleanup is started. More...
 
virtual void on_class_end (const xtd::tunit::class_event_args &e) const
 Occurs when class is ended. More...
 
virtual void on_class_initialize_end (const xtd::tunit::class_event_args &e) const
 Occurs when class initialize is ended. More...
 
virtual void on_class_initialize_start (const xtd::tunit::class_event_args &e) const
 Occurs when class initialize is started. More...
 
virtual void on_class_start (const xtd::tunit::class_event_args &e) const
 Occurs when class is started. More...
 
void on_test_aborted (const xtd::tunit::test_event_args &e) const override
 Occurs when test is aborted. More...
 
virtual void on_test_cleanup_end (const xtd::tunit::test_event_args &e) const
 Occurs when test cleanup is ended. More...
 
virtual void on_test_cleanup_start (const xtd::tunit::test_event_args &e) const
 Occurs when test cleanup is started. More...
 
virtual void on_test_end (const xtd::tunit::test_event_args &e) const
 Occurs when test is ended. More...
 
void on_test_failed (const xtd::tunit::test_event_args &e) const override
 Occurs when test is failed. More...
 
void on_test_ignored (const xtd::tunit::test_event_args &e) const override
 Occurs when test is ignored. More...
 
virtual void on_test_initialize_end (const xtd::tunit::test_event_args &e) const
 Occurs when test initialize is ended. More...
 
virtual void on_test_initialize_start (const xtd::tunit::test_event_args &e) const
 Occurs when test initialize is ended. More...
 
virtual void on_test_start (const xtd::tunit::test_event_args &e) const
 Occurs when test initialize is started. More...
 
void on_test_succeed (const xtd::tunit::test_event_args &e) const override
 Occurs when test is succeed. More...
 
virtual void on_unit_test_cleanup_end (const xtd::tunit::tunit_event_args &e) const
 Occurs when unit test cleanup is ended. More...
 
virtual void on_unit_test_cleanup_start (const xtd::tunit::tunit_event_args &e) const
 Occurs when unit test is started. More...
 
void on_unit_test_end (const xtd::tunit::tunit_event_args &e) const override
 Occurs when unit test is ended. More...
 
virtual void on_unit_test_initialize_end (const xtd::tunit::tunit_event_args &e) const
 Occurs when unit test initalize is ended. More...
 
virtual void on_unit_test_initialize_start (const xtd::tunit::tunit_event_args &e) const
 Occurs when unit test initialize is ended. More...
 
void on_unit_test_start (const xtd::tunit::tunit_event_args &e) const override
 Occurs when unit test cleanup is started. More...
 

Detailed Description

The ostream_unit_test class is a specialisation of event_listener class for writing events in std::ostream.

Remarks
This class is use by console_unit_test.
you can use this class as you want as for example communicate between network.
Examples
The following examples show how to use ostream_event_listener.
#include <xtd/xtd.tunit>
#include <sstream>
using namespace std;
using namespace xtd::tunit;
namespace unit_tests {
class test_class_(test) {
public:
void test_method_(test_case1) {
}
};
}
int main() {
// create your own ostream in this case a string stream for example
stringstream ss;
// create and run an ostream_unit_test
int result = ostream_unit_test(ss).run();
// display string stream on cout line by line
string line;
while(std::getline(ss, line))
cout << line << endl;
return result;
}
// This code can produce the following output:
//
// Start 1 test from 1 test case
// Run tests:
// SUCCEED test.test_case1 (0 ms total)
//
// Test results:
// SUCCEED 1 test.
// End 1 test from 1 test case ran. (0 ms total)

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