示例#1
0
        public void OverrideChangesFactory()
        {
            IQueueManagerFactory newFactory = mocks.Create <IQueueManagerFactory>(MockBehavior.Strict).Object;
            IQueueManager        newManager = mocks.Create <IQueueManager>(MockBehavior.Strict).Object;

            Mock.Get(newFactory).Setup(_newFactory => _newFactory.Create(null, null, null)).Returns(newManager).Verifiable();

            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();
        }
示例#2
0
        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();
        }
示例#3
0
 public void Teardown()
 {
     IntegrationQueueManagerFactory.ResetFactory();
 }