/
farado
/
farado-binara
Обзор
Документация
Войти
/
farado
/
farado-binara
Код
Запросы
0
Пакеты
0
Релизы
0
CI/CD
Аналитика
develop
tests/elements/test_element_phase.cpp
33 строки
1 KB
Ostapenko Alexey
[common][datenaro][tests] Добавлена сущность предметной области: phase.
25 мар 2024, 18:07
25 мар 2024, 18:07
0f59364
Код
Авторство
О чём код?
#define BOOST_TEST_MODULE testElementPhase #include <boost/test/unit_test.hpp> #include "common/elements/element_maker.h" #include "common/elements/phase.h" BOOST_AUTO_TEST_CASE(testPhaseJson) { Elements::PhasePtr first = std::make_shared<Elements::Phase>(); first->setId(1); first->setProjectId(3); first->setCaption("a"); first->setDescription("B"); const std::time_t beginDate = std::time(nullptr); const std::time_t endDate = std::time(nullptr); first->setBeginDate(beginDate); first->setEndDate(endDate); const auto json = first->toJsonString(); const Elements::ElementPtr second(Elements::fromJsonString(json)); BOOST_CHECK(first->isSame(second.get())); const auto third = std::static_pointer_cast<Elements::Phase>(second); BOOST_CHECK(1 == third->id()); BOOST_CHECK(3 == third->projectId()); BOOST_CHECK("a" == third->caption()); BOOST_CHECK("B" == third->description()); BOOST_CHECK("a" == third->searchCaption()); BOOST_CHECK("b" == third->searchDescription()); BOOST_CHECK(beginDate == third->beginDate()); BOOST_CHECK(endDate == third->endDate()); }