xtd 0.2.0
Loading...
Searching...
No Matches
xtd::tunit::file_assume Class Referencefinal
Inheritance diagram for xtd::tunit::file_assume:
xtd::tunit::base_assert

Definition

The file_assume class contains a collection of static methods that implement the most file 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 std;
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) {
void test_method_(test_case1) {
auto fn = path::get_temp_file_name();
file_assume::exists(fn);
file::remove(fn);
}
void test_method_(test_case2) {
auto fn = path::get_random_file_name();
file_assume::exists(fn);
// No need to remove fn because the file does not exist.
}
void test_method_(test_case3) {
auto is = istringstream {"xtd::tunit::file_assume::are_equal example."};
file_assume::are_equal(istringstream {"xtd::tunit::file_assume::are_equel example."}, is);
}
};
}
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)
// ABORTED test.test_case2 (0 ms total)
// Test aborted
// Expected: file exists
// But was: "t35uk5my.8v2"
// Stack Trace: in |---OMITTED---|/file_assume.cpp:18
// ABORTED test.test_case3 (0 ms total)
// Test aborted
// Expected: istream at offset 32 value e
// But was: a
// Stack Trace: in |---OMITTED---|/file_assume.cpp:24
//
// Test results:
// SUCCEED 1 test.
// ABORTED 2 tests.
// End 3 tests from 1 test case ran. (0 ms total)
The console_unit_test class is console unit test interface.
Definition console_unit_test.h:23
int32 run()
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.h:89
bool is(std::any value)
Checks if the result of an expression is compatible with a given type.
Definition is.h:335
The xtd::io namespace contains types that allow reading and writing to files and data streams,...
Definition binary_reader.h:16
The tunit namespace contains a unit test library.
Definition abort_error.h:10

Public Static Methods

template<typename char_t >
static void are_equal (const std::basic_istream< char_t > &expected, const std::basic_istream< char_t > &actual)
 Assumes that two files are equal.
 
template<typename char_t >
static void are_equal (const std::basic_istream< char_t > &expected, const std::basic_istream< char_t > &actual, const xtd::diagnostics::stack_frame &stack_frame)
 Assumes that two files are equal.
 
template<typename char_t >
static void are_equal (const std::basic_istream< char_t > &expected, const std::basic_istream< char_t > &actual, const std::string &message)
 Assumes that two files are equal.
 
