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

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

#include <file_assert.h>

Inheritance diagram for xtd::tunit::file_assert:
xtd::tunit::base_assert

Static Public Member Functions

template<typename Char >
static void are_equal (const std::basic_istream< Char > &expected, const std::basic_istream< Char > &actual)
 Asserts that two files are equal. More...
 
template<typename Char >
static void are_equal (const std::basic_istream< Char > &expected, const std::basic_istream< Char > &actual, const xtd::tunit::line_info &line_info)
 Asserts that two files are equal. More...
 
template<typename Char >
static void are_equal (const std::basic_istream< Char > &expected, const std::basic_istream< Char > &actual, const std::string &message)
 Asserts that two files are equal. More...
 
template<typename Char >
static void are_equal (const std::basic_istream< Char > &expected, const std::basic_istream< Char > &actual, const std::string &message, const xtd::tunit::line_info &line_info)
 Asserts that two files are equal. More...
 
template<typename Char >
static void are_equal (const std::basic_string< Char > &expected, const std::basic_string< Char > &actual)
 Asserts that two files are equal. More...
 
template<typename Char >
static void are_equal (const std::basic_string< Char > &expected, const std::basic_string< Char > &actual, const xtd::tunit::line_info &line_info)
 Asserts that two files are equal. More...
 
template<typename Char >
static void are_equal (const std::basic_string< Char > &expected, const std::basic_string< Char > &actual, const std::string &message)
 Asserts that two files are equal. More...
 
template<typename Char >
static void are_equal (const std::basic_string< Char > &expected, const std::basic_string< Char > &actual, const std::string &message, const xtd::tunit::line_info &line_info)
 Asserts that two files are equal. More...
 
template<typename Char >
static void are_not_equal (const std::basic_istream< Char > &expected, const std::basic_istream< Char > &actual)
 Asserts that two files are not equal. More...
 
template<typename Char >
static void are_not_equal (const std::basic_istream< Char > &expected, const std::basic_istream< Char > &actual, const xtd::tunit::line_info &line_info)
 Asserts that two files are not equal. More...
 
template<typename Char >
static void are_not_equal (const std::basic_istream< Char > &expected, const std::basic_istream< Char > &actual, const std::string &message)
 Asserts that two files are not equal. More...
 
template<typename Char >
static void are_not_equal (const std::basic_istream< Char > &expected, const std::basic_istream< Char > &actual, const std::string &message, const xtd::tunit::line_info &line_info)
 Asserts that two files are not equal. More...
 
template<typename Char >
static void are_not_equal (const std::basic_string< Char > &expected, const std::basic_string< Char > &actual)
 Asserts that two files are not equal. More...
 
template<typename Char >
static void are_not_equal (const std::basic_string< Char > &expected, const std::basic_string< Char > &actual, const xtd::tunit::line_info &line_info)
 Asserts that two files are not equal. More...
 
template<typename Char >
static void are_not_equal (const std::basic_string< Char > &expected, const std::basic_string< Char > &actual, const std::string &message)
 Asserts that two files are not equal. More...
 
template<typename Char >
static void are_not_equal (const std::basic_string< Char > &expected, const std::basic_string< Char > &actual, const std::string &message, const xtd::tunit::line_info &line_info)
 Asserts that two files are not equal. More...
 
template<typename Char >
static void does_not_exist (const std::basic_string< Char > &file)
 Asserts that file not exists. More...
 
template<typename Char >
static void does_not_exist (const std::basic_string< Char > &file, 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 > &file, const std::string &message)
 Asserts that file not exists. More...
 
template<typename Char >
static void does_not_exist (const std::basic_string< Char > &file, 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 > &file)
 Asserts that file exists. More...
 
template<typename Char >
static void exists (const std::basic_string< Char > &file, const xtd::tunit::line_info &line_info)
 Asserts that file exists. More...
 
template<typename Char >
static void exists (const std::basic_string< Char > &file, const std::string &message)
 Asserts that file exists. More...
 
template<typename Char >
static void exists (const std::basic_string< Char > &file, const std::string &message, const xtd::tunit::line_info &line_info)
 Asserts that file 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 file_assert class contains a collection of static methods that implement the most file assertions used in xtd::tUnit.

Examples
This example show how to used some methods :

Member Function Documentation

§ are_equal() [1/8]

template<typename Char >
static void xtd::tunit::file_assert::are_equal ( const std::basic_istream< Char > &  expected,
const std::basic_istream< Char > &  actual 
)
inlinestatic

