Exemple #1
0
        public override void SetUp()
        {
            base.SetUp();

            mockJobStore  = Mocks.CreateMock <IJobStore>();
            mockJobRunner = Mocks.CreateMock <IJobRunner>();
            mockLogger    = Mocks.CreateMock <ILogger>();
            mockTrigger   = Mocks.PartialMock <Trigger>();
            scheduler     = new DefaultScheduler(mockJobStore, mockJobRunner);

            dummyJobData    = new JobData();
            dummyJobSpec    = new JobSpec("foo", "bar", "key", mockTrigger);
            dummyJobDetails = new JobDetails(dummyJobSpec, DateTime.UtcNow);

            isWoken = false;

            // Ensure the scheduler is initialized.
            mockJobStore.RegisterScheduler(scheduler.Guid, scheduler.Name);
            Mocks.Replay(mockJobStore);
            scheduler.Initialize();
            Mocks.Verify(mockJobStore);
            Mocks.BackToRecord(mockJobStore);

            mockJobStore.UnregisterScheduler(scheduler.Guid);

            // Create a separate uninitialized scheduler for certain tests.
            uninitializedScheduler = new DefaultScheduler(mockJobStore, mockJobRunner);
        }
		public override void SetUp()
		{
			base.SetUp();

			mockJobStore = Mocks.CreateMock<IJobStore>();
			mockJobRunner = Mocks.CreateMock<IJobRunner>();
			mockLogger = Mocks.CreateMock<ILogger>();
			mockTrigger = Mocks.PartialMock<Trigger>();
			scheduler = new DefaultScheduler(mockJobStore, mockJobRunner);

			dummyJobData = new JobData();
			dummyJobSpec = new JobSpec("foo", "bar", "key", mockTrigger);
			dummyJobDetails = new JobDetails(dummyJobSpec, DateTime.UtcNow);

			isWoken = false;

			// Ensure the scheduler is initialized.
			mockJobStore.RegisterScheduler(scheduler.Guid, scheduler.Name);
			Mocks.Replay(mockJobStore);
			scheduler.Initialize();
			Mocks.Verify(mockJobStore);
			Mocks.BackToRecord(mockJobStore);

			mockJobStore.UnregisterScheduler(scheduler.Guid);

			// Create a separate uninitialized scheduler for certain tests.
			uninitializedScheduler = new DefaultScheduler(mockJobStore, mockJobRunner);
		}