xtd - Reference Guide  0.1.0
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_valid.h
Go to the documentation of this file.
1
4#pragma once
5#include "valid.h"
6#include "directory_assert.h"
7
9namespace xtd {
11 namespace tunit {
21 class directory_valid final : private base_assert {
22 public:
24 directory_valid() = delete;
26
27#if defined(__cpp_lib_filesystem)
37 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());}
38
49 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);}
50
61 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());}
62
74 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) {
75 try {
76 directory_assert::are_equal(expected, actual, message, stack_frame);
77 } catch (...) {
78 base_assert::error();
79 }
80 }
81
91 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());}
92
103 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);}
104
115 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());}
116
128 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) {
129 try {
130 directory_assert::are_not_equal(expected, actual, message, stack_frame);
131 } catch (...) {
132 base_assert::error();
133 }
134 }
135#endif
136
147 template<typename Char>
148 static void exists(const std::basic_string<Char>& directory) {exists(directory, "", xtd::diagnostics::stack_frame::empty());}
149
161 template<typename Char>
162 static void exists(const std::basic_string<Char>& directory, const xtd::diagnostics::stack_frame& stack_frame) {exists(directory, "", stack_frame);}
163
175 template<typename Char>
176 static void exists(const std::basic_string<Char>& directory, const std::string& message) {exists(directory, message, xtd::diagnostics::stack_frame::empty());}
177
190 template<typename Char>
191 static void exists(const std::basic_string<Char>& directory, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
192 try {
193 directory_assert::exists(directory, message, stack_frame);
194 } catch (...) {
195 base_assert::error();
196 }
197 }
198
200 template<typename Char>
201 static void exists(const Char* directory) {exists(directory, "", xtd::diagnostics::stack_frame::empty());}
202 template<typename Char>
203 static void exists(const Char* directory, const xtd::diagnostics::stack_frame& stack_frame) {exists(directory, "", stack_frame);}
204 template<typename Char>
205 static void exists(const Char* directory, const std::string& message) {exists(directory, message, xtd::diagnostics::stack_frame::empty());}
206 template<typename Char>
207 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);}
209
220 template<typename Char>
221 static void does_not_exist(const std::basic_string<Char>& directory) {does_not_exist(directory, "", xtd::diagnostics::stack_frame::empty());}
222
234 template<typename Char>
235 static void does_not_exist(const std::basic_string<Char>& directory, const xtd::diagnostics::stack_frame& stack_frame) {does_not_exist(directory, "", stack_frame);}
236
248 template<typename Char>
249 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());}
250
263 template<typename Char>
264 static void does_not_exist(const std::basic_string<Char>& directory, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame) {
265 try {
266 directory_assert::does_not_exist(directory, message, stack_frame);
267 } catch (...) {
268 base_assert::error();
269 }
270 }
271
273 template<typename Char>
274 static void does_not_exist(const Char* directory) {does_not_exist(directory, "", xtd::diagnostics::stack_frame::empty());}
275 template<typename Char>
276 static void does_not_exist(const Char* directory, const xtd::diagnostics::stack_frame& stack_frame) {does_not_exist(directory, "", stack_frame);}
277 template<typename Char>
278 static void does_not_exist(const Char* directory, const std::string& message) {does_not_exist(directory, message, xtd::diagnostics::stack_frame::empty());}
279 template<typename Char>
280 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);}
282 };
283 }
284}
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 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_valid class contains a collection of static methods that implement the most directory a...
Definition: directory_valid.h:21
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_valid.h:264
static void does_not_exist(const std::basic_string< Char > &directory, const std::string &message)
Asserts that file not exists.
Definition: directory_valid.h:249
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_valid.h:191
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_valid.h:235
static void exists(const std::basic_string< Char > &directory)
Asserts that directory exists.
Definition: directory_valid.h:148
static void exists(const std::basic_string< Char > &directory, const xtd::diagnostics::stack_frame &stack_frame)
Asserts that directory exists.
Definition: directory_valid.h:162
static void does_not_exist(const std::basic_string< Char > &directory)
Asserts that file not exists.
Definition: directory_valid.h:221
static void exists(const std::basic_string< Char > &directory, const std::string &message)
Asserts that directory exists.
Definition: directory_valid.h:176
Contains xtd::tunit::directory_assert class.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17
Contains xtd::tunit::valid class.