xtd.tunit - Reference Guide  1.0.0
Modern c++17 unit testing framework on Windows, macOS, Linux, iOS and android.
xtd::tunit::directory_valid Class Referencefinal

The directory_valid class contains a collection of static methods that implement the most directory assertions used in xtd::tUnit. More...

#include <directory_valid.h>

Inheritance diagram for xtd::tunit::directory_valid:
xtd::tunit::base_assert

Static Public Member Functions

template<typename Char >
static void does_not_exist (const std::basic_string< Char > &directory)
 Asserts that file not exists. More...
 
template<typename Char >
static void does_not_exist (const std::basic_string< Char > &directory, const xtd::tunit::line_info &line_info)
 Asserts that file not exists. More...
 
template<typename Char >
static void does_not_exist (const std::basic_string< Char > &directory, const std::string &message)
 Asserts that file not exists. More...
 
template<typename Char >
static void does_not_exist (const std::basic_string< Char > &directory, const std::string &message, const xtd::tunit::line_info &line_info)
 Asserts that file not exists. More...
 
template<typename Char >
static void exists (const std::basic_string< Char > &directory)
 Asserts that directory exists. More...
 
template<typename Char >
static void exists (const std::basic_string< Char > &directory, const xtd::tunit::line_info &line_info)
 Asserts that directory exists. More...
 
template<typename Char >
static void exists (const std::basic_string< Char > &directory, const std::string &message)
 Asserts that directory exists. More...
 
template<typename Char >
static void exists (const std::basic_string< Char > &directory, const std::string &message, const xtd::tunit::line_info &line_info)
 Asserts that directory exists. More...
 

Static Private Member Functions

static void abort ()
 Abort current test. More...
 
static void abort (const xtd::tunit::line_info &line_info)
 Abort current test. More...
 
static void abort (const std::string &message)
 Abort current test. More...
 
static void abort (const std::string &message, const xtd::tunit::line_info &line_info)
 Abort current test. More...
 
static void error ()
 
static void error (const std::string &actual, const std::string &expected, const std::string &message, const xtd::tunit::line_info &line_info)
 
static void fail ()
 Throws an xtd::tunit::assertion_error exception. More...
 
static void fail (const xtd::tunit::line_info &line_info)
 Throws an xtd::tunit::assertion_error exception. More...
 
static void fail (const std::string &message)
 Throws an xtd::tunit::assertion_error exception. More...
 
static void fail (const std::string &message, const xtd::tunit::line_info &line_info)
 Throws an xtd::tunit::assertion_error exception. More...
 
static void fail (const std::string &actual, const std::string &expected, const std::string &message, const xtd::tunit::line_info &line_info)
 
static void ignore ()
 Ignore current test. More...
 
static void ignore (const xtd::tunit::line_info &line_info)
 Ignore current test. More...
 
static void ignore (const std::string &message)
 Ignore current test. More...
 
static void ignore (const std::string &message, const xtd::tunit::line_info &line_info)
 Ignore current test. More...
 
template<typename TCollection >
static std::string join_items (const TCollection &collection)
 
static std::string join_items (const std::string &str)
 
static void succeed ()
 Generates a success with a generic message. More...
 
static void succeed (const xtd::tunit::line_info &line_info)
 Generates a success with a generic message. More...
 
static void succeed (const std::string &message)
 Generates a success with a generic message. More...
 
static void succeed (const std::string &message, const xtd::tunit::line_info &line_info)
 Generates a success with a generic message. More...
 
template<typename TValue >
static std::string to_string (const TValue &value)
 
template<typename TValue >
static std::string to_string (const TValue *value)
 

Detailed Description

The directory_valid class contains a collection of static methods that implement the most directory assertions used in xtd::tUnit.

Examples
This example show how to used some methods :

Member Function Documentation

§ does_not_exist() [1/4]

template<typename Char >
static void xtd::tunit::directory_valid::does_not_exist ( const std::basic_string< Char > &  directory)
inlinestatic

Asserts that file not exists.

Parameters
expectedthe expected value.
actualthe actual value.
Examples
std::ifstream f1("Test1.txt");
f1.close();
xtd::tunit::file_assert::does_not_exist("Test2.txt"); // test ok.
xtd::tunit::file_assert::does_not_exist("Test1.txt"); // test fails.

