test cases adopted
This commit is contained in:
parent
d321a5d95e
commit
3be2418102
1 changed files with 22 additions and 17 deletions
|
@ -17,23 +17,28 @@ BOOST_AUTO_TEST_CASE(store_seller_fail)
|
|||
{
|
||||
Database db(":memory:");
|
||||
db.init();
|
||||
std::vector<Seller> sellers;
|
||||
sellers.push_back({});
|
||||
sellers.push_back({});
|
||||
std::vector<std::shared_ptr<Seller>> sellers;
|
||||
sellers.push_back(std::make_shared<Seller>());
|
||||
sellers.push_back(std::make_shared<Seller>());
|
||||
BOOST_CHECK_THROW(db.storeSellers(sellers), std::runtime_error);
|
||||
}
|
||||
BOOST_AUTO_TEST_CASE(store_sellers_succ)
|
||||
{
|
||||
Database db(":memory:");
|
||||
db.init();
|
||||
std::vector<Seller> sellers;
|
||||
Seller a{};
|
||||
a.createUuid();
|
||||
a.setSellerNo(1);
|
||||
Seller b{};
|
||||
b.createUuid();
|
||||
b.setSellerNo(2);
|
||||
BOOST_TEST(a.getUuid() != b.getUuid());
|
||||
std::vector<std::shared_ptr<Seller>> sellers;
|
||||
auto a = std::make_shared<Seller>();
|
||||
a->createUuid();
|
||||
a->setSellerNo(1);
|
||||
auto b = std::make_shared<Seller>("Max", "Mustermann");
|
||||
b->createUuid();
|
||||
b->setSellerNo(2);
|
||||
auto c = std::make_shared<Article>();
|
||||
c->createUuid();
|
||||
c->setPrice(500);
|
||||
c->setDescription("Test");
|
||||
b->addArticle(c);
|
||||
BOOST_TEST(a->getUuid() != b->getUuid());
|
||||
sellers.push_back(a);
|
||||
sellers.push_back(b);
|
||||
BOOST_CHECK_NO_THROW(db.storeSellers(sellers));
|
||||
|
@ -43,14 +48,14 @@ BOOST_AUTO_TEST_CASE(seller_states)
|
|||
{
|
||||
Database db(":memory:");
|
||||
db.init();
|
||||
std::vector<Seller> sellers;
|
||||
Seller a;
|
||||
a.setSellerNo(3);
|
||||
a.createUuid();
|
||||
std::vector<std::shared_ptr<Seller>> sellers;
|
||||
auto a = std::make_shared<Seller>();
|
||||
a->setSellerNo(3);
|
||||
a->createUuid();
|
||||
sellers.push_back(a);
|
||||
std::cout << "Anzahl sellers: " << sellers.size() << "\n";
|
||||
BOOST_TEST((sellers.at(0).getState() == Entity::State::NEW));
|
||||
BOOST_TEST((sellers.at(0)->getState() == Entity::State::NEW));
|
||||
BOOST_TEST(db.storeSellers(sellers) == 1);
|
||||
BOOST_TEST((sellers.at(0).getState() == Entity::State::OK));
|
||||
BOOST_TEST((sellers.at(0)->getState() == Entity::State::OK));
|
||||
BOOST_TEST(db.storeSellers(sellers) == 0);
|
||||
}
|
Loading…
Reference in a new issue