public void Trying_to_build_with_an_InvalidCastException_will_throw_error_206()
        {
            var mocks   = new MockRepository();
            var builder = mocks.StrictMock <IInstanceBuilder>();

            Expect.Call(builder.BuildInstance(null)).Throw(new InvalidCastException());
            LastCall.IgnoreArguments();
            mocks.Replay(builder);

            assertActionThrowsErrorCode(206, delegate
            {
                var instance = new ConfiguredInstance(GetType());
                instance.Build(GetType(), new StubBuildSession(), builder);
            });
        }
Пример #2
0
		public void VerifyingThatEventWasAttached()
		{
			MockRepository mocks = new MockRepository();
			IWithEvent events = (IWithEvent)mocks.StrictMock(typeof(IWithEvent));
			events.Load += null; //ugly syntax, I know, but the only way to get this to work
			IEventRaiser raiser = LastCall.IgnoreArguments().GetEventRaiser();
			mocks.ReplayAll();

			EventConsumer consumerMock = new EventConsumer(events);
			//Next line invokes Load event.
			raiser.Raise(this, EventArgs.Empty);
			mocks.VerifyAll();

			Assert.True(consumerMock.OnLoadCalled);
		}
Пример #3
0
        public void ValidateResponse()
        {
            MockRepository  mocks     = new MockRepository();
            ModbusTransport transport = mocks.PartialMock <ModbusTransport>();

            IModbusMessage request  = new ReadCoilsInputsRequest(Modbus.ReadCoils, 1, 1, 1);
            IModbusMessage response = new ReadCoilsInputsResponse(Modbus.ReadCoils, 1, 1, null);

            transport.OnValidateResponse(null, null);
            LastCall.IgnoreArguments();

            mocks.ReplayAll();
            transport.ValidateResponse(request, response);
            mocks.VerifyAll();
        }
Пример #4
0
        public void ChangeOtherObjectBackToOriginalInClientTransactionRollingBack()
        {
            _order1.DeliveryDate = DateTime.Now;
            _customer1.Name      = "New customer name";
            _mockRepository.BackToRecord(_order1MockEventReceiver);
            _mockRepository.BackToRecord(_customer1MockEventReceiver);
            _mockRepository.BackToRecord(_clientTransactionExtensionMock);

            using (_mockRepository.Ordered())
            {
                _clientTransactionExtensionMock.RollingBack(null, null);
                LastCall.Constraints(Is.Same(TestableClientTransaction), Property.Value("Count", 2) & new ContainsConstraint(_order1, _customer1));

                _clientTransactionMockEventReceiver.RollingBack(_order1, _customer1);
                LastCall.Do(new EventHandler <ClientTransactionEventArgs> (ChangeCustomerNameBackToOriginalCallback));

                _clientTransactionExtensionMock.PropertyValueChanging(TestableClientTransaction, null, null, null, null);
                LastCall.IgnoreArguments();
                _customer1MockEventReceiver.PropertyChanging(null, null);
                LastCall.IgnoreArguments();
                _customer1MockEventReceiver.PropertyChanged(null, null);
                LastCall.IgnoreArguments();
                _clientTransactionExtensionMock.PropertyValueChanged(TestableClientTransaction, null, null, null, null);
                LastCall.IgnoreArguments();

                _order1MockEventReceiver.RollingBack(null, null);
                LastCall.Constraints(Is.Same(_order1), Is.NotNull());

                _customer1MockEventReceiver.RollingBack(null, null);
                LastCall.Constraints(Is.Same(_customer1), Is.NotNull());

                _order1MockEventReceiver.RolledBack(null, null);
                LastCall.Constraints(Is.Same(_order1), Is.NotNull());

                // Note: Customer1 must not raise a RolledBack event, because its Name has been set back to the OriginalValue.

                _clientTransactionMockEventReceiver.RolledBack(_order1);

                _clientTransactionExtensionMock.RolledBack(null, null);
                LastCall.Constraints(Is.Same(TestableClientTransaction), Property.Value("Count", 1) & List.IsIn(_order1));
            }

            _mockRepository.ReplayAll();

            TestableClientTransaction.Rollback();

            _mockRepository.VerifyAll();
        }
