xtd 0.2.0
xtd::tunit::directory_assume Class Referencefinal

Definition

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

Namespace
xtd::tunit
Library
xtd.tunit
Remarks
Assumptions are intended to express the state a test must be in to provide a meaningful result. They are functionally similar to assertions, however a unmet assumption will produce an aborted test result, as opposed to a failure.
Examples
This example show how to used some methods :
#include <xtd/xtd.tunit>
#include <stdexcept>
using namespace xtd;
using namespace xtd::io;
using namespace xtd::tunit;
namespace unit_tests {
// The class test must be declared with test_class_ helper.
class test_class_(test) {
public:
void test_method_(test_case1) {
directory_assume::exists(path::get_temp_path());
}
void test_method_(test_case2) {
directory_assume::exists(path::combine("unknown root folder", "unknown sub folder", "unknown xtd example folder"));
}
void test_method_(test_case3) {
}
};
}
auto main()->int {
return console_unit_test().run();
}
// This code can produce the following output:
//
// Start 3 tests from 1 test case
// Run tests:
// SUCCEED test.test_case1 (0 ms total)
// ABORTD test.test_case2 (0 ms total)
// Test aborted
// Expected: directory exists
// But was: "unknown root folder/unknown sub folder/unknown xtd example folder"
// Stack Trace: in |---OMITTED---|/directory_assume.cpp:16
// ABORTED test.test_case3 (0 ms total)
// Test aborted
// Expected: "|---OMITTED---|/Music"
// But was: "|---OMITTED---|/Movies"
// Stack Trace: in |---OMITTED---|/directory_assume.cpp:20
//
// Test results:
// SUCCEED 1 test.
// ABORTED 2 tests.
// End 3 tests from 1 test case ran. (0 ms total)

Methods

static void are_equal (const std::filesystem::directory_entry &expected, const std::filesystem::directory_entry &actual)
 Assumes that two directories are equal. More...
 
static void are_equal (const std::filesystem::directory_entry &expected, const std::filesystem::directory_entry &actual, const xtd::diagnostics::stack_frame &stack_frame)
 Assumes that two directories are equal. More...
 
static void are_equal (const std::filesystem::directory_entry &expected, const std::filesystem::directory_entry &actual, const std::string &message)
 Assumes that two directories are equal. More...
 