Asserts that two files are equal.

Parameters
expectedthe expected value.
actualthe actual value.
Exceptions
xtd::tunit::assertion_errorIf bad assertion.
Examples
std::stringstream s1;
s1 << "Test";
s1.seekg(0, std::ios::beg);
std::stringstream s2;
s2 << "Test";
s2.seekg(0, std::ios::beg);
s2 << "Test2";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assert::are_equal(s2, s1); // test throws an assertion_error exception.

§ are_equal() [2/8]

template<typename Char >
static void xtd::tunit::file_assert::are_equal ( const std::basic_istream< Char > &  expected,
const std::basic_istream< Char > &  actual,
const xtd::tunit::line_info line_info 
)
inlinestatic

Asserts that two files are equal.

Parameters
expectedthe expected value.
actualthe actual value.
line_infoContains information about current file and current line.
Exceptions
xtd::tunit::assertion_errorIf bad assertion.
Examples
std::stringstream s1;
s1 << "Test";
s1.seekg(0, std::ios::beg);
std::stringstream s2;
s2 << "Test";
s2.seekg(0, std::ios::beg);
s2 << "Test2";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assert::are_equal(s2, s1, line_info_); // test throws an assertion_error exception.

§ are_equal() [3/8]

template<typename Char >
static void xtd::tunit::file_assert::are_equal ( const std::basic_istream< Char > &  expected,
const std::basic_istream< Char > &  actual,
const std::string &  message 
)
inlinestatic

Asserts that two files are equal.

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.
Exceptions
xtd::tunit::assertion_errorIf bad assertion.
Examples
std::stringstream s1;
s1 << "Test";
s1.seekg(0, std::ios::beg);
std::stringstream s2;
s2 << "Test";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assert::are_equal(s2, s1, "User message..."); // test ok.
s2 << "Test2";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assert::are_equal(s2, s1, "User message..."); // test throws an assertion_error exception.

§ are_equal() [4/8]

template<typename Char >
static void xtd::tunit::file_assert::are_equal ( const std::basic_istream< Char > &  expected,
const std::basic_istream< Char > &  actual,
const std::string &  message,
const xtd::tunit::line_info line_info 
)
inlinestatic

Asserts that two files are equal.

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.
Exceptions
xtd::tunit::assertion_errorIf bad assertion.
Examples
std::stringstream s1;
s1 << "Test";
s1.seekg(0, std::ios::beg);
std::stringstream s2;
s2 << "Test";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assert::are_equal(s2, s1, "User message...", line_info_); // test ok.
s2 << "Test2";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assert::are_equal(s2, s1, "User message...", line_info_); // test throws an assertion_error exception.

§ are_equal() [5/8]

template<typename Char >
static void xtd::tunit::file_assert::are_equal ( const std::basic_string< Char > &  expected,
const std::basic_string< Char > &  actual 
)
inlinestatic

Asserts that two files are equal.

Parameters
expectedthe expected value.
actualthe actual value.
Exceptions
xtd::tunit::assertion_errorIf bad assertion.
Examples
std::stringstream s1;
s1 << "Test";
s1.seekg(0, std::ios::beg);
std::stringstream s2;
s2 << "Test";
s2.seekg(0, std::ios::beg);
s2 << "Test2";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assert::are_equal(s2, s1); // test throws an assertion_error exception.

§ are_equal() [6/8]

template<typename Char >
static void xtd::tunit::file_assert::are_equal ( const std::basic_string< Char > &  expected,
const std::basic_string< Char > &  actual,
const xtd::tunit::line_info line_info 
)
inlinestatic

Asserts that two files are equal.

Parameters
expectedthe expected value.
actualthe actual value.
line_infoContains information about current file and current line.
Exceptions
xtd::tunit::assertion_errorIf bad assertion.
Examples
std::stringstream s1;
s1 << "Test";
s1.seekg(0, std::ios::beg);
std::stringstream s2;
s2 << "Test";
s2.seekg(0, std::ios::beg);
s2 << "Test2";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assert::are_equal(s2, s1, line_info_); // test throws an assertion_error exception.

§ are_equal() [7/8]

template<typename Char >
static void xtd::tunit::file_assert::are_equal ( const std::basic_string< Char > &  expected,
const std::basic_string< Char > &  actual,
const std::string &  message 
)
inlinestatic