Пример #5
0
        [Test] public void WorksFineWithoutListenerWhenConnectionIsDdConnection()
        {
            var connection = _mockery.StrictMock <DbConnection>();

            Expect.Call(_dbProvider.CreateConnection()).Return(connection);
            ((IDbConnection)connection).Open();
            connection.StateChange += null;
            var eventRaiser = LastCall.IgnoreArguments().Repeat.Any().GetEventRaiser();

            _mockery.ReplayAll();
            var conn = _testee.CreateConnection();

            conn.Open();
            eventRaiser.Raise(connection, new StateChangeEventArgs(ConnectionState.Closed, ConnectionState.Open));
            _mockery.VerifyAll();
        }
Пример #6
0
        public void Visit_givenVisitor_callsVisitTarget()
        {
            var visitor = mRepository.DynamicMock <INAntVisitor>();

            using (mRepository.Record())
            {
                visitor.VisitTarget(null);
                LastCall.IgnoreArguments()
                .Repeat.Once();
            }

            using (mRepository.Playback())
            {
                var target = new NAntTarget("target", "description", "depends");
                target.Visit(visitor);
            }
        }
        public void Visit_givenVisitor_callsVisitProject()
        {
            var visitor = mRepository.DynamicMock <INAntVisitor>();

            using (mRepository.Record())
            {
                visitor.VisitProject(null);
                LastCall.IgnoreArguments()
                .Repeat.Once();
            }

            using (mRepository.Playback())
            {
                var project = CreateProject("sample");
                project.Visit(visitor);
            }
        }
Пример #8
0
        public void Can_mutate_and_test_a_target_assembly()
        {
            string targetAssembly =
                Utility.UnpackManifestResourceStream(
                    "JesterDotNet.Presenter.Tests.SampleData.AnimalFarm.dll");
            string testAssembly =
                Utility.UnpackManifestResourceStream(
                    "JesterDotNet.Presenter.Tests.SampleData.AnimalFarm.Tests.dll");

            UnpackSupportingTestFrameworkFiles();

            MockRepository            repository = new MockRepository();
            IJesterView               view       = repository.DynamicMock <IJesterView>();
            IEventRaiser              runEvent;
            IEnumerable <MutationDto> mutationResults = null;

            using (repository.Record())
            {
                view.Run += null;
                runEvent  = LastCall.IgnoreArguments().GetEventRaiser();
            }
            using (repository.Playback())
            {
                JesterPresenter presenter = new JesterPresenter(view);
                presenter.MutationComplete +=
                    delegate(object sender, MutationCompleteEventArgs e) { mutationResults = e.MutationResults; };

                runEvent.Raise(presenter, new RunEventArgs(targetAssembly, testAssembly, GetMutations(targetAssembly)));
            }

            int numberOfFailingTests = 0;

            foreach (MutationDto mutationDto in mutationResults)
            {
                foreach (TestResultDto testResult in mutationDto.TestResults)
                {
                    if (testResult is KilledMutantTestResultDto)
                    {
                        numberOfFailingTests++;
                    }
                }
            }

            Assert.AreEqual(3, numberOfFailingTests,
                            "After the inversion, two of the tests should fail.");
        }
Пример #9
0
        public void RaisingEventOnViewTest()
        {
            MockRepository mocks = new MockRepository();
            IView          view  = mocks.StrictMock <IView>();

            view.Load += null;                                       //create an expectation that someone will subscribe to this event
            LastCall.IgnoreArguments();                              // we don't care who is subscribing
            IEventRaiser raiseViewEvent = LastCall.GetEventRaiser(); //get event raiser for the last event, in this case, View

            mocks.ReplayAll();

            Presenter p = new Presenter(view);

            raiseViewEvent.Raise(this, new EventArgs());//Raise the event which has been bind then Present is instanciating

            Assert.IsTrue(p.OnLoadCalled);
        }
        public void UnicastMessage_PurgeReceiveBuffer()
        {
            MockRepository        mocks          = new MockRepository();
            IStreamResource       serialResource = mocks.StrictMock <IStreamResource>();
            ModbusSerialTransport transport      = new ModbusRtuTransport(serialResource);

            serialResource.DiscardInBuffer();
            serialResource.Write(null, 0, 0);
            LastCall.IgnoreArguments();

            // mangled response
            Expect.Call(serialResource.Read(new byte[] { 0, 0, 0, 0 }, 0, 4)).Return(4);

            serialResource.DiscardInBuffer();
            serialResource.Write(null, 0, 0);
            LastCall.IgnoreArguments();

            // normal response
            ReadCoilsInputsResponse response = new ReadCoilsInputsResponse(Modbus.ReadCoils, 2, 1,
                                                                           new DiscreteCollection(true, false, true, false, false, false, false, false));

            // read header
            Expect.Call(serialResource.Read(new byte[] { 0, 0, 0, 0 }, 0, 4))
            .Do(((Func <byte[], int, int, int>) delegate(byte[] buf, int offset, int count)
            {
                Array.Copy(response.MessageFrame, 0, buf, 0, 4);
                return(4);
            }));

            // read remainder
            Expect.Call(serialResource.Read(new byte[] { 0, 0 }, 0, 2))
            .Do(((Func <byte[], int, int, int>) delegate(byte[] buf, int offset, int count)
            {
                Array.Copy(ModbusUtility.CalculateCrc(response.MessageFrame), 0, buf, 0, 2);
                return(2);
            }));

            mocks.ReplayAll();

            ReadCoilsInputsRequest request = new ReadCoilsInputsRequest(Modbus.ReadCoils, 2, 3, 4);

            transport.UnicastMessage <ReadCoilsInputsResponse>(request);

            mocks.VerifyAll();
        }