§ does_not_exist() [2/4]

template<typename Char >
static void xtd::tunit::directory_valid::does_not_exist ( const std::basic_string< Char > &  directory,
const xtd::tunit::line_info line_info 
)
inlinestatic

Asserts that file not exists.

Parameters
expectedthe expected value.
actualthe actual value.
line_infoContains information about current file and current line.
Examples
std::ifstream f1("Test1.txt");
f1.close();

§ does_not_exist() [3/4]

template<typename Char >
static void xtd::tunit::directory_valid::does_not_exist ( const std::basic_string< Char > &  directory,
const std::string &  message 
)
inlinestatic

Asserts that file not exists.

Parameters
expectedthe expected value.
actualthe actual value.
messageA user message to display if the assertion fails. This message can be seen in the unit test results.
Examples
std::ifstream f1("Test1.txt");
f1.close();
xtd::tunit::file_assert::does_not_exist("Test2.txt", "User message..."); // test ok.
xtd::tunit::file_assert::does_not_exist("Test1.txt", "User message..."); // test fails.

§ does_not_exist() [4/4]

template<typename Char >
static void xtd::tunit::directory_valid::does_not_exist ( const std::basic_string< Char > &  directory,
const std::string &  message,
const xtd::tunit::line_info line_info 
)
inlinestatic

Asserts that file not exists.

Parameters
expectedthe expected value.
actualthe actual value.
messageA user message to display if the assertion fails. This message can be seen in the unit test results.
line_infoContains information about current file and current line.
Examples
std::ifstream f1("Test1.txt");
f1.close();
xtd::tunit::file_assert::does_not_exist("Test2.txt" "User message...", line_info_); // test ok.
xtd::tunit::file_assert::does_not_exist("Test1.txt", "User message...", line_info_); // test fails.

§ exists() [1/4]

template<typename Char >
static void xtd::tunit::directory_valid::exists ( const std::basic_string< Char > &  directory)
inlinestatic

Asserts that directory exists.

Parameters
expectedthe expected value.
actualthe actual value.
Examples
std::ifstream f1("Test1.txt");
f1.close();
xtd::tunit::file_assert::exists("Test1.txt"); // test ok.
xtd::tunit::file_assert::exists("Test2.txt"); // test fails.

§ exists() [2/4]

template<typename Char >
static void xtd::tunit::directory_valid::exists ( const std::basic_string< Char > &  directory,
const xtd::tunit::line_info line_info 
)
inlinestatic

Asserts that directory exists.

Parameters
expectedthe expected value.
actualthe actual value.
line_infoContains information about current file and current line.
Examples
std::ifstream f1("Test1.txt");
f1.close();
xtd::tunit::file_assert::exists("Test1.txt", line_info_); // test ok.
xtd::tunit::file_assert::exists("Test2.txt", line_info_); // test fails.

§ exists() [3/4]

template<typename Char >
static void xtd::tunit::directory_valid::exists ( const std::basic_string< Char > &  directory,
const std::string &  message 
)
inlinestatic

Asserts that directory exists.

Parameters
expectedthe expected value.
actualthe actual value.
messageA user message to display if the assertion fails. This message can be seen in the unit test results.
Examples
std::ifstream f1("Test1.txt");
f1.close();
xtd::tunit::file_assert::exists("Test1.txt", "User message..."); // test ok.
xtd::tunit::file_assert::exists("Test2.txt", "User message..."); // test fails.

§ exists() [4/4]

template<typename Char >
static void xtd::tunit::directory_valid::exists ( const std::basic_string< Char > &  directory,
const std::string &  message,
const xtd::tunit::line_info line_info 
)
inlinestatic

Asserts that directory exists.

Parameters
expectedthe expected value.
actualthe actual value.
messageA user message to display if the assertion fails. This message can be seen in the unit test results.
line_infoContains information about current file and current line.
Examples
std::ifstream f1("Test1.txt");
f1.close();
xtd::tunit::file_assert::exists("Test1.txt" "User message...", line_info_); // test ok.
xtd::tunit::file_assert::exists("Test2.txt", "User message...", line_info_); // test fails.

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