xtd - Reference Guide  0.1.2
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Loading...
Searching...
No Matches
directory_assume.h
Go to the documentation of this file.
1
4#pragma once
5#include "assume.h"
6#include "directory_assert.h"
7
9namespace xtd {
11 namespace tunit {
21 class directory_assume final : private base_assert {
22 public:
24 directory_assume() = delete;
26
27#if defined(__cpp_lib_filesystem)
38 static void are_equal(const std::filesystem::directory_entry& expected, const std::filesystem::directory_entry& actual) {are_equal(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
39
51 static void are_equal(const std::filesystem::directory_entry& expected, const std::filesystem::directory_entry& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_equal(expected, actual, "", stack_frame);}
52
64 static void are_equal(const std::filesystem::directory_entry& expected, const std::filesystem::directory_entry& actual, const std::string& message) {are_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
65
78 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) {
79 try {
80 directory_assert::are_equal(expected, actual, message, stack_frame);
81 } catch (...) {
83 }
84 }
85
96 static void are_not_equal(const std::filesystem::directory_entry& expected, const std::filesystem::directory_entry& actual) {are_not_equal(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
97
109 static void are_not_equal(const std::filesystem::directory_entry& expected, const std::filesystem::directory_entry& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_not_equal(expected, actual, "", stack_frame);}
110
122 static void are_not_equal(const std::filesystem::directory_entry& expected, const std::filesystem::directory_entry& actual, const std::string& message) {are_not_equal(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
123
136 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) {
137 try {
138 directory_assert::are_not_equal(expected, actual, message, stack_frame);
139 } catch (...) {
141 }
142 }
143#endif
144
156 template<typename Char>
157 static void exists(const std::basic_string<Char>& directory) {exists(directory, "", xtd::diagnostics::stack_frame::empty());}
158
171 template<typename Char>
172 static void exists(const std::basic_string<Char>& directory, const xtd::diagnostics::stack_frame& stack_frame) {exists(directory, "", stack_frame);}
173
186 template<typename Char>
187 static void exists(const std::basic_string<Char>& directory, const std::string& message) {exists(directory, message, xtd::diagnostics::stack_frame::empty());}
188
202 template<typename Char>
203 static void exists(const std::basic_string<Char>& directory, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
204 try {
205 directory_assert::exists(directory, message, stack_frame);
206 } catch (...) {
208 }
209 }
210
212 template<typename Char>
213 static void exists(const Char* directory) {exists(directory, "", xtd::diagnostics::stack_frame::empty());}
214 template<typename Char>
215 static void exists(const Char* directory, const xtd::diagnostics::stack_frame& stack_frame) {exists(directory, "", stack_frame);}
216 template<typename Char>
217 static void exists(const Char* directory, const std::string& message) {exists(directory, message, xtd::diagnostics::stack_frame::empty());}
218 template<typename Char>
219 static void exists(const Char* directory, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {exists(std::basic_string<Char>(directory), message, stack_frame);}
221
233 template<typename Char>
234 static void does_not_exist(const std::basic_string<Char>& directory) {does_not_exist(directory, "", xtd::diagnostics::stack_frame::empty());}
235
248 template<typename Char>
249 static void does_not_exist(const std::basic_string<Char>& directory, const xtd::diagnostics::stack_frame& stack_frame) {does_not_exist(directory, "", stack_frame);}
250
263 template<typename Char>
264 static void does_not_exist(const std::basic_string<Char>& directory, const std::string& message) {does_not_exist(directory, message, xtd::diagnostics::stack_frame::empty());}
265
279 template<typename Char>
280 static void does_not_exist(const std::basic_string<Char>& directory, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
281 try {
282 directory_assert::does_not_exist(directory, message, stack_frame);
283 } catch (...) {
285 }
286 }
287
289 template<typename Char>
290 static void does_not_exist(const Char* directory) {does_not_exist(directory, "", xtd::diagnostics::stack_frame::empty());}
291 template<typename Char>
292 static void does_not_exist(const Char* directory, const xtd::diagnostics::stack_frame& stack_frame) {does_not_exist(directory, "", stack_frame);}
293 template<typename Char>
294 static void does_not_exist(const Char* directory, const std::string& message) {does_not_exist(directory, message, xtd::diagnostics::stack_frame::empty());}
295 template<typename Char>
296 static void does_not_exist(const Char* directory, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {does_not_exist(std::basic_string<Char>(directory), message, stack_frame);}
298 };
299 }
300}
Contains xtd::tunit::assume class.
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition stack_frame.h:29
static stack_frame empty() noexcept
Return an empty stack frame.
The base class for assert.
Definition base_assert.h:25
static void abort()
Abort current test. This is used by the other Assert functions.
Definition base_assert.h:36
static void exists(const std::basic_string< Char > &directory)
Asserts that directory exists.
Definition directory_assert.h:158
static void does_not_exist(const std::basic_string< Char > &directory)
Asserts that file not exists.
Definition directory_assert.h:235
The directory_assume class contains a collection of static methods that implement the most directory ...
Definition directory_assume.h:21
static void exists(const std::basic_string< Char > &directory, const std::string &message)
Asserts that directory exists.
Definition directory_assume.h:187
static void does_not_exist(const std::basic_string< Char > &directory, const std::string &message)
Asserts that file not exists.
Definition directory_assume.h:264
static void exists(const std::basic_string< Char > &directory, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that directory exists.
Definition directory_assume.h:172
static void does_not_exist(const std::basic_string< Char > &directory)
Asserts that file not exists.
Definition directory_assume.h:234
static void does_not_exist(const std::basic_string< Char > &directory, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that file not exists.
Definition directory_assume.h:280
static void exists(const std::basic_string< Char > &directory, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that directory exists.
Definition directory_assume.h:203
static void exists(const std::basic_string< Char > &directory)
Asserts that directory exists.
Definition directory_assume.h:157
static void does_not_exist(const std::basic_string< Char > &directory, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that file not exists.
Definition directory_assume.h:249
Contains xtd::tunit::directory_assert class.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition system_report.h:17