static void are_equal (const std::filesystem::directory_entry &expected, const std::filesystem::directory_entry &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
 Assumes that two directories are equal. More...
 
static void are_equal (const xtd::io::directory_info &expected, const xtd::io::directory_info &actual)
 Assumes that two xtd::io::directory_info are equal. More...
 
static void are_equal (const xtd::io::directory_info &expected, const xtd::io::directory_info &actual, const xtd::diagnostics::stack_frame &stack_frame)
 Assumes that two xtd::io::directory_info are equal. More...
 
static void are_equal (const xtd::io::directory_info &expected, const xtd::io::directory_info &actual, const std::string &message)
 Assumes that two xtd::io::directory_info are equal. More...
 
static void are_equal (const xtd::io::directory_info &expected, const xtd::io::directory_info &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
 Assumes that two xtd::io::directory_info are equal. More...
 
static void are_not_equal (const std::filesystem::directory_entry &expected, const std::filesystem::directory_entry &actual)
 Assumes that two std::filesystem::directory_entry are not equal. More...
 
static void are_not_equal (const std::filesystem::directory_entry &expected, const std::filesystem::directory_entry &actual, const xtd::diagnostics::stack_frame &stack_frame)
 Assumes that two std::filesystem::directory_entry are not equal. More...
 
static void are_not_equal (const std::filesystem::directory_entry &expected, const std::filesystem::directory_entry &actual, const std::string &message)
 Assumes that two std::filesystem::directory_entry are not equal. More...
 
static void are_not_equal (const std::filesystem::directory_entry &expected, const std::filesystem::directory_entry &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
 Assumes that two std::filesystem::directory_entry are not equal. More...
 
static void are_not_equal (const xtd::io::directory_info &expected, const xtd::io::directory_info &actual)
 Assumes that two xtd::io::directory_info are not equal. More...
 
static void are_not_equal (const xtd::io::directory_info &expected, const xtd::io::directory_info &actual, const xtd::diagnostics::stack_frame &stack_frame)
 Assumes that two xtd::io::directory_info are not equal. More...
 
static void are_not_equal (const xtd::io::directory_info &expected, const xtd::io::directory_info &actual, const std::string &message)
 Assumes that two xtd::io::directory_info are not equal. More...
 
static void are_not_equal (const xtd::io::directory_info &expected, const xtd::io::directory_info &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
 Assumes that two xtd::io::directory_info are not equal. More...
 
static void does_not_exist (const std::filesystem::directory_entry &directory)
 Assumes that directory not exists. More...
 
static void does_not_exist (const std::filesystem::directory_entry &directory, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that directory not exists. More...
 
static void does_not_exist (const std::filesystem::directory_entry &directory, const std::string &message)
 Assumes that directory not exists. More...
 
static void does_not_exist (const std::filesystem::directory_entry &directory, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
 Assumes that directory not exists. More...
 
static void does_not_exist (const xtd::io::directory_info &directory)
 Assumes that directory not exists. More...
 
static void does_not_exist (const xtd::io::directory_info &directory, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that directory not exists. More...
 
static void does_not_exist (const xtd::io::directory_info &directory, const std::string &message)
 Assumes that directory not exists. More...
 
static void does_not_exist (const xtd::io::directory_info &directory, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
 Assumes that directory not exists. More...
 
template<typename char_t >
static void does_not_exist (const std::basic_string< char_t > &directory)
 Assumes that file not exists. More...
 
template<typename char_t >
static void does_not_exist (const std::basic_string< char_t > &directory, const xtd::diagnostics::stack_frame &stack_frame)
 Assumes that file not exists. More...
 
template<typename char_t >
static void does_not_exist (const std::basic_string< char_t > &directory, const std::string &message)
 Assumes that file not exists. More...
 
template<typename char_t >
static void does_not_exist (const std::basic_string< char_t > &directory, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
 Assumes that file not exists. More...
 
static void exists (const std::filesystem::directory_entry &directory)
 Assumes that directory exists. More...
 
static void exists (const std::filesystem::directory_entry &directory, const xtd::diagnostics::stack_frame &stack_frame)
 Assumes that directory exists. More...
 
static void exists (const std::filesystem::directory_entry &directory, const std::string &message)
 Assumes that directory exists. More...
 
static void exists (const std::filesystem::directory_entry &directory, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
 Assumes that directory exists. More...
 
static void exists (const xtd::io::directory_info &directory)
 Assumes that directory exists. More...
 
static void exists (const xtd::io::directory_info &directory, const xtd::diagnostics::stack_frame &stack_frame)
 Assumes that directory exists. More...
 
static void exists (const xtd::io::directory_info &directory, const std::string &message)
 Assumes that directory exists. More...
 
static void exists (const xtd::io::directory_info &directory, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
 Assumes that directory exists. More...
 
template<typename char_t >
static void exists (const std::basic_string< char_t > &directory)
 Assumes that directory exists. More...
 
template<typename char_t >
static void exists (const std::basic_string< char_t > &directory, const xtd::diagnostics::stack_frame &stack_frame)
 Assumes that directory exists. More...
 
template<typename char_t >
static void exists (const std::basic_string< char_t > &directory, const std::string &message)
 Assumes that directory exists. More...
 
template<typename char_t >
static void exists (const std::basic_string< char_t > &directory, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
 Assumes that directory exists. More...
 

Member Function Documentation

◆ are_equal() [1/8]

static void xtd::tunit::directory_assume::are_equal ( const std::filesystem::directory_entry &  expected,
const std::filesystem::directory_entry &  actual 
)
static

Assumes that two directories are equal.

Parameters
expectedthe expected value.
actualthe actual value.
Exceptions
xtd::tunit::abort_errorIf bad assertion.
Examples
...
xtd::tunit::directory_assume::are_equal(d1, d2); // test ok.
xtd::tunit::directory_assume::are_equal(d1, d2); // test throws an abort_error exception.

◆ are_equal() [2/8]

static void xtd::tunit::directory_assume::are_equal ( const std::filesystem::directory_entry &  expected,
const std::filesystem::directory_entry &  actual,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Assumes that two directories are equal.

Parameters
expectedthe expected value.
actualthe actual value.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::abort_errorIf bad assertion.
Examples
...
xtd::tunit::directory_assume::are_equal(d1, d2, csf_); // test ok.
xtd::tunit::directory_assume::are_equal(d1, d2, csf_); // test throws an abort_error exception.

◆ are_equal() [3/8]

static void xtd::tunit::directory_assume::are_equal ( const std::filesystem::directory_entry &  expected,
const std::filesystem::directory_entry &  actual,
const std::string &  message 
)
static

Assumes that two directories 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::abort_errorIf bad assertion.
Examples
...
xtd::tunit::directory_assume::are_equal(d1, d2, "User message..."); // test ok.
xtd::tunit::directory_assume::are_equal(d1, d2, "User message..."); // test throws an abort_error exception.

◆ are_equal() [4/8]

static void xtd::tunit::directory_assume::are_equal ( const std::filesystem::directory_entry &  expected,
const std::filesystem::directory_entry &  actual,
const std::string &  message,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Assumes that two directories 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.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::abort_errorIf bad assertion.
Examples
...
xtd::tunit::directory_assume::are_equal(d1, d2, "User message...", csf_); // test ok.
xtd::tunit::directory_assume::are_equal(d1, d2, "User message...", csf_); // test throws an abort_error exception.

◆ are_equal() [5/8]

static void xtd::tunit::directory_assume::are_equal ( const xtd::io::directory_info expected,
const xtd::io::directory_info actual 
)
static

Assumes that two xtd::io::directory_info are equal.

Parameters
expectedthe expected value.
actualthe actual value.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::io::directory_info d3("..")
xtd::tunit::directory_assume::are_equal(d1, d2); // test ok.
xtd::tunit::directory_assume::are_equal(d1, d3); // test throws an assert_error exception.

◆ are_equal() [6/8]

static void xtd::tunit::directory_assume::are_equal ( const xtd::io::directory_info expected,
const xtd::io::directory_info actual,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Assumes that two xtd::io::directory_info are equal.

Parameters
expectedthe expected value.
actualthe actual value.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::io::directory_info d3("..")
xtd::tunit::directory_assume::are_equal(d1, d2, csf_); // test ok.
xtd::tunit::directory_assume::are_equal(d1, d3, csf_); // test throws an assert_error exception.

◆ are_equal() [7/8]

static void xtd::tunit::directory_assume::are_equal ( const xtd::io::directory_info expected,
const xtd::io::directory_info actual,
const std::string &  message 
)
static

Assumes that two xtd::io::directory_info 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::assert_errorIf bad assertion.
Examples
xtd::io::directory_info d3("..")
xtd::tunit::directory_assume::are_equal(d1, d2, "User message..."); // test ok.
xtd::tunit::directory_assume::are_equal(d1, d3, "User message..."); // test throws an assert_error exception.

◆ are_equal() [8/8]

static void xtd::tunit::directory_assume::are_equal ( const xtd::io::directory_info expected,
const xtd::io::directory_info actual,
const std::string &  message,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Assumes that two xtd::io::directory_info 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.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::io::directory_info d3("..")
xtd::tunit::directory_assume::are_equal(d1, d2, "User message...", csf_); // test ok.
xtd::tunit::directory_assume::are_equal(d1, d3, "User message...", csf_); // test throws an assert_error exception.

◆ are_not_equal() [1/8]

static void xtd::tunit::directory_assume::are_not_equal ( const std::filesystem::directory_entry &  expected,
const std::filesystem::directory_entry &  actual 
)
static

Assumes that two std::filesystem::directory_entry are not equal.

Parameters
expectedthe expected value.
actualthe actual value.
Exceptions
xtd::tunit::abort_errorIf bad assertion.
Examples
...
xtd::tunit::directory_assume::are_not_equal(d1, d2, "User message...", csf_); // test ok.
xtd::tunit::directory_assume::are_not_equal(d1, d2, "User message...", csf_); // test throws an abort_error exception.

◆ are_not_equal() [2/8]

static void xtd::tunit::directory_assume::are_not_equal ( const std::filesystem::directory_entry &  expected,
const std::filesystem::directory_entry &  actual,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Assumes that two std::filesystem::directory_entry are not equal.

Parameters
expectedthe expected value.
actualthe actual value.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::abort_errorIf bad assertion.
Examples
...
xtd::tunit::directory_assume::are_not_equal(d1, d2, "User message...", csf_); // test ok.
xtd::tunit::directory_assume::are_not_equal(d1, d2, "User message...", csf_); // test throws an abort_error exception.

◆ are_not_equal() [3/8]

static void xtd::tunit::directory_assume::are_not_equal ( const std::filesystem::directory_entry &  expected,
const std::filesystem::directory_entry &  actual,
const std::string &  message 
)
static

Assumes that two std::filesystem::directory_entry 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::abort_errorIf bad assertion.
Examples
...
xtd::tunit::directory_assume::are_not_equal(d1, d2, "User message...", csf_); // test ok.
xtd::tunit::directory_assume::are_not_equal(d1, d2, "User message...", csf_); // test throws an abort_error exception.

◆ are_not_equal() [4/8]

static void xtd::tunit::directory_assume::are_not_equal ( const std::filesystem::directory_entry &  expected,
const std::filesystem::directory_entry &  actual,
const std::string &  message,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Assumes that two std::filesystem::directory_entry 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.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::abort_errorIf bad assertion.
Examples
...
xtd::tunit::directory_assume::are_not_equal(d1, d2, "User message...", csf_); // test ok.
xtd::tunit::directory_assume::are_not_equal(d1, d2, "User message...", csf_); // test throws an abort_error exception.

◆ are_not_equal() [5/8]

static void xtd::tunit::directory_assume::are_not_equal ( const xtd::io::directory_info expected,
const xtd::io::directory_info actual 
)
static

Assumes that two xtd::io::directory_info are not equal.

Parameters
expectedthe expected value.
actualthe actual value.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::io::directory_info d3("..")
xtd::tunit::directory_assume::are_not_equal(d1, d3, "User message...", csf_); // test ok.
xtd::tunit::directory_assume::are_not_equal(d1, d2, "User message...", csf_); // test throws an assert_error exception.

◆ are_not_equal() [6/8]

static void xtd::tunit::directory_assume::are_not_equal ( const xtd::io::directory_info expected,
const xtd::io::directory_info actual,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Assumes that two xtd::io::directory_info are not equal.

Parameters
expectedthe expected value.
actualthe actual value.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::io::directory_info d3("..")
xtd::tunit::directory_assume::are_not_equal(d1, d3, "User message...", csf_); // test ok.
xtd::tunit::directory_assume::are_not_equal(d1, d2, "User message...", csf_); // test throws an assert_error exception.

◆ are_not_equal() [7/8]

static void xtd::tunit::directory_assume::are_not_equal ( const xtd::io::directory_info expected,
const xtd::io::directory_info actual,
const std::string &  message 
)
static

Assumes that two xtd::io::directory_info 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::assert_errorIf bad assertion.
Examples
xtd::io::directory_info d3("..")
xtd::tunit::directory_assume::are_not_equal(d1, d3, "User message...", csf_); // test ok.
xtd::tunit::directory_assume::are_not_equal(d1, d2, "User message...", csf_); // test throws an assert_error exception.

◆ are_not_equal() [8/8]

static void xtd::tunit::directory_assume::are_not_equal ( const xtd::io::directory_info expected,
const xtd::io::directory_info actual,
const std::string &  message,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Assumes that two xtd::io::directory_info 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.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::io::directory_info d3("..")
xtd::tunit::directory_assume::are_not_equal(d1, d3, "User message...", csf_); // test ok.
xtd::tunit::directory_assume::are_not_equal(d1, d2, "User message...", csf_); // test throws an assert_error exception.

◆ does_not_exist() [1/12]

static void xtd::tunit::directory_assume::does_not_exist ( const std::filesystem::directory_entry &  directory)
static

Assumes that directory not exists.

Parameters
expectedthe expected value.
actualthe actual value.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::io::directory_info d2(std::filesystem::directory_entry d1(std::filesystem::path(xtd::io::path::combine(environment::get_folder_path(environment::special_folder::common_application_data)) / "__xtd_test_directory_not_found__");
xtd::tunit::directory_assume::does_not_exist(d1); // test throws an assert_error exception.

◆ does_not_exist() [2/12]

static void xtd::tunit::directory_assume::does_not_exist ( const std::filesystem::directory_entry &  directory,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Asserts that directory not exists.

Parameters
expectedthe expected value.
actualthe actual value.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::io::directory_info d2(std::filesystem::directory_entry d1(std::filesystem::path(xtd::io::path::combine(environment::get_folder_path(environment::special_folder::common_application_data)) / "__xtd_test_directory_not_found__");
xtd::tunit::directory_assume::does_not_exist(d1); // test throws an assert_error exception.

◆ does_not_exist() [3/12]

static void xtd::tunit::directory_assume::does_not_exist ( const std::filesystem::directory_entry &  directory,
const std::string &  message 
)
static

Assumes that directory 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::assert_errorIf bad assertion.
Examples
xtd::io::directory_info d2(std::filesystem::directory_entry d1(std::filesystem::path(xtd::io::path::combine(environment::get_folder_path(environment::special_folder::common_application_data)) / "__xtd_test_directory_not_found__");
xtd::tunit::directory_assume::does_not_exist(d1); // test throws an assert_error exception.

◆ does_not_exist() [4/12]

static void xtd::tunit::directory_assume::does_not_exist ( const std::filesystem::directory_entry &  directory,
const std::string &  message,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Assumes that directory 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.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::io::directory_info d2(std::filesystem::directory_entry d1(std::filesystem::path(xtd::io::path::combine(environment::get_folder_path(environment::special_folder::common_application_data)) / "__xtd_test_directory_not_found__");
xtd::tunit::directory_assume::does_not_exist(d1); // test throws an assert_error exception.

◆ does_not_exist() [5/12]

static void xtd::tunit::directory_assume::does_not_exist ( const xtd::io::directory_info directory)
static

Assumes that directory not exists.

Parameters
expectedthe expected value.
actualthe actual value.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples

◆ does_not_exist() [6/12]

static void xtd::tunit::directory_assume::does_not_exist ( const xtd::io::directory_info directory,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Asserts that directory not exists.

Parameters
expectedthe expected value.
actualthe actual value.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples

◆ does_not_exist() [7/12]

static void xtd::tunit::directory_assume::does_not_exist ( const xtd::io::directory_info directory,
const std::string &  message 
)
static

Assumes that directory 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::assert_errorIf bad assertion.
Examples

◆ does_not_exist() [8/12]

static void xtd::tunit::directory_assume::does_not_exist ( const xtd::io::directory_info directory,
const std::string &  message,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Assumes that directory 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.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples

◆ does_not_exist() [9/12]

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

Assumes that file not exists.

Parameters
expectedthe expected value.
actualthe actual value.
Exceptions
xtd::tunit::abort_errorIf bad assertion.
Examples
std::ifstream f1("Test1.txt");
f1.close();
xtd::tunit::directory_assume::does_not_exist("Test1.txt"); // test throws an abort_error exception.

◆ does_not_exist() [10/12]

template<typename char_t >
static void xtd::tunit::directory_assume::does_not_exist ( const std::basic_string< char_t > &  directory,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Assumes that file not exists.

Parameters
expectedthe expected value.
actualthe actual value.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::abort_errorIf bad assertion.
Examples
std::ifstream f1("Test1.txt");
f1.close();
xtd::tunit::directory_assume::does_not_exist("Test2.txt", csf_); // test ok.
xtd::tunit::directory_assume::does_not_exist("Test1.txt", csf_); // test throws an abort_error exception.

◆ does_not_exist() [11/12]

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

Assumes 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::abort_errorIf bad assertion.
Examples
std::ifstream f1("Test1.txt");
f1.close();
xtd::tunit::directory_assume::does_not_exist("Test2.txt", "User message..."); // test ok.
xtd::tunit::directory_assume::does_not_exist("Test1.txt", "User message..."); // test throws an abort_error exception.

◆ does_not_exist() [12/12]

template<typename char_t >
static void xtd::tunit::directory_assume::does_not_exist ( const std::basic_string< char_t > &  directory,
const std::string &  message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Assumes 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.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::abort_errorIf bad assertion.
Examples
std::ifstream f1("Test1.txt");
f1.close();
xtd::tunit::directory_assume::does_not_exist("Test2.txt" "User message...", csf_); // test ok.
xtd::tunit::directory_assume::does_not_exist("Test1.txt", "User message...", csf_); // test throws an abort_error exception.

◆ exists() [1/12]

static void xtd::tunit::directory_assume::exists ( const std::filesystem::directory_entry &  directory)
static

Assumes that directory exists.

Parameters
expectedthe expected value.
actualthe actual value.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::io::directory_info d2(std::filesystem::directory_entry d1(std::filesystem::path(xtd::io::path::combine(environment::get_folder_path(environment::special_folder::common_application_data)) / "__xtd_test_directory_not_found__");
xtd::tunit::directory_assume::exists(d2); // test throws an assert_error exception.

◆ exists() [2/12]

static void xtd::tunit::directory_assume::exists ( const std::filesystem::directory_entry &  directory,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Assumes that directory exists.

Parameters
expectedthe expected value.
actualthe actual value.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::io::directory_info d2(std::filesystem::directory_entry d1(std::filesystem::path(xtd::io::path::combine(environment::get_folder_path(environment::special_folder::common_application_data)) / "__xtd_test_directory_not_found__");
xtd::tunit::directory_assume::exists(d2); // test throws an assert_error exception.

◆ exists() [3/12]

static void xtd::tunit::directory_assume::exists ( const std::filesystem::directory_entry &  directory,
const std::string &  message 
)
static

Assumes 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.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::io::directory_info d2(std::filesystem::directory_entry d1(std::filesystem::path(xtd::io::path::combine(environment::get_folder_path(environment::special_folder::common_application_data)) / "__xtd_test_directory_not_found__");
xtd::tunit::directory_assume::exists(d2); // test throws an assert_error exception.

◆ exists() [4/12]

static void xtd::tunit::directory_assume::exists ( const std::filesystem::directory_entry &  directory,
const std::string &  message,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Assumes 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.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::io::directory_info d2(std::filesystem::directory_entry d1(std::filesystem::path(xtd::io::path::combine(environment::get_folder_path(environment::special_folder::common_application_data)) / "__xtd_test_directory_not_found__");
xtd::tunit::directory_assume::exists(d2); // test throws an assert_error exception.

◆ exists() [5/12]

static void xtd::tunit::directory_assume::exists ( const xtd::io::directory_info directory)
static

Assumes that directory exists.

Parameters
expectedthe expected value.
actualthe actual value.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples

◆ exists() [6/12]

static void xtd::tunit::directory_assume::exists ( const xtd::io::directory_info directory,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Assumes that directory exists.

Parameters
expectedthe expected value.
actualthe actual value.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples

◆ exists() [7/12]

static void xtd::tunit::directory_assume::exists ( const xtd::io::directory_info directory,
const std::string &  message 
)
static

Assumes 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.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples

◆ exists() [8/12]

static void xtd::tunit::directory_assume::exists ( const xtd::io::directory_info directory,
const std::string &  message,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Assumes 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.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples

◆ exists() [9/12]

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

Assumes that directory exists.

Parameters
expectedthe expected value.
actualthe actual value.
Exceptions
xtd::tunit::abort_errorIf bad assertion.
Examples
std::ifstream f1("Test1.txt");
f1.close();
xtd::tunit::directory_assume::exists("Test1.txt"); // test ok.
xtd::tunit::directory_assume::exists("Test2.txt"); // test throws an abort_error exception.

◆ exists() [10/12]

template<typename char_t >
static void xtd::tunit::directory_assume::exists ( const std::basic_string< char_t > &  directory,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Assumes that directory exists.

Parameters
expectedthe expected value.
actualthe actual value.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::abort_errorIf bad assertion.
Examples
std::ifstream f1("Test1.txt");
f1.close();
xtd::tunit::directory_assume::exists("Test1.txt", csf_); // test ok.
xtd::tunit::directory_assume::exists("Test2.txt", csf_); // test throws an abort_error exception.

◆ exists() [11/12]

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

Assumes 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.
Exceptions
xtd::tunit::abort_errorIf bad assertion.
Examples
std::ifstream f1("Test1.txt");
f1.close();
xtd::tunit::directory_assume::exists("Test1.txt", "User message..."); // test ok.
xtd::tunit::directory_assume::exists("Test2.txt", "User message..."); // test throws an abort_error exception.

◆ exists() [12/12]

template<typename char_t >
static void xtd::tunit::directory_assume::exists ( const std::basic_string< char_t > &  directory,
const std::string &  message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Assumes 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.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::abort_errorIf bad assertion.
Examples
std::ifstream f1("Test1.txt");
f1.close();
xtd::tunit::directory_assume::exists("Test1.txt" "User message...", csf_); // test ok.
xtd::tunit::directory_assume::exists("Test2.txt", "User message...", csf_); // test throws an abort_error exception.

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