/// <summary> /// Enables mocking of calls to this class. /// </summary> /// /// <remarks> /// The calling class should pass in a class that derives from this /// class and overrides the calls to be mocked. /// </remarks> /// /// <param name="mock">The mocking class.</param> /// /// <exception cref="InvalidOperationException"> /// There is already a mock registered for this class. /// </exception> /// public static void EnableMock(HealthVaultPlatformApplication mock) { Validator.ThrowInvalidIf(_saved != null, "ClassAlreadyMocked"); _saved = _current; _current = mock; }
/// <summary> /// Removes mocking of calls to this class. /// </summary> /// /// <exception cref="InvalidOperationException"> /// There is no mock registered for this class. /// </exception> /// public static void DisableMock() { Validator.ThrowInvalidIfNull(_saved, "ClassIsntMocked"); _current = _saved; _saved = null; }