Пример #11
0
        public void TestTriggerCompleteMessage()
        {
            // expectations
            Expect.Call(mockLog.IsInfoEnabled).Return(true);
            mockLog.Info(null);
            LastCall.IgnoreArguments();

            mockery.ReplayAll();

            Trigger t = new SimpleTrigger();

            JobExecutionContext ctx = new JobExecutionContext(
                null,
                TestUtil.CreateMinimalFiredBundleWithTypedJobDetail(typeof(NoOpJob), t),
                null);

            plugin.TriggerComplete(t, ctx, SchedulerInstruction.ReExecuteJob);
        }
Пример #12
0
        public void WriteMessageWrapsErrorsWithAMFException()
        {
            // Deliberately inject an exception.
            // This should be caught and wrapped by the AMFMessageWriter code.
            IASValue mockValue = Mocks.CreateMock <IASValue>();

            mockValue.AcceptVisitor(serializer, null);
            LastCall.IgnoreArguments().Throw(new Exception("Something bad happened."));

            Mocks.ReplayAll();

            AMFMessage message = new AMFMessage();

            message.Version = 0x1234;
            message.Headers.Add(new AMFHeader("abc", true, mockValue));

            AMFMessageWriter.WriteAMFMessage(output, message);
        }
        public void ShowTaxesEventDisplayAllTaxes()
        {
            _mockTaxesView.ShowTaxes += null;
            var showTaxesEventRaiser = LastCall.IgnoreArguments().GetEventRaiser();

            _mockTaxesView.AddTax += null;
            LastCall.IgnoreArguments();
            var taxes = new List <Tax>();

            Expect.Call(_mockTaxesService.Taxes).Return(taxes);
            _mockTaxesView.TaxesDisplay = taxes;

            _mockRepository.ReplayAll();

            var taxesPresenter = new TaxesPresenter(_mockTaxesService, _mockTaxesView);

            showTaxesEventRaiser.Raise(_mockTaxesView, EventArgs.Empty);
        }
Пример #14
0
        public void UnicastMessage_ErrorSlaveException()
        {
            MockRepository  mocks     = new MockRepository();
            ModbusTransport transport = mocks.PartialMock <ModbusTransport>();

            transport.Write(null);
            LastCall.IgnoreArguments();
            Expect.Call(transport.ReadResponse <ReadCoilsInputsResponse>())
            .Do((ThrowExceptionDelegate) delegate { throw new SlaveException(); });

            mocks.ReplayAll();

            ReadCoilsInputsRequest request = new ReadCoilsInputsRequest(Modbus.ReadInputs, 2, 3, 4);

            Assert.Throws <SlaveException>(() => transport.UnicastMessage <ReadCoilsInputsResponse>(request));

            mocks.VerifyAll();
        }
Пример #15
0
        protected Runner MockRunner()
        {
            var runner = Mocks.StrictMock <Runner>();

            runner.SetPropertyAsBehavior(v => v.Command);

            var asyncResults = new TestAsyncResults();

            runner.Expect(v => v.BeginExecute()).Return(asyncResults);

            runner.ErrorOutputReceived += null;
            LastCall.IgnoreArguments();

            runner.SetPropertyAsBehavior(v => v.ErrorOutput);
            runner.SetPropertyAsBehavior(v => v.Output);

            return(runner);
        }
