The December CTP of the VS SDK, which has not yet available for downloading as of this posting, includes mock interfaces for nearly all Visual Studio Platform interfaces, as well as numerous changes to the VSL infrastructure for mock objects.  The changes to the VSL infrastructure where necessitated in part by the development of the mock interfaces, and in part to make ease the utilization of the mock interfaces in unit tests.  If you have any comments or suggestions regarding VSL , please post them on the official VSL feedback thread.

The breaking changes are:

  • The class MockBase is no longer a template class.
  • The static method MockBase::SetUnitTestBase(const UnitTestBase& rUnitTestBase) was removed.  The static method UnitTestBase::SetUnitTestBase(const UnitTestBase& rUnitTestBase) should be utilized instead.
  • The static method MockBase::GetCurrentUnitTestBase() was removed.  The static method UnitTestBase::GetCurrentUnitTestBase() should be utilized instead.
  • The static method MockBase::CheckValidString(const wchar_t * const pszValid, const wchar_t * const pszParam) was renamed to CheckValidStringW (and CheckValidStringA was added as well).
  • The static method MockBase::CheckValidPointer now has two template arguments instead of one.  This is only breaking if the argument is explicitly specified, which is unnecessary, as the compiler can infer the template argument from what is passed into the method.
  • The macro VSL_DECLARE_VALIDVALUES(type) was removed.  The macros VSL_DEFINE_MOCK_METHOD_NOARGS_NORETURN(methodName), VSL_DEFINE_MOCK_METHOD(methodName), and VSL_DEFINE_MOCK_METHOD_NOARGS(methodName) should be utilized instead.
  • The macro VSL_RETURN_VALIDVALUES_HR() was removed.  The macro VSL_RETURN_VALIDVALUES() should be utilized instead.
  • The class IVsShellFixedVSPropertySet was removed.  IVsShellMockImpl should be utilized instead.

The samples VisualStudioIntegration\Samples\IDE\CPP\Reference.MenuAndCommands and VisualStudioIntegration\Samples\IDE\CPP\Reference.Services provide examples of unit tests, which are complete, and make use of the new mock interfaces and the new macros that ease the use of the new mock interfaces.

The sample VisualStudioIntegration\Samples\IDE\CPP\Reference.ToolWindow\UnitTest has more complex unit testing needs then other two samples, and some of this illustrated currently, but the unit test is not yet complete.