xtd 0.2.0
Loading...
Searching...
No Matches
does_not_value.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "operator_value.hpp"
6#include "../assert.hpp"
7#include "../assume.hpp"
11#include "../string_assert.hpp"
12#include "../string_assume.hpp"
13#include "../string_valid.hpp"
14#include "../valid.hpp"
15
17namespace xtd {
19 namespace tunit {
21 namespace constraints {
22 template<class actual_t>
23 class does_not_value : public actual_value<actual_t> {
24 public:
26
38 template<class expected_t>
39 auto end_with(const expected_t& expected, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) const {
40 if (actual_value<actual_t>::is_assert()) xtd::tunit::string_assert::does_not_end_with(expected, actual_value<actual_t>::actual(), stack_frame);
41 else if (actual_value<actual_t>::is_valid()) xtd::tunit::string_valid::does_not_end_with(expected, actual_value<actual_t>::actual(), stack_frame);
42 else xtd::tunit::string_assume::does_not_end_with(expected, actual_value<actual_t>::actual(), stack_frame);
44 }
45
56 template<class expected_t>
57 auto end_with(const expected_t& expected, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) const {
58 if (actual_value<actual_t>::is_assert()) xtd::tunit::string_assert::does_not_end_with(expected, actual_value<actual_t>::actual(), message, stack_frame);
59 else if (actual_value<actual_t>::is_valid()) xtd::tunit::string_valid::does_not_end_with(expected, actual_value<actual_t>::actual(), message, stack_frame);
60 else xtd::tunit::string_assume::does_not_end_with(expected, actual_value<actual_t>::actual(), message, stack_frame);
62 }
63
74 template<class expected_t>
75 auto start_with(const expected_t& expected, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) const {
76 if (actual_value<actual_t>::is_assert()) xtd::tunit::string_assert::does_not_start_with(expected, actual_value<actual_t>::actual(), stack_frame);
77 else if (actual_value<actual_t>::is_valid()) xtd::tunit::string_valid::does_not_start_with(expected, actual_value<actual_t>::actual(), stack_frame);
78 else xtd::tunit::string_assume::does_not_start_with(expected, actual_value<actual_t>::actual(), stack_frame);
80 }
81
92 template<class expected_t>
93 auto start_with(const expected_t& expected, const xtd::string& message, const xtd::diagnostics::stack_frame& stack_frame = xtd::diagnostics::stack_frame::current()) const {
94 if (actual_value<actual_t>::is_assert()) xtd::tunit::string_assert::does_not_start_with(expected, actual_value<actual_t>::actual(), message, stack_frame);
95 else if (actual_value<actual_t>::is_valid()) xtd::tunit::string_valid::does_not_start_with(expected, actual_value<actual_t>::actual(), message, stack_frame);
96 else xtd::tunit::string_assume::does_not_start_with(expected, actual_value<actual_t>::actual(), message, stack_frame);
98 }
99
100
101 protected:
103
105 does_not_value() = default;
106 does_not_value(actual_value<actual_t>&& v) : actual_value<actual_t> {std::move(v)} {}
107 does_not_value(const actual_value<actual_t>& v) : actual_value<actual_t> {v} {}
109 };
110 }
111 }
112}
Contains xtd::tunit::assume class.
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition stack_frame.hpp:48
static stack_frame current(const xtd::diagnostics::source_location &value=xtd::diagnostics::source_location::current()) noexcept
Crates a new xtd::diagnostics::stack_frame object corresponding to the location of the call site.
Definition actual_value.hpp:18
Definition does_not_value.hpp:23
auto end_with(const expected_t &expected, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current()) const
Asserts that string ends with specified expected value.
Definition does_not_value.hpp:39
auto start_with(const expected_t &expected, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current()) const
Asserts that string starts with specified item and specified user message.
Definition does_not_value.hpp:93
auto end_with(const expected_t &expected, const xtd::string &message, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current()) const
Asserts that string ends with specified expected value and specified user message.
Definition does_not_value.hpp:57
auto start_with(const expected_t &expected, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current()) const
Asserts that string starts with specified item.
Definition does_not_value.hpp:75
Definition operator_value.hpp:21
static void does_not_end_with(const xtd::string &item, const xtd::string &string, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that string ends with item.
static void does_not_start_with(const xtd::string &item, const xtd::string &string, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Asserts that string starts with item.
static void does_not_start_with(const xtd::string &item, const xtd::string &string, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Validates that string starts with item.
static void does_not_end_with(const xtd::string &item, const xtd::string &string, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Validates that string starts with item.
static void does_not_start_with(const xtd::string &item, const xtd::string &string, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Validates that string starts with item.
static void does_not_end_with(const xtd::string &item, const xtd::string &string, const xtd::diagnostics::stack_frame &stack_frame=xtd::diagnostics::stack_frame::current())
Validates that string starts with item.
Contains xtd::tunit::collection_assert class.
Contains xtd::tunit::collection_assume class.
Contains xtd::tunit::collection_valid class.
#define self_
The self_ expression is a reference value expression whose value is the reference of the implicit obj...
Definition self.hpp:20
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
@ v
The V key.
Definition console_key.hpp:130
The constraints namespace contains the constraint-based assert model.
Definition actual_value.hpp:12
The tunit namespace contains a unit test library.
Definition abort_error.hpp:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Contains xtd::tunit::constraints::operator_value class.
Contains xtd::tunit::string_assert class.
Contains xtd::tunit::string_assume class.
Contains xtd::tunit::string_valid class.
Contains xtd::tunit::valid class.
Contains xtd::tunit::assert class.