Пример #16
0
        public void TestEventInitialization()
        {
            viewMocks.Init += null;             //also set expectation
            IEventRaiser init = LastCall.IgnoreArguments().GetEventRaiser();

            viewMocks.Load += null;             //also set expectation
            IEventRaiser load = LastCall.IgnoreArguments().GetEventRaiser();

            mocks.Replay(viewMocks);             //we move just this to replay state.
            PresenterBase <IView> presenterBase =
                mocks.StrictMock <PresenterBase <IView> >(viewMocks);

            presenterBase.Initialize();
            presenterBase.Load();
            mocks.ReplayAll();
            init.Raise(viewMocks, EventArgs.Empty);             //raise Init method
            load.Raise(viewMocks, EventArgs.Empty);             //raise Load method
        }
        private void CreateJoinExpected(Func <XmlElement, XmlElement> sendPresence)
        {
            Expect.Call(stream.Document).Return(doc);

            stream.OnProtocol += null;
            IEventRaiser onProtocol = LastCall.IgnoreArguments().GetEventRaiser();

            stream.Write((XmlElement)null);
            LastCall.Callback((Func <XmlElement, bool>)
                              delegate(XmlElement elem)
            {
                onProtocol.Raise(new object[] { null, sendPresence(elem) });

                string original = elem.OuterXml;
                return(original.Replace(" ", "") ==
                       GetJoinPresence().Replace(" ", ""));
            });
        }
        public void IntegrationCompletedIsFired()
        {
            string             enforcer    = "JohnDoe";
            string             projectName = "Project 4";
            IntegrationRequest request     = new IntegrationRequest(BuildCondition.ForceBuild, enforcer, null);

            // Need to set up a new integrator that can return an event
            IProjectIntegrator integrator4;

            integrator4 = mocks.DynamicMock <IProjectIntegrator>();
            SetupResult.For(integrator4.Name).Return("Project 4");
            integrator4.IntegrationCompleted += null;
            IEventRaiser startEventRaiser = LastCall.IgnoreArguments()
                                            .GetEventRaiser();

            // Initialise a new cruise server with the new integrator
            mocks.ReplayAll();
            integratorList.Add(integrator4);
            configServiceMock.ExpectAndReturn("Load", configuration);
            projectIntegratorListFactoryMock.ExpectAndReturn("CreateProjectIntegrators", integratorList, configuration.Projects, integrationQueue);
            server = new CruiseServer((IConfigurationService)configServiceMock.MockInstance,
                                      (IProjectIntegratorListFactory)projectIntegratorListFactoryMock.MockInstance,
                                      (IProjectSerializer)projectSerializerMock.MockInstance,
                                      (IProjectStateManager)stateManagerMock.MockInstance,
                                      fileSystem,
                                      executionEnvironment,
                                      null);

            bool eventFired = false;

            server.IntegrationCompleted += delegate(object o, IntegrationCompletedEventArgs e)
            {
                eventFired = true;
                Assert.AreEqual(projectName, e.ProjectName);
                Assert.AreEqual(IntegrationStatus.Success, e.Status);
                Assert.AreSame(request, e.Request);
            };


            startEventRaiser.Raise(integrator4,
                                   new IntegrationCompletedEventArgs(request, projectName, IntegrationStatus.Success));
            Assert.IsTrue(eventFired, "IntegrationCompleted not fired");
        }
Пример #19
0
        public void UseTheOutMethodToSpecifyOutputAndRefParameters()
        {
            MockRepository mocks   = new MockRepository();
            MyClass        myClass = (MyClass)mocks.StrictMock(typeof(MyClass));
            int            i;
            string         s = null, s2;

            myClass.MyMethod(out i, ref s, 1, out s2);
            LastCall.IgnoreArguments().OutRef(100, "s", "b");
            mocks.ReplayAll();

            myClass.MyMethod(out i, ref s, 1, out s2);

            mocks.VerifyAll();

            Assert.Equal(100, i);
            Assert.Equal("s", s);
            Assert.Equal("b", s2);
        }
