MockManagerMockGlobalFunctions Method

Typemock Isolator Developer Guide
Use this type when mocking global functions

Namespace:  TypeMock
Assembly:  TypeMock (in TypeMock.dll) Version: 9.3.6.0 (9.3.6.0)
Syntax

public static Mock MockGlobalFunctions()

Return Value

Type: Mock
New Mock Object
Remarks

This is an example of how to mock global functions in C++
Examples

// Managed C++
namespace TestWithCpp
{
    int globalFunction(int a) {return a;}
}
And the test
// Managed C++
[Test]
void Global() {
    Mock* mock = MockManager::MockGlobalFunctions();
    // Notice the '.' and NOT '::' !!!
    mock->ExpectAndReturn("TestWithCpp<b>.</b>globalFunction",__box(5));
    Assert::AreEqual(__box(5), __box(globalFunction(4)));
}
See Also

Reference