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 usecase action step

This step will implement the call to the use case. Following what was done for CheckAvailableItems, we could call a run method by passing in any other necessary argument. In this case, we need to specify the name of the grocery item, as that will be the attribute which is unique for every grocery item. Thus, a possible API for this step could look like this:

usecases::AddGroceryItem::run(const QString& name)

And here is a test call:

...void Usecases_add_grocery_item::test_item_can_be_added(){    ...    // When I add a grocery item with name X    auto addGroceryItem = new usecases::AddGroceryItem(m_groceryItems, this);    QSignalSpy addGroceryItemSuccess(addGroceryItem,  &usecases::AddGroceryItem::success); addGroceryItem->run("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