Пример #20
0
        public void GivingLessParametersThanWhatIsInTheMethodWillNotThrow()
        {
            MockRepository mocks   = new MockRepository();
            MyClass        myClass = (MyClass)mocks.StrictMock(typeof(MyClass));
            int            i;
            string         s = null, s2;

            myClass.MyMethod(out i, ref s, 1, out s2);
            LastCall.IgnoreArguments().OutRef(100);
            mocks.ReplayAll();

            myClass.MyMethod(out i, ref s, 1, out s2);

            mocks.VerifyAll();

            Assert.Equal(100, i);
            Assert.Null(s);
            Assert.Null(s2);
        }
Пример #21
0
        public void TestTestContainerAop()
        {
            MockRepository mock  = new MockRepository();
            IAspect        hmock = mock.CreateMock <IAspect>();

            hmock.PostCall(null, null);
            LastCall.IgnoreArguments();
            hmock.PreCall(null);
            LastCall.Return(MethodVoteOptions.Continue)
            .IgnoreArguments();
            mock.ReplayAll();

            TestContainer container = new TestContainer(@"Concrete\Castle\AOP\HelperClasses\ConfigSample1.config");

            container.Kernel.RemoveComponent("interceptor");
            container.Kernel.AddComponentInstance("interceptor", hmock);
            container.Resolve <ISomething>().AMethod("test");
            mock.VerifyAll();
        }
Пример #22
0
        public void WhenExceptionOccures_WritesMessageToConsole()
        {
            var mocks             = new MockRepository();
            var knaryTreeApp      = mocks.StrictMock <KnaryTreeApp>();
            var applicationRunner = mocks.StrictMock <ApplicationRunner>(knaryTreeApp);

            using (mocks.Record())
            {
                applicationRunner.WriteToConsole(null);
                LastCall.IgnoreArguments();
                LastCall.Throw(new Exception("Exception Message"));
                applicationRunner.WriteToConsole("Exception Message");
            }

            using (mocks.Playback())
            {
                applicationRunner.Run(new string[] { });
            }
        }
Пример #23
0
        public void IfDestinationFolderBlankItIsNotSet()
        {
            var cloneView = Mocks.DynamicMock <CloneView>();

            cloneView.Expect(v => v.RepositoryToClone).IgnoreArguments().Repeat.Never();

            cloneView.DestinationFolder = null;
            LastCall.PropertyBehavior();
            LastCall.IgnoreArguments();
            LastCall.Repeat.Never();

            Mocks.ReplayAll();

            var presenter = new ClonePresenter(cloneView);

            presenter.SetDestinationFolder(null);

            Assert.That(cloneView.DestinationFolder, Is.Null);
        }
Пример #24
0
        private void CreatePersister()
        {
            mocks.Record();
            persister = mocks.DynamicMock <IPersister>();

            persister.ItemMoving += null;
            moving = LastCall.IgnoreArguments().Repeat.Any().GetEventRaiser();

            persister.ItemCopying += null;
            copying = LastCall.IgnoreArguments().Repeat.Any().GetEventRaiser();

            persister.ItemDeleting += null;
            deleting = LastCall.IgnoreArguments().Repeat.Any().GetEventRaiser();

            persister.ItemSaving += null;
            saving = LastCall.IgnoreArguments().Repeat.Any().GetEventRaiser();

            mocks.Replay(persister);
        }
Пример #25
0
        public void UnicastMessage_TimeoutException()
        {
            MockRepository  mocks     = new MockRepository();
            ModbusTransport transport = mocks.PartialMock <ModbusTransport>();

            transport.Write(null);
            LastCall.IgnoreArguments().Repeat.Times(Modbus.DefaultRetries + 1);
            Expect.Call(transport.ReadResponse <ReadCoilsInputsResponse>())
            .Do((ThrowExceptionDelegate) delegate { throw new TimeoutException(); })
            .Repeat.Times(Modbus.DefaultRetries + 1);

            mocks.ReplayAll();

            ReadCoilsInputsRequest request = new ReadCoilsInputsRequest(Modbus.ReadInputs, 2, 3, 4);

            transport.UnicastMessage <ReadCoilsInputsResponse>(request);

            mocks.VerifyAll();
        }
