Greetings, A week long collaboration between me and Gpt yielded this functioning mock of a sample UEFI Protocol: struct SampleProtocol { INTN    (*GetVersion)( ); }; struct MockSampleProtocol : public SampleProtocol { static MockSampleProtocol    *instance; MockSampleProtocol ( ) { // Assign the instance pointer instance = this; // Point the function pointer in TestStruct to the static method GetVersion = StaticGetVersion; } // Define a static method that forwards the call to the mock method static INTN StaticGetVersion ( ) { return instance->MockGetVersion (); } MOCK_METHOD (INTN, MockGetVersion, ()); }; MockSampleProtocol  *MockSampleProtocol::instance = nullptr; TEST (SampleProtocolTest, SampleTest) { MockSampleProtocol  mockSampleProtocol; SampleProtocol      *sampleProtocol; sampleProtocol = &mockSampleProtocol; EXPECT_CALL (mockSampleProtocol, MockGetVersion) .WillOnce (Return (42)); ASSERT_EQ (42, sampleProtocol->GetVersion ()); } In your opinion, is this an appropriate approach? I suppose that mocking a UEFI protocol is something common, so I wonder if this w ould be worth documenting? Best Regards, Me & Gpt -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109013): https://edk2.groups.io/g/devel/message/109013 Mute This Topic: https://groups.io/mt/101360319/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-