O'Reilly logo

Qt 5 Projects by Marco Piccolino

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Defining the first outcome step

In this step, we need to check that the entities::GroceryItems list actually contains an item with the name "X", that is, the name that was passed as an argument to the use case in the previous step. To implement this step, we can just add a simple wrapper method to entities::GroceryItems, which calls into the list's available search mechanisms (for example, QList's contains or indexOf). We can call such a method, contains:

...void Usecases_add_grocery_item::test_item_can_be_added(){    ...    // Then the grocery item with name X is contained in the list    QVERIFY(m_groceryItems->contains("name", "avocados"));    ...}...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required