I have the following scenario:
class InterfaceA;
class InterfaceB;
class InterfaceC;
class InterfaceA
{
virtual void foo(InterfaceC&) = 0;
};
class InterfaceB
{
virtual void bar() = 0;
};
class InterfaceC
{
virtual void bla() = 0;
};
// MOCKs
class MockA : public InterfaceA
{
public:
MOCK_METHOD0(foo, void(InterfaceC&));
};
class MockB : public InterfaceB
{
public:
MOCK_METHOD0(bar, void());
};
class ImplC : public InterfaceC
{
public:
ImplC(InterfaceA& a, Interface& b) : m_a(a), m_b(b) {}
void doSomething() {
m_a.foo(*this);
}
virtual void bla()
{
m_b.bar();
}
};
MockA mockA; MockB mockB; EXPECT_CALL(mockA, foo()); ImplC impl(mockA, mockB); impl.doSomething(); // will call foo on mockA
In case doSomething is invoked, foo will be called on MockA. How can I trigger an invocation of the method bla, in case foo will be invoked? Is it somehow possible to create an expectation like:
EXPECT_CALL(mockA, foo()).WillOnce(Invoke(impl.bla()));
?
I hope the answer is clear and the example too.
Thanks in advance. Mart