Asserts that two files are equal.

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.
Exceptions
xtd::tunit::assertion_errorIf bad assertion.
Examples
std::stringstream s1;
s1 << "Test";
s1.seekg(0, std::ios::beg);
std::stringstream s2;
s2 << "Test";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assert::are_equal(s2, s1, "User message..."); // test ok.
s2 << "Test2";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assert::are_equal(s2, s1, "User message..."); // test throws an assertion_error exception.

§ are_equal() [8/8]

template<typename Char >
static void xtd::tunit::file_assert::are_equal ( const std::basic_string< Char > &  expected,
const std::basic_string< Char > &  actual,
const std::string &  message,
const xtd::tunit::line_info line_info 
)
inlinestatic

Asserts that two files are equal.

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.
Exceptions
xtd::tunit::assertion_errorIf bad assertion.
Examples
std::stringstream s1;
s1 << "Test";
s1.seekg(0, std::ios::beg);
std::stringstream s2;
s2 << "Test";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assert::are_equal(s2, s1, "User message...", line_info_); // test ok.
s2 << "Test2";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assert::are_equal(s2, s1, "User message...", line_info_); // test throws an assertion_error exception.

§ are_not_equal() [1/8]

template<typename Char >
static void xtd::tunit::file_assert::are_not_equal ( const std::basic_istream< Char > &  expected,
const std::basic_istream< Char > &  actual 
)
inlinestatic

Asserts that two files are not equal.

Parameters
expectedthe expected value.
actualthe actual value.
Exceptions
xtd::tunit::assertion_errorIf bad assertion.
Examples
std::stringstream s1;
s1 << "Test";
s1.seekg(0, std::ios::beg);
std::stringstream s2;
s2 << "Test2";
s2.seekg(0, std::ios::beg);
s2 << "Test";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assert::are_not_equal(s2, s1); // test throws an assertion_error exception.

§ are_not_equal() [2/8]

template<typename Char >
static void xtd::tunit::file_assert::are_not_equal ( const std::basic_istream< Char > &  expected,
const std::basic_istream< Char > &  actual,
const xtd::tunit::line_info line_info 
)
inlinestatic

Asserts that two files are not equal.

Parameters
expectedthe expected value.
actualthe actual value.
line_infoContains information about current file and current line.
Exceptions
xtd::tunit::assertion_errorIf bad assertion.
Examples
std::stringstream s1;
s1 << "Test";
s1.seekg(0, std::ios::beg);
std::stringstream s2;
s2 << "Test2";
s2.seekg(0, std::ios::beg);
s2 << "Test";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assert::are_not_equal(s2, s1, line_info_); // test throws an assertion_error exception.

§ are_not_equal() [3/8]

template<typename Char >
static void xtd::tunit::file_assert::are_not_equal ( const std::basic_istream< Char > &  expected,
const std::basic_istream< Char > &  actual,
const std::string &  message 
)
inlinestatic

Asserts that two files are not equal.

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.
Exceptions
xtd::tunit::assertion_errorIf bad assertion.
Examples
std::stringstream s1;
s1 << "Test";
s1.seekg(0, std::ios::beg);
std::stringstream s2;
s2 << "Test2";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assert::are_not_equal(s2, s1, "User message..."); // test ok.
s2 << "Test";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assert::are_not_equal(s2, s1, "User message..."); // test throws an assertion_error exception.

§ are_not_equal() [4/8]

template<typename Char >
static void xtd::tunit::file_assert::are_not_equal ( const std::basic_istream< Char > &  expected,
const std::basic_istream< Char > &  actual,
const std::string &  message,
const xtd::tunit::line_info line_info 
)
inlinestatic

Asserts that two files are not equal.

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.
Exceptions
xtd::tunit::assertion_errorIf bad assertion.
Examples
std::stringstream s1;
s1 << "Test";
s1.seekg(0, std::ios::beg);
std::stringstream s2;
s2 << "Test2";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assert::are_not_equal(s2, s1, "User message...", line_info_); // test ok.
s2 << "Test";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assert::are_not_equal(s2, s1, "User message...", line_info_); // test throws an assertion_error exception.

§ are_not_equal() [5/8]

template<typename Char >
static void xtd::tunit::file_assert::are_not_equal ( const std::basic_string< Char > &  expected,
const std::basic_string< Char > &  actual 
)
inlinestatic

Asserts that two files are not equal.

Parameters
expectedthe expected value.
actualthe actual value.
Exceptions
xtd::tunit::assertion_errorIf bad assertion.
Examples
std::stringstream s1;
s1 << "Test";
s1.seekg(0, std::ios::beg);
std::stringstream s2;
s2 << "Test2";
s2.seekg(0, std::ios::beg);
s2 << "Test";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assert::are_not_equal(s2, s1); // test throws an assertion_error exception.

