public void OverrideChangesFactory() { IQueueManagerFactory newFactory = mocks.StrictMock <IQueueManagerFactory>(); IQueueManager newManager = mocks.StrictMock <IQueueManager>(); Expect.Call(newFactory.Create(null, null, null)).Return(newManager); mocks.ReplayAll(); IntegrationQueueManagerFactory.OverrideFactory(newFactory); try { object instance = IntegrationQueueManagerFactory.CreateManager(null, null, null); Assert.AreSame(newManager, instance); } finally { // Clean up - otherwise the static instance will be corrected IntegrationQueueManagerFactory.ResetFactory(); } mocks.VerifyAll(); }
/// <summary> /// Generates a queue manager using the default factory. /// </summary> /// <param name="projectIntegratorListFactory">The integrator factory.</param> /// <param name="configuration">The configuration.</param> /// <param name="stateManager">The state manager to use.</param> /// <returns>The new queue manager.</returns> public static IQueueManager CreateManager(IProjectIntegratorListFactory projectIntegratorListFactory, IConfiguration configuration, IProjectStateManager stateManager) { return(managerFactory.Create(projectIntegratorListFactory, configuration, stateManager)); }