Пример #26
0
        public void Test_CheckIn_Charge_Only_Male()
        {
            //arrange mock
            var customers = new List <Customer>();
            //2男1女
            var customer1 = new Customer()
            {
                IsMale = true
            };
            var customer2 = new Customer()
            {
                IsMale = true
            };
            var customer3 = new Customer()
            {
                IsMale = false
            };

            customers.Add(customer1);
            customers.Add(customer2);
            customers.Add(customer3);

            MockRepository mock           = new MockRepository();
            ICheckInFee    stubCheckInFee = mock.StrictMock <ICheckInFee>();

            using (mock.Record())
            {
                //期望呼叫ICheckInFee的GetFee()次數為2次
                stubCheckInFee.GetFee(customer1);

                LastCall
                .IgnoreArguments()
                .Return((decimal)100)
                .Repeat.Times(2);
            }

            using (mock.Playback())
            {
                var target = new Pub(stubCheckInFee);
                var count  = target.CheckIn(customers);
            }
        }
Пример #27
0
        public void ClearedModelSetsItemsOnView()
        {
            MockRepository mocks = new MockRepository();
            IModel         model = mocks.StrictMock <IModel>();
            IView          view  = mocks.StrictMock <IView>();

            model.ModelChanged += null;
            LastCall.IgnoreArguments();
            IEventRaiser eventRaiser = LastCall.GetEventRaiser();

            view.SetList(null);
            LastCall.IgnoreArguments();
            mocks.ReplayAll();

            Presenter subject = new Presenter(view, model);

            eventRaiser.Raise(this, EventArgs.Empty);

            mocks.VerifyAll();
        }
Пример #28
0
        public void UnicastMessage_WrongResponseFunctionCode()
        {
            MockRepository  mocks     = new MockRepository();
            ModbusTransport transport = mocks.PartialMock <ModbusTransport>();

            transport.Write(null);
            LastCall.IgnoreArguments().Repeat.Times(Modbus.DefaultRetries + 1);
            // read 4 coils from slave id 2
            Expect.Call(transport.ReadResponse <ReadCoilsInputsResponse>())
            .Return(new ReadCoilsInputsResponse(Modbus.ReadCoils, 2, 0, new DiscreteCollection()))
            .Repeat.Times(Modbus.DefaultRetries + 1);

            mocks.ReplayAll();

            ReadCoilsInputsRequest request = new ReadCoilsInputsRequest(Modbus.ReadInputs, 2, 3, 4);

            Assert.Throws <IOException>(() => transport.UnicastMessage <ReadCoilsInputsResponse>(request));

            mocks.VerifyAll();
        }
Пример #29
0
        public void UnicastMessage_TooManyFailingExceptions(Type exceptionType)
        {
            MockRepository  mocks     = new MockRepository();
            ModbusTransport transport = mocks.PartialMock <ModbusTransport>();

            transport.Write(null);
            LastCall.IgnoreArguments().Repeat.Times(transport.Retries + 1);

            Expect.Call(transport.ReadResponse <ReadCoilsInputsResponse>())
            .Do((ThrowExceptionDelegate) delegate { throw (Exception)Activator.CreateInstance(exceptionType); })
            .Repeat.Times(transport.Retries + 1);

            mocks.ReplayAll();

            ReadCoilsInputsRequest request = new ReadCoilsInputsRequest(Modbus.ReadCoils, 2, 3, 4);

            Assert.Throws(exceptionType, () => transport.UnicastMessage <ReadCoilsInputsResponse>(request));

            mocks.VerifyAll();
        }
        public void TestAfterPropertiesSet_Trigger_TriggerDoesntExist()
        {
            mockery = new MockRepository();
            InitForAfterPropertiesSetTest();

            const string  TRIGGER_NAME  = "trigName";
            const string  TRIGGER_GROUP = "trigGroup";
            SimpleTrigger trigger       = new SimpleTrigger(TRIGGER_NAME, TRIGGER_GROUP);

            factory.Triggers = new Trigger[] { trigger };

            Expect.Call(TestSchedulerFactory.MockScheduler.GetTrigger(TRIGGER_NAME, TRIGGER_GROUP)).Return(null);
            TestSchedulerFactory.MockScheduler.ScheduleJob(trigger);
            LastCall.IgnoreArguments().Return(DateTime.UtcNow);


            TestSchedulerFactory.Mockery.ReplayAll();
            mockery.ReplayAll();
            factory.AfterPropertiesSet();
        }