§ are_not_equal() [6/8]

template<typename Char >
static void xtd::tunit::file_assert::are_not_equal ( const std::basic_string< Char > &  expected,
const std::basic_string< Char > &  actual,
const xtd::tunit::line_info line_info 
)
inlinestatic

Asserts that two files are not equal.

Parameters
expectedthe expected value.
actualthe actual value.
line_infoContains information about current file and current line.
Exceptions
xtd::tunit::assertion_errorIf bad assertion.
Examples
std::stringstream s1;
s1 << "Test";
s1.seekg(0, std::ios::beg);
std::stringstream s2;
s2 << "Test2";
s2.seekg(0, std::ios::beg);
s2 << "Test";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assert::are_not_equal(s2, s1, line_info_); // test throws an assertion_error exception.

§ are_not_equal() [7/8]

template<typename Char >
static void xtd::tunit::file_assert::are_not_equal ( const std::basic_string< Char > &  expected,
const std::basic_string< Char > &  actual,
const std::string &  message 
)
inlinestatic

Asserts that two files are not equal.

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.
Exceptions
xtd::tunit::assertion_errorIf bad assertion.
Examples
std::stringstream s1;
s1 << "Test";
s1.seekg(0, std::ios::beg);
std::stringstream s2;
s2 << "Test2";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assert::are_not_equal(s2, s1, "User message..."); // test ok.
s2 << "Test";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assert::are_not_equal(s2, s1, "User message..."); // test throws an assertion_error exception.

§ are_not_equal() [8/8]

template<typename Char >
static void xtd::tunit::file_assert::are_not_equal ( const std::basic_string< Char > &  expected,
const std::basic_string< Char > &  actual,
const std::string &  message,
const xtd::tunit::line_info line_info 
)
inlinestatic

Asserts that two files are not equal.

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.
Exceptions
xtd::tunit::assertion_errorIf bad assertion.
Examples
std::stringstream s1;
s1 << "Test";
s1.seekg(0, std::ios::beg);
std::stringstream s2;
s2 << "Test2";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assert::are_not_equal(s2, s1, "User message...", line_info_); // test ok.
s2 << "Test";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assert::are_not_equal(s2, s1, "User message...", line_info_); // test throws an assertion_error exception.

§ does_not_exist() [1/4]

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

Asserts that file not exists.

Parameters
expectedthe expected value.
actualthe actual value.
Exceptions
xtd::tunit::assertion_errorIf bad assertion.
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 throws an assertion_error exception.

§ does_not_exist() [2/4]

template<typename Char >
static void xtd::tunit::file_assert::does_not_exist ( const std::basic_string< Char > &  file,
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.
Exceptions
xtd::tunit::assertion_errorIf bad assertion.
Examples
std::ifstream f1("Test1.txt");
f1.close();
xtd::tunit::file_assert::does_not_exist("Test1.txt", line_info_); // test throws an assertion_error exception.

§ does_not_exist() [3/4]

template<typename Char >
static void xtd::tunit::file_assert::does_not_exist ( const std::basic_string< Char > &  file,
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.
Exceptions
xtd::tunit::assertion_errorIf bad assertion.
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 throws an assertion_error exception.

§ does_not_exist() [4/4]

template<typename Char >
static void xtd::tunit::file_assert::does_not_exist ( const std::basic_string< Char > &  file,
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.
Exceptions
xtd::tunit::assertion_errorIf bad assertion.
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 throws an assertion_error exception.

§ exists() [1/4]

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

Asserts that file exists.

Parameters
expectedthe expected value.
actualthe actual value.
Exceptions
xtd::tunit::assertion_errorIf bad assertion.
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 throws an assertion_error exception.

§ exists() [2/4]

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

Asserts that file exists.

Parameters
expectedthe expected value.
actualthe actual value.
line_infoContains information about current file and current line.
Exceptions
xtd::tunit::assertion_errorIf bad assertion.
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 throws an assertion_error exception.

§ exists() [3/4]

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

Asserts that file 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.
Exceptions
xtd::tunit::assertion_errorIf bad assertion.
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 throws an assertion_error exception.

§ exists() [4/4]

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

Asserts that file 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.
Exceptions
xtd::tunit::assertion_errorIf bad assertion.
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 throws an assertion_error exception.

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