xtd 0.2.0
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 {
23 public:
25 directory_assume() = delete;
27
29
31 #if defined(__xtd__cpp_lib_filesystem)
43 static void are_equal(const std::filesystem::directory_entry& expected, const std::filesystem::directory_entry& actual, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
56 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 = xtd::diagnostics::stack_frame::current());
57 #endif
86 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 = xtd::diagnostics::stack_frame::current());
87
88 #if defined(__xtd__cpp_lib_filesystem)
100 static void are_not_equal(const std::filesystem::directory_entry& expected, const std::filesystem::directory_entry& actual, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
113 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 = xtd::diagnostics::stack_frame::current());
114 #endif
143 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 = xtd::diagnostics::stack_frame::current());
144
145 #if defined(__xtd__cpp_lib_filesystem)
158 static void does_not_exist(const std::filesystem::directory_entry& directory, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
172 static void does_not_exist(const std::filesystem::directory_entry& directory, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
173 #endif
174
201 static void does_not_exist(const xtd::io::directory_info& directory, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
202
215 template<typename char_t>
230 template<typename char_t>
231 static void does_not_exist(const xtd::basic_string<char_t>& directory, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
232 try {
233 directory_assert::does_not_exist(directory, message, stack_frame);
234 } catch (...) {
235 assert::abort();
236 }
237 }
238
240 template<typename char_t>
241 static void does_not_exist(const char_t* directory, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {does_not_exist(directory, xtd::string::empty_string, stack_frame);}
242 template<typename char_t>
243 static void does_not_exist(const char_t* directory, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {does_not_exist(xtd::basic_string<char_t>(directory), message, stack_frame);}
245
246 #if defined(__xtd__cpp_lib_filesystem)
259 static void exists(const std::filesystem::directory_entry& directory, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
273 static void exists(const std::filesystem::directory_entry& directory, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
274 #endif
275
302 static void exists(const xtd::io::directory_info& directory, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current());
303
316 template<typename char_t>
331 template<typename char_t>
332 static void exists(const xtd::basic_string<char_t>& directory, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {
333 try {
334 directory_assert::exists(directory, message, stack_frame);
335 } catch (...) {
336 assert::abort();
337 }
338 }
339
341 template<typename char_t>
342 static void exists(const char_t* directory, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {exists(directory, xtd::string::empty_string, stack_frame);}
343 template<typename char_t>
344 static void exists(const char_t* directory, const std::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) {exists(xtd::basic_string<char_t>(directory), message, stack_frame);}
347 };
348 }
349}
Contains xtd::tunit::assume class.
Represents text as a sequence of character units.
Definition basic_string.h:79
static const basic_string empty_string
Represents the empty basic_string.
Definition basic_string.h:124
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition stack_frame.h:47
static stack_frame current(const xtd::source_location &value=xtd::source_location::current()) noexcept
Crates a new xtd::diagnostics::stack_frame object corresponding to the location of the call site.
Exposes instance methods for creating, moving, and enumerating through directories and subdirectories...
Definition directory_info.h:129
The base class for assert.
Definition base_assert.h:29
The directory_assume class contains a collection of static methods that implement the most directory ...
Definition directory_assume.h:22
static void does_not_exist(const xtd::io::directory_info &directory, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that directory not exists.
static void are_equal(const xtd::io::directory_info &expected, const xtd::io::directory_info &actual, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that two xtd::io::directory_info are equal.
static void exists(const xtd::basic_string< char_t > &directory, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that directory exists.
Definition directory_assume.h:332
static void are_not_equal(const xtd::io::directory_info &expected, const xtd::io::directory_info &actual, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that two xtd::io::directory_info are not equal.
static void does_not_exist(const xtd::basic_string< char_t > &directory, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that file not exists.
Definition directory_assume.h:216
static void exists(const xtd::basic_string< char_t > &directory, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that directory exists.
Definition directory_assume.h:317
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=xtd::diagnostics::stack_frame::current())
Assumes that two xtd::io::directory_info are equal.
static void does_not_exist(const xtd::basic_string< char_t > &directory, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that file not exists.
Definition directory_assume.h:231
static void exists(const xtd::io::directory_info &directory, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that directory exists.
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=xtd::diagnostics::stack_frame::current())
Assumes that two xtd::io::directory_info are not equal.
static void does_not_exist(const xtd::io::directory_info &directory, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that directory not exists.
static void exists(const xtd::io::directory_info &directory, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Assumes that directory exists.
Contains xtd::tunit::directory_assert class.
#define tunit_export_
Define shared library export.
Definition tunit_export.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10