generated from Sithas/conan_template
Завершение контроллера
This commit is contained in:
@@ -15,6 +15,10 @@ using namespace boost;
|
||||
using namespace std;
|
||||
using namespace uad;
|
||||
|
||||
using IControllerMock = Controller<beast::http::string_body,
|
||||
std::allocator<char>,
|
||||
beast::http::string_body>;
|
||||
|
||||
class MockExecutor : public IExecutor<beast::http::string_body,
|
||||
std::allocator<char>,
|
||||
beast::http::string_body>
|
||||
@@ -33,9 +37,7 @@ public:
|
||||
|
||||
BOOST_AUTO_TEST_CASE(Should_Be_Initiated_With_No_Executors)
|
||||
{
|
||||
Controller<beast::http::string_body,
|
||||
std::allocator<char>,
|
||||
beast::http::string_body> my_controller;
|
||||
IControllerMock my_controller;
|
||||
|
||||
BOOST_CHECK(!my_controller.FindExecutor(beast::http::verb::get).has_value());
|
||||
BOOST_CHECK(!my_controller.FindExecutor(beast::http::verb::post).has_value());
|
||||
@@ -47,13 +49,16 @@ BOOST_AUTO_TEST_CASE(Should_Be_Initiated_With_No_Executors)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(Should_Be_Initiated_With_Unordered_Map_HTTP_Methods_To_Executors)
|
||||
{
|
||||
std::unordered_map<boost::beast::http::verb, std::unique_ptr<IExecutor<beast::http::string_body, std::allocator<char>, beast::http::string_body>>> executors;
|
||||
IControllerMock::HTTPMethodsToExecutors executors;
|
||||
|
||||
executors[beast::http::verb::get] = make_unique<MockExecutor>();
|
||||
executors[beast::http::verb::get] = make_shared<MockExecutor>();
|
||||
executors[beast::http::verb::post] = make_shared<MockExecutor>();
|
||||
executors[beast::http::verb::put] = make_shared<MockExecutor>();
|
||||
executors[beast::http::verb::delete_] = make_shared<MockExecutor>();
|
||||
executors[beast::http::verb::head] = make_shared<MockExecutor>();
|
||||
executors[beast::http::verb::options] = make_shared<MockExecutor>();
|
||||
|
||||
Controller<beast::http::string_body,
|
||||
std::allocator<char>,
|
||||
beast::http::string_body> my_controller(std::move(executors));
|
||||
IControllerMock my_controller(std::move(executors));
|
||||
|
||||
BOOST_CHECK(my_controller.FindExecutor(beast::http::verb::get).has_value());
|
||||
BOOST_CHECK(my_controller.FindExecutor(beast::http::verb::post).has_value());
|
||||
|
||||
Reference in New Issue
Block a user