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
string_assume.h
Go to the documentation of this file.
1
4#pragma once
5#include "assume.h"
6#include "string_assert.h"
7
9namespace xtd {
11 namespace tunit {
21 class string_assume final : private base_assert {
22 public:
24 string_assume() = delete;
26
36 static void are_equal_ignoring_case(const xtd::ustring& expected, const xtd::ustring& actual) {are_equal_ignoring_case(expected, actual, "", xtd::diagnostics::stack_frame::empty());}
37
48 static void are_equal_ignoring_case(const xtd::ustring& expected, const xtd::ustring& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_equal_ignoring_case(expected, actual, "", stack_frame);}
49
60 static void are_equal_ignoring_case(const xtd::ustring& expected, const xtd::ustring& actual, const xtd::ustring& message) {are_equal_ignoring_case(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
61
73 static void are_equal_ignoring_case(const xtd::ustring& expected, const xtd::ustring& actual, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
74 try {
75 string_assert::are_equal_ignoring_case(expected, actual, message, stack_frame);
76 } catch (...) {
78 }
79 }
80
91
102 static void are_not_equal_ignoring_case(const xtd::ustring& expected, const xtd::ustring& actual, const xtd::diagnostics::stack_frame& stack_frame) {are_not_equal_ignoring_case(expected, actual, "", stack_frame);}
103
114 static void are_not_equal_ignoring_case(const xtd::ustring& expected, const xtd::ustring& actual, const xtd::ustring& message) {are_not_equal_ignoring_case(expected, actual, message, xtd::diagnostics::stack_frame::empty());}
115
127 static void are_not_equal_ignoring_case(const xtd::ustring& expected, const xtd::ustring& actual, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
128 try {
129 string_assert::are_not_equal_ignoring_case(expected, actual, message, stack_frame);
130 } catch (...) {
132 }
133 }
134
145 static void contains(const xtd::ustring& item, const xtd::ustring& string) {contains(item, string, "", xtd::diagnostics::stack_frame::empty());}
146
158 static void contains(const xtd::ustring& item, const xtd::ustring& string, const xtd::diagnostics::stack_frame& stack_frame) {contains(item, string, "", stack_frame);}
159
171 static void contains(const xtd::ustring& item, const xtd::ustring& string, const xtd::ustring& message) {contains(item, string, message, xtd::diagnostics::stack_frame::empty());}
172
185 static void contains(const xtd::ustring& item, const xtd::ustring& string, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
186 try {
187 string_assert::contains(item, string, message, stack_frame);
188 } catch (...) {
190 }
191 }
192
203 static void does_not_contain(const xtd::ustring& item, const xtd::ustring& string) {does_not_contain(item, string, "", xtd::diagnostics::stack_frame::empty());}
204
216 static void does_not_contain(const xtd::ustring& item, const xtd::ustring& string, const xtd::diagnostics::stack_frame& stack_frame) {does_not_contain(item, string, "", stack_frame);}
217
229 static void does_not_contain(const xtd::ustring& item, const xtd::ustring& string, const xtd::ustring& message) {does_not_contain(item, string, message, xtd::diagnostics::stack_frame::empty());}
230
243 static void does_not_contain(const xtd::ustring& item, const xtd::ustring& string, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
244 try {
245 string_assert::does_not_contain(item, string, message, stack_frame);
246 } catch (...) {
248 }
249 }
250
261 static void starts_with(const xtd::ustring& item, const xtd::ustring& string) {starts_with(item, string, "", xtd::diagnostics::stack_frame::empty());}
262
274 static void starts_with(const xtd::ustring& item, const xtd::ustring& string, const xtd::diagnostics::stack_frame& stack_frame) {starts_with(item, string, "", stack_frame);}
275
287 static void starts_with(const xtd::ustring& item, const xtd::ustring& string, const xtd::ustring& message) {starts_with(item, string, message, xtd::diagnostics::stack_frame::empty());}
288
301 static void starts_with(const xtd::ustring& item, const xtd::ustring& string, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
302 try {
303 string_assert::starts_with(item, string, message, stack_frame);
304 } catch (...) {
306 }
307 }
308
319 static void does_not_start_with(const xtd::ustring& item, const xtd::ustring& string) {does_not_start_with(item, string, "", xtd::diagnostics::stack_frame::empty());}
320
332 static void does_not_start_with(const xtd::ustring& item, const xtd::ustring& string, const xtd::diagnostics::stack_frame& stack_frame) {does_not_start_with(item, string, "", stack_frame);}
333
345 static void does_not_start_with(const xtd::ustring& item, const xtd::ustring& string, const xtd::ustring& message) {does_not_start_with(item, string, message, xtd::diagnostics::stack_frame::empty());}
346
359 static void does_not_start_with(const xtd::ustring& item, const xtd::ustring& string, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
360 try {
361 string_assert::does_not_start_with(item, string, message, stack_frame);
362 } catch (...) {
364 }
365 }
366
377 static void ends_with(const xtd::ustring& item, const xtd::ustring& string) {ends_with(item, string, "", xtd::diagnostics::stack_frame::empty());}
378
390 static void ends_with(const xtd::ustring& item, const xtd::ustring& string, const xtd::diagnostics::stack_frame& stack_frame) {ends_with(item, string, "", stack_frame);}
391
403 static void ends_with(const xtd::ustring& item, const xtd::ustring& string, const xtd::ustring& message) {ends_with(item, string, message, xtd::diagnostics::stack_frame::empty());}
404
417 static void ends_with(const xtd::ustring& item, const xtd::ustring& string, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
418 try {
419 string_assert::ends_with(item, string, message, stack_frame);
420 } catch (...) {
422 }
423 }
424
435 static void does_not_end_with(const xtd::ustring& item, const xtd::ustring& string) {does_not_end_with(item, string, "", xtd::diagnostics::stack_frame::empty());}
436
448 static void does_not_end_with(const xtd::ustring& item, const xtd::ustring& string, const xtd::diagnostics::stack_frame& stack_frame) {does_not_end_with(item, string, "", stack_frame);}
449
461 static void does_not_end_with(const xtd::ustring& item, const xtd::ustring& string, const xtd::ustring& message) {does_not_end_with(item, string, message, xtd::diagnostics::stack_frame::empty());}
462
475 static void does_not_end_with(const xtd::ustring& item, const xtd::ustring& string, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
476 try {
477 string_assert::does_not_end_with(item, string, message, stack_frame);
478 } catch (...) {
480 }
481 }
482
492 static void matches(const xtd::ustring& regex_pattern, const xtd::ustring& actual) {matches(regex_pattern, actual, "", xtd::diagnostics::stack_frame::empty());}
493
504 static void matches(const xtd::ustring& regex_pattern, const xtd::ustring& actual, const xtd::diagnostics::stack_frame& stack_frame) {matches(regex_pattern, actual, "", stack_frame);}
505
516 static void matches(const xtd::ustring& regex_pattern, const xtd::ustring& actual, const xtd::ustring& message) {matches(regex_pattern, actual, message, xtd::diagnostics::stack_frame::empty());}
517
529 static void matches(const xtd::ustring& regex_pattern, const xtd::ustring& actual, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
530 try {
531 string_assert::matches(regex_pattern, actual, message, stack_frame);
532 } catch (...) {
534 }
535 }
536
546 static void does_not_match(const xtd::ustring& regex_pattern, const xtd::ustring& actual) {does_not_match(regex_pattern, actual, "", xtd::diagnostics::stack_frame::empty());}
547
558 static void does_not_match(const xtd::ustring& regex_pattern, const xtd::ustring& actual, const xtd::diagnostics::stack_frame& stack_frame) {does_not_match(regex_pattern, actual, "", stack_frame);}
559
570 static void does_not_match(const xtd::ustring& regex_pattern, const xtd::ustring& actual, const xtd::ustring& message) {does_not_match(regex_pattern, actual, message, xtd::diagnostics::stack_frame::empty());}
571
583 static void does_not_match(const xtd::ustring& regex_pattern, const xtd::ustring& actual, const xtd::ustring& message, const xtd::diagnostics::stack_frame& stack_frame) {
584 try {
585 string_assert::does_not_match(regex_pattern, actual, message, stack_frame);
586 } catch (...) {
588 }
589 }
590 };
591 }
592}
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 does_not_start_with(const xtd::ustring &item, const xtd::ustring &string)
Asserts that string does not start with a specific item.
Definition: string_assert.h:317
static void does_not_end_with(const xtd::ustring &item, const xtd::ustring &string)
Asserts that string does not end with a specific item.
Definition: string_assert.h:431
static void contains(const xtd::ustring &item, const xtd::ustring &string)
Asserts that string contains an item.
Definition: string_assert.h:146
static void does_not_contain(const xtd::ustring &item, const xtd::ustring &string)
Asserts that string contains an item.
Definition: string_assert.h:203
static void does_not_match(const xtd::ustring &regex_pattern, const xtd::ustring &actual)
Asserts that does not match regex pattern.
Definition: string_assert.h:544
static void starts_with(const xtd::ustring &item, const xtd::ustring &string)
Asserts that string starts witdh item.
Definition: string_assert.h:260
static void are_not_equal_ignoring_case(const xtd::ustring &expected, const xtd::ustring &actual)
Asserts that two type are not equal ignoring case.
Definition: string_assert.h:92
static void ends_with(const xtd::ustring &item, const xtd::ustring &string)
Asserts that string ends with a specific item.
Definition: string_assert.h:374
static void are_equal_ignoring_case(const xtd::ustring &expected, const xtd::ustring &actual)
Asserts that two type are equal ignoring case.
Definition: string_assert.h:39
static void matches(const xtd::ustring &regex_pattern, const xtd::ustring &actual)
Asserts that matches regex pattern.
Definition: string_assert.h:487
The string_assume class contains a collection of static methods that implement the most string assert...
Definition: string_assume.h:21
static void ends_with(const xtd::ustring &item, const xtd::ustring &string, const xtd::diagnostics::stack_frame &stack_frame)
Validates that string starts with item.
Definition: string_assume.h:390
static void does_not_start_with(const xtd::ustring &item, const xtd::ustring &string, const xtd::diagnostics::stack_frame &stack_frame)
Validates that string starts with item.
Definition: string_assume.h:332
static void contains(const xtd::ustring &item, const xtd::ustring &string, const xtd::ustring &message)
Validates that string contains an item.
Definition: string_assume.h:171
static void ends_with(const xtd::ustring &item, const xtd::ustring &string, const xtd::ustring &message)
Validates that string starts with item.
Definition: string_assume.h:403
static void does_not_match(const xtd::ustring &regex_pattern, const xtd::ustring &actual, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that does not match regex pattern.
Definition: string_assume.h:583
static void does_not_match(const xtd::ustring &regex_pattern, const xtd::ustring &actual)
Validates that does not match regex pattern.
Definition: string_assume.h:546
static void are_equal_ignoring_case(const xtd::ustring &expected, const xtd::ustring &actual, const xtd::ustring &message)
Validates that two type are equal ignoring case.
Definition: string_assume.h:60
static void does_not_end_with(const xtd::ustring &item, const xtd::ustring &string, const xtd::ustring &message)
Validates that string starts with item.
Definition: string_assume.h:461
static void starts_with(const xtd::ustring &item, const xtd::ustring &string)
Validates that string starts with a specific item.
Definition: string_assume.h:261
static void are_equal_ignoring_case(const xtd::ustring &expected, const xtd::ustring &actual)
Validates that two type are equal ignoring case.
Definition: string_assume.h:36
static void are_not_equal_ignoring_case(const xtd::ustring &expected, const xtd::ustring &actual, const xtd::diagnostics::stack_frame &stack_frame)
Validates that two type are not equal ignoring case.
Definition: string_assume.h:102
static void matches(const xtd::ustring &regex_pattern, const xtd::ustring &actual)
Validates that matches regex pattern.
Definition: string_assume.h:492
static void does_not_end_with(const xtd::ustring &item, const xtd::ustring &string)
Validates that string does not end with a specific item.
Definition: string_assume.h:435
static void matches(const xtd::ustring &regex_pattern, const xtd::ustring &actual, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that matches regex pattern.
Definition: string_assume.h:529
static void starts_with(const xtd::ustring &item, const xtd::ustring &string, const xtd::diagnostics::stack_frame &stack_frame)
Validates that string starts with item.
Definition: string_assume.h:274
static void are_not_equal_ignoring_case(const xtd::ustring &expected, const xtd::ustring &actual)
Validates that two type are not equal ignoring case.
Definition: string_assume.h:90
static void does_not_start_with(const xtd::ustring &item, const xtd::ustring &string)
Validates that string does not start with a specific item.
Definition: string_assume.h:319
static void are_equal_ignoring_case(const xtd::ustring &expected, const xtd::ustring &actual, const xtd::diagnostics::stack_frame &stack_frame)
Validates that two type are equal ignoring case.
Definition: string_assume.h:48
static void does_not_end_with(const xtd::ustring &item, const xtd::ustring &string, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that string starts with item.
Definition: string_assume.h:475
static void does_not_start_with(const xtd::ustring &item, const xtd::ustring &string, const xtd::ustring &message)
Validates that string starts with item.
Definition: string_assume.h:345
static void are_not_equal_ignoring_case(const xtd::ustring &expected, const xtd::ustring &actual, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that two type are not equal ignoring case.
Definition: string_assume.h:127
static void contains(const xtd::ustring &item, const xtd::ustring &string, const xtd::diagnostics::stack_frame &stack_frame)
Validates that string contains an item.
Definition: string_assume.h:158
static void does_not_contain(const xtd::ustring &item, const xtd::ustring &string, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that string contains an item.
Definition: string_assume.h:243
static void does_not_match(const xtd::ustring &regex_pattern, const xtd::ustring &actual, const xtd::ustring &message)
Validates that does not match regex pattern.
Definition: string_assume.h:570
static void contains(const xtd::ustring &item, const xtd::ustring &string)
Validates that string contains an item.
Definition: string_assume.h:145
static void are_not_equal_ignoring_case(const xtd::ustring &expected, const xtd::ustring &actual, const xtd::ustring &message)
Validates that two type are not equal ignoring case.
Definition: string_assume.h:114
static void does_not_match(const xtd::ustring &regex_pattern, const xtd::ustring &actual, const xtd::diagnostics::stack_frame &stack_frame)
Validates that does not match regex pattern.
Definition: string_assume.h:558
static void does_not_contain(const xtd::ustring &item, const xtd::ustring &string)
Validates that string contains an item.
Definition: string_assume.h:203
static void ends_with(const xtd::ustring &item, const xtd::ustring &string, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that string starts with item.
Definition: string_assume.h:417
static void are_equal_ignoring_case(const xtd::ustring &expected, const xtd::ustring &actual, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that two type are equal ignoring case.
Definition: string_assume.h:73
static void starts_with(const xtd::ustring &item, const xtd::ustring &string, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that string starts with item.
Definition: string_assume.h:301
static void matches(const xtd::ustring &regex_pattern, const xtd::ustring &actual, const xtd::diagnostics::stack_frame &stack_frame)
Validates that matches regex pattern.
Definition: string_assume.h:504
static void matches(const xtd::ustring &regex_pattern, const xtd::ustring &actual, const xtd::ustring &message)
Validates that matches regex pattern.
Definition: string_assume.h:516
static void ends_with(const xtd::ustring &item, const xtd::ustring &string)
Validates that string ends with a specific item.
Definition: string_assume.h:377
static void does_not_contain(const xtd::ustring &item, const xtd::ustring &string, const xtd::diagnostics::stack_frame &stack_frame)
Validates that string contains an item.
Definition: string_assume.h:216
static void does_not_start_with(const xtd::ustring &item, const xtd::ustring &string, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that string starts with item.
Definition: string_assume.h:359
static void starts_with(const xtd::ustring &item, const xtd::ustring &string, const xtd::ustring &message)
Validates that string starts with item.
Definition: string_assume.h:287
static void contains(const xtd::ustring &item, const xtd::ustring &string, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
Validates that string contains an item.
Definition: string_assume.h:185
static void does_not_end_with(const xtd::ustring &item, const xtd::ustring &string, const xtd::diagnostics::stack_frame &stack_frame)
Validates that string starts with item.
Definition: string_assume.h:448
static void does_not_contain(const xtd::ustring &item, const xtd::ustring &string, const xtd::ustring &message)
Validates that string contains an item.
Definition: string_assume.h:229
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17
Contains xtd::tunit::string_assert class.