How to Gtest nested loop where Registry value is used? can we mock Registry

  c++, gmock, googletest

Below is the sample code part. How to mock Registry value for RegOpenKey

if (ERROR_SUCCESS == RegOpenKeyEx(HKEY, M_REGISTRY, 0, KEY_READ, &hKey))
        {
            SLI << "ABC
            if (ERROR_SUCCESS == RegQueryValueEx(hKey, S_TYPE, 0, NULL, (LPBYTE)Value, &dwSize))
            {
                wstrVPN = Value;
                SLI << "DEF " << wstrVPN.c_str();
            }
            else
            {
                SLE << "GHI";
            }
    }

Source: Windows Questions C++

LEAVE A COMMENT