xtd 0.2.0
collection_valid_all_items_are_instances_of.cpp

Shows how to use xtd::tunit::collection_valid::all_items_are_instances_of method.

#include <xtd/xtd.tunit>
using namespace xtd;
using namespace xtd::collections;
using namespace xtd::tunit;
namespace unit_tests {
class test_class_(test) {
void test_method_(test_case_succeed) {
}
void test_method_(test_case_failed) {
}
};
}
auto main() -> int {
return console_unit_test().run();
}
// This code produces the following output :
//
// Start 2 tests from 1 test case
// Run tests:
// SUCCEED unit_tests::test.test_case_succeed (0 ms total)
// FAILED unit_tests::test.test_case_failed (0 ms total)
// Expected: all items instance of <std::basic_ostream<char, std::char_traits<char> >*>
// But was: < 8-byte object <78-37 1D-8C FF-7F 00-00>, 8-byte object <B8-38 1D-8C FF-7F 00-00>, 8-byte object <30-36 1D-8C FF-7F 00-00> >
// Stack Trace: in |---OMITTED---|/collection_valid_all_items_are_instances_of.cpp:13
//
// Test results:
// SUCCEED 1 test.
// FAILED 1 test.
// End 2 tests from 1 test case ran. (1 ms total)
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
Definition list.hpp:79
static std::ostream error
Gets the error output stream. A std::basic_ostream<char_t> that represents the error output stream.
Definition console.hpp:42
static std::istream in
Gets the standard input stream. A std::basic_istream<char_t> that represents the standard input strea...
Definition console.hpp:47
static std::ostream out
Gets the standard output stream. A std::basic_ostream<char_t> that represents the standard output str...
Definition console.hpp:52
static void all_items_are_instances_of(const collection_t &collection, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Validates that all collection items are of the type supplied or a derived type.
Definition collection_valid.hpp:43
The console_unit_test class is console unit test interface.
Definition console_unit_test.hpp:23
int32 run() noexcept
Runs all tests in this unit_test object and prints the result.
#define test_method_(method_name)
Add test method to class test.
Definition test_method_attribute.hpp:72
@ a
The A key.
Definition console_key.hpp:88
The xtd::collections namespace contains interfaces and classes that define various collections of obj...
Definition any_pair.hpp:10
The tunit namespace contains a unit test library.
Definition abort_error.hpp:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8