To contrast this example with the previous one, this time, we are using Trompeloeil for test doubles and Catch2 as a testing framework:
#include "merchants/reviews.h"
#include "fake_customer_review_store.h"
// order is important
#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>
#include <catch2/trompeloeil.hpp>
#include <memory>
#include <merchants/visited_merchant_history.h>
using trompeloeil::_;
class mock_visited_merchant : public i_visited_merchant {
public:
MAKE_MOCK0(get_rating, stars(), override);
MAKE_MOCK1(post_rating, void(stars s), override);
};
SCENARIO("merchant history keeps store up to date", "[mobile app]") {
GIVEN("a history with one rated merchant") {
static constexpr std::size_t CUSTOMER_ID = 7777;
static constexpr std::size_t MERCHANT_ID = 1234;
static constexpr const char *REVIEW_TEXT = "Very nice!";
static constexpr stars RATING = stars{5.f};
auto...