template<typename char_t >
static void are_equal (const std::basic_istream< char_t > &expected, const std::basic_istream< char_t > &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
 Assumes that two files are equal.
 
template<typename char_t >
static void are_equal (const std::basic_string< char_t > &expected, const std::basic_string< char_t > &actual)
 Assumes that two files are equal.
 
template<typename char_t >
static void are_equal (const std::basic_string< char_t > &expected, const std::basic_string< char_t > &actual, const xtd::diagnostics::stack_frame &stack_frame)
 Assumes that two files are equal.
 
template<typename char_t >
static void are_equal (const std::basic_string< char_t > &expected, const std::basic_string< char_t > &actual, const std::string &message)
 Assumes that two files are equal.
 
template<typename char_t >
static void are_equal (const std::basic_string< char_t > &expected, const std::basic_string< char_t > &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
 Assumes that two files are equal.
 
template<typename char_t >
static void are_not_equal (const std::basic_istream< char_t > &expected, const std::basic_istream< char_t > &actual)
 Assumes that two files are not equal.
 
template<typename char_t >
static void are_not_equal (const std::basic_istream< char_t > &expected, const std::basic_istream< char_t > &actual, const xtd::diagnostics::stack_frame &stack_frame)
 Assumes that two files are not equal.
 
template<typename char_t >
static void are_not_equal (const std::basic_istream< char_t > &expected, const std::basic_istream< char_t > &actual, const std::string &message)
 Assumes that two files are not equal.
 
template<typename char_t >
static void are_not_equal (const std::basic_istream< char_t > &expected, const std::basic_istream< char_t > &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
 Assumes that two files are not equal.
 
template<typename char_t >
static void are_not_equal (const std::basic_string< char_t > &expected, const std::basic_string< char_t > &actual)
 Assumes that two files are not equal.
 
template<typename char_t >
static void are_not_equal (const std::basic_string< char_t > &expected, const std::basic_string< char_t > &actual, const xtd::diagnostics::stack_frame &stack_frame)
 Assumes that two files are not equal.
 
template<typename char_t >
static void are_not_equal (const std::basic_string< char_t > &expected, const std::basic_string< char_t > &actual, const std::string &message)
 Assumes that two files are not equal.
 
template<typename char_t >
static void are_not_equal (const std::basic_string< char_t > &expected, const std::basic_string< char_t > &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
 Assumes that two files are not equal.
 
template<typename char_t >
static void does_not_exist (const std::basic_string< char_t > &file)
 Assumes that file not exists.
 
template<typename char_t >
static void does_not_exist (const std::basic_string< char_t > &file, const xtd::diagnostics::stack_frame &stack_frame)
 Assumes that file not exists.
 
template<typename char_t >
static void does_not_exist (const std::basic_string< char_t > &file, const std::string &message)
 Assumes that file not exists.
 
template<typename char_t >
static void does_not_exist (const std::basic_string< char_t > &file, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
 Assumes that file not exists.
 
template<typename char_t >
static void exists (const std::basic_string< char_t > &file)
 Assumes that file exists.
 
template<typename char_t >
static void exists (const std::basic_string< char_t > &file, const xtd::diagnostics::stack_frame &stack_frame)
 Assumes that file exists.
 
template<typename char_t >
static void exists (const std::basic_string< char_t > &file, const std::string &message)
 Assumes that file exists.
 
template<typename char_t >
static void exists (const std::basic_string< char_t > &file, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
 Assumes that file exists.
 

Member Function Documentation

◆ are_equal() [1/8]

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

Assumes that two files are equal.

Parameters
expectedthe expected value.
actualthe actual value.
Exceptions
xtd::tunit::abort_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_assume::are_equal(s2, s1);// test throws an abort_error exception.
static void are_equal(const std::basic_istream< char_t > &expected, const std::basic_istream< char_t > &actual)
Assumes that two files are equal.
Definition file_assume.h:49

◆ are_equal() [2/8]

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

Assumes 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::abort_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_assume::are_equal(s2, s1, "User message..."); // test ok.
s2 << "Test2";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assume::are_equal(s2, s1, "User message...");// test throws an abort_error exception.

◆ are_equal() [3/8]

template<typename char_t >
static void xtd::tunit::file_assume::are_equal ( const std::basic_istream< char_t > &  expected,
const std::basic_istream< char_t > &  actual,
const std::string &  message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Assumes 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.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::abort_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_assume::are_equal(s2, s1, "User message...", csf_); // test ok.
s2 << "Test2";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assume::are_equal(s2, s1, "User message...", csf_);// test throws an abort_error exception.
#define csf_
Provides information about the current stack frame.
Definition current_stack_frame.h:30

◆ are_equal() [4/8]

template<typename char_t >
static void xtd::tunit::file_assume::are_equal ( const std::basic_istream< char_t > &  expected,
const std::basic_istream< char_t > &  actual,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Assumes that two files 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
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_assume::are_equal(s2, s1, csf_);// test throws an abort_error exception.

◆ are_equal() [5/8]

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

Assumes that two files are equal.

Parameters
expectedthe expected value.
actualthe actual value.
Exceptions
xtd::tunit::abort_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_assume::are_equal(s2, s1);// test throws an abort_error exception.

◆ are_equal() [6/8]

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

Assumes 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::abort_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_assume::are_equal(s2, s1, "User message..."); // test ok.
s2 << "Test2";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assume::are_equal(s2, s1, "User message...");// test throws an abort_error exception.

◆ are_equal() [7/8]

template<typename char_t >
static void xtd::tunit::file_assume::are_equal ( const std::basic_string< char_t > &  expected,
const std::basic_string< char_t > &  actual,
const std::string &  message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Assumes 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.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::abort_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_assume::are_equal(s2, s1, "User message...", csf_); // test ok.
s2 << "Test2";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assume::are_equal(s2, s1, "User message...", csf_);// test throws an abort_error exception.

◆ are_equal() [8/8]

template<typename char_t >
static void xtd::tunit::file_assume::are_equal ( const std::basic_string< char_t > &  expected,
const std::basic_string< char_t > &  actual,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Assumes that two files 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
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_assume::are_equal(s2, s1, csf_);// test throws an abort_error exception.

◆ are_not_equal() [1/8]

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

Assumes that two files are not equal.

Parameters
expectedthe expected value.
actualthe actual value.
Exceptions
xtd::tunit::abort_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_assume::are_not_equal(s2, s1);// test throws an abort_error exception.
static void are_not_equal(const std::basic_istream< char_t > &expected, const std::basic_istream< char_t > &actual)
Assumes that two files are not equal.
Definition file_assume.h:243

◆ are_not_equal() [2/8]

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

Assumes 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::abort_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_assume::are_not_equal(s2, s1, "User message..."); // test ok.
s2 << "Test";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assume::are_not_equal(s2, s1, "User message...");// test throws an abort_error exception.

◆ are_not_equal() [3/8]

template<typename char_t >
static void xtd::tunit::file_assume::are_not_equal ( const std::basic_istream< char_t > &  expected,
const std::basic_istream< char_t > &  actual,
const std::string &  message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Assumes 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.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::abort_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_assume::are_not_equal(s2, s1, "User message...", csf_); // test ok.
s2 << "Test";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assume::are_not_equal(s2, s1, "User message...", csf_);// test throws an abort_error exception.

◆ are_not_equal() [4/8]

template<typename char_t >
static void xtd::tunit::file_assume::are_not_equal ( const std::basic_istream< char_t > &  expected,
const std::basic_istream< char_t > &  actual,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Assumes that two files 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
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_assume::are_not_equal(s2, s1, csf_);// test throws an abort_error exception.

◆ are_not_equal() [5/8]

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

Assumes that two files are not equal.

Parameters
expectedthe expected value.
actualthe actual value.
Exceptions
xtd::tunit::abort_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_assume::are_not_equal(s2, s1);// test throws an abort_error exception.

◆ are_not_equal() [6/8]

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

Assumes 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::abort_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_assume::are_not_equal(s2, s1, "User message..."); // test ok.
s2 << "Test";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assume::are_not_equal(s2, s1, "User message...");// test throws an abort_error exception.

◆ are_not_equal() [7/8]

template<typename char_t >
static void xtd::tunit::file_assume::are_not_equal ( const std::basic_string< char_t > &  expected,
const std::basic_string< char_t > &  actual,
const std::string &  message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Assumes 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.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::abort_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_assume::are_not_equal(s2, s1, "User message...", csf_); // test ok.
s2 << "Test";
s2.seekg(0, std::ios::beg);
xtd::tunit::file_assume::are_not_equal(s2, s1, "User message...", csf_);// test throws an abort_error exception.

◆ are_not_equal() [8/8]

template<typename char_t >
static void xtd::tunit::file_assume::are_not_equal ( const std::basic_string< char_t > &  expected,
const std::basic_string< char_t > &  actual,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Assumes that two files 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
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_assume::are_not_equal(s2, s1, csf_);// test throws an abort_error exception.

◆ does_not_exist() [1/4]

template<typename char_t >
static void xtd::tunit::file_assume::does_not_exist ( const std::basic_string< char_t > &  file)
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::file_assume::does_not_exist("Test2.txt"); // test ok.
xtd::tunit::file_assume::does_not_exist("Test1.txt");// test throws an abort_error exception.
static void does_not_exist(const std::basic_string< char_t > &file)
Assumes that file not exists.
Definition file_assume.h:431
@ f1
The F1 key.

◆ does_not_exist() [2/4]

template<typename char_t >
static void xtd::tunit::file_assume::does_not_exist ( const std::basic_string< char_t > &  file,
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::file_assume::does_not_exist("Test2.txt", "User message..."); // test ok.
xtd::tunit::file_assume::does_not_exist("Test1.txt", "User message...");// test throws an abort_error exception.

◆ does_not_exist() [3/4]

template<typename char_t >
static void xtd::tunit::file_assume::does_not_exist ( const std::basic_string< char_t > &  file,
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::file_assume::does_not_exist("Test2.txt" "User message...", csf_); // test ok.
xtd::tunit::file_assume::does_not_exist("Test1.txt", "User message...", csf_);// test throws an abort_error exception.

◆ does_not_exist() [4/4]

template<typename char_t >
static void xtd::tunit::file_assume::does_not_exist ( const std::basic_string< char_t > &  file,
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::file_assume::does_not_exist("Test1.txt", csf_);// test throws an abort_error exception.

◆ exists() [1/4]

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

Assumes that file 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::file_assume::exists("Test1.txt"); // test ok.
xtd::tunit::file_assume::exists("Test2.txt");// test throws an abort_error exception.
static void exists(const std::basic_string< char_t > &file)
Assumes that file exists.
Definition file_assume.h:505

◆ exists() [2/4]

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

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

◆ exists() [3/4]

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

Assumes 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.
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::file_assume::exists("Test1.txt" "User message...", csf_); // test ok.
xtd::tunit::file_assume::exists("Test2.txt", "User message...", csf_);// test throws an abort_error exception.

◆ exists() [4/4]

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

Assumes that file 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::file_assume::exists("Test1.txt", csf_); // test ok.
xtd::tunit::file_assume::exists("Test2.txt", csf_);// test throws an abort_error exception.

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