test/ObserverTest.cpp
/**
 * Adding an observer to an observable interface should allow the observer to
 * receive events.
 */
Adding an observer to an observable interface should allow the observer to
receive events.
Adding an observer to an observable interface should allow the observer to receive events .
TEST(ObserverTest, addObserver)
{
    auto observable = make_shared<Observable<TestObserver>>();
    auto obs = make_shared<MockObserver>();
    observable->addObserver(obs);
    observable->notify([=](TestObserver& o) { o.onChange(); });
    EXPECT_TRUE(VALIDATE(*obs, onChange).called());
}
TEST ( ObserverTest , addObserver ) { auto observable = make_shared < Observable < TestObserver > > ( ) ; auto obs = make_shared < MockObserver > ( ) ; observable -> addObserver ( obs ) ; observable -> notify ( [ = ] ( TestObserver & o ) { o . onChange ( ) ; } ) ; EXPECT_TRUE ( VALIDATE ( * obs , onChange ) . called ( ) ) ; }
Adding an observer to an observable interface should allow the observer to
 receive events.
Adding an observer to an observable interface should allow the observer to receive events .
//add the observer to this object. //notify the observer. //the observer should have been notified.