TutorialsAndTests/Tests/AtlHenTests.cpp
TEST(AtlHenTests, RequireThat_Cluck_IsCalledOnAsyncCluckObserver_WhenPassedToHen)
{
    auto observer = make_self<IAsyncCluckObserverMock>();
    EXPECT_CALL(*observer, OnCluck()).WillOnce(Return(S_OK));

    CComPtr<IHen> hen;
    HR(CoCreateInstance(CLSID_AtlHen, nullptr, CLSCTX_INPROC_SERVER, IID_IHen, reinterpret_cast<void**>(&hen)));

    HR(hen->CluckAsync(observer));
}
// Test that demonstrates how we can use mocks with COM by creating local instances
Test that demonstrates how we can use mocks with COM by creating local instances
Test that demonstrates how we can use mocks with COM by creating local instances
TEST(AtlHenTests, RequireThat_Cluck_IsCalledOnAsyncCluckObserver_WhenPassedToHen)
{
    auto observer = make_self<IAsyncCluckObserverMock>();
    EXPECT_CALL(*observer, OnCluck()).WillOnce(Return(S_OK));
    CComPtr<IHen> hen;
    HR(CoCreateInstance(CLSID_AtlHen, nullptr, CLSCTX_INPROC_SERVER, IID_IHen, reinterpret_cast<void**>(&hen)));
    HR(hen->CluckAsync(observer));
}
TEST ( AtlHenTests , RequireThat_Cluck_IsCalledOnAsyncCluckObserver_WhenPassedToHen ) { auto observer = make_self < IAsyncCluckObserverMock > ( ) ; EXPECT_CALL ( * observer , OnCluck ( ) ) . WillOnce ( Return ( S_OK ) ) ; CComPtr < IHen > hen ; HR ( CoCreateInstance ( CLSID_AtlHen , nullptr , CLSCTX_INPROC_SERVER , IID_IHen , reinterpret_cast < void * * > ( & hen ) ) ) ; HR ( hen -> CluckAsync ( observer ) ) ; }
Test that demonstrates how we can use mocks with COM by creating local instances
Test that demonstrates how we can use mocks with COM by creating local instances