kima2/test/test_seller.cpp

41 lines
1,013 B
C++
Raw Permalink Normal View History

#define BOOST_TEST_MODULE seller
2018-07-09 21:42:04 +02:00
#include "../src/core/seller.h"
2018-07-11 08:33:16 +02:00
#include <array>
2018-07-09 16:54:04 +02:00
#include <boost/test/included/unit_test.hpp>
2018-07-11 08:34:23 +02:00
BOOST_AUTO_TEST_CASE(create_uuid_nil)
{
Seller seller{};
2019-10-04 15:15:43 +02:00
BOOST_TEST(seller.getId().is_nil() == true);
}
2018-07-09 17:52:46 +02:00
2018-07-11 08:34:23 +02:00
BOOST_AUTO_TEST_CASE(create_uuid)
{
2018-07-09 17:52:46 +02:00
Seller seller{};
seller.createUuid();
2019-10-04 15:15:43 +02:00
BOOST_TEST(seller.getId().is_nil() == false);
2018-07-11 08:33:16 +02:00
}
2018-07-11 08:34:23 +02:00
BOOST_AUTO_TEST_CASE(create_many)
{
2018-07-11 08:33:16 +02:00
constexpr unsigned int QUANTITY{10000};
std::array<Seller, QUANTITY> sellers;
for (unsigned i = 0; i < sellers.size(); i++) {
sellers[i] = Seller();
2019-10-04 15:15:43 +02:00
//sellers[i].createUuid();
2018-07-11 08:33:16 +02:00
}
2018-07-11 13:25:39 +02:00
}
BOOST_AUTO_TEST_CASE(with_article) {
Seller seller{"Max", "Mustermann"};
2018-07-20 11:52:26 +02:00
auto article = std::make_unique<Article>();
2018-07-12 08:26:03 +02:00
article->setDescription("Test article");
2018-07-20 11:52:26 +02:00
seller.addArticle(std::move(article));
BOOST_TEST((article == nullptr));
2018-07-12 14:39:08 +02:00
BOOST_TEST(seller.getArticles(false).at(0)->getDescription() == "Test article");
BOOST_TEST(seller.numArticlesSold() == 0);
2019-10-04 15:15:43 +02:00
}