/// <summary> /// Pushes a new <see cref="MockRestartManagerService"/> scope. /// </summary> /// <typeparam name="TService">A <see cref="IRestartManagerService"/> to mock.</typeparam> /// <param name="sessionId">Optional session ID to return. The default is 0.</param> /// <param name="sessionKey">Optional session key to return. The default is "123abc".</param> /// <param name="error">Optional error to return. The default is 0 (no error).</param> /// <returns>A <see cref="MockRestartManagerService"/> implementing <typeparamref name="TService"/>.</returns> public MockRestartManagerService Push <TService>(int sessionId = MockRestartManagerService.DefaultSessionId, string sessionKey = MockRestartManagerService.DefaultSessionKey, int error = NativeMethods.ERROR_SUCCESS) where TService : IRestartManagerService { var mock = MockServiceFactory.Create <TService>(this, sessionId, sessionKey, error); AddService(mock.Object); return(mock); }
/// <summary> /// Pushes a new <see cref="MockService{TService}"/> scope. /// </summary> /// <typeparam name="TService">The type of service to mock.</typeparam> /// <typeparam name="TMock">The <see cref="MockService{TService}"/> implementing the <typeparamref name="TService"/> to push.</typeparam> /// <returns>A <see cref="MockService{TService}"/> implementing <typeparamref name="TService"/>.</returns> public TMock Push <TService, TMock>() where TService : class where TMock : MockService <TService>, TService { var mock = MockServiceFactory.Create <TService, TMock>(this); AddService(mock.Object); return(mock); }