コード例 #1
0
        public void SerializeData_ReturnsCorrectData()
        {
            var state = new ScheduledState(new DateTime(2012, 12, 12));

            var data = state.SerializeData();

            Assert.Equal(JobHelper.SerializeDateTime(state.EnqueueAt), data["EnqueueAt"]);
            Assert.Equal(JobHelper.SerializeDateTime(state.ScheduledAt), data["ScheduledAt"]);
        }
コード例 #2
0
ファイル: States.cs プロジェクト: HangfireIO/Hangfire.Api
        public void CreateInScheduledState()
        {
            #region ScheduledState
            var client = new BackgroundJobClient();
            var state = new ScheduledState(TimeSpan.FromHours(2));

            client.Create(() => Console.WriteLine("Hello!"), state);
            #endregion
        }
コード例 #3
0
 public void IgnoreExceptions_ReturnsFalse()
 {
     var state = new ScheduledState(DateTime.UtcNow);
     Assert.False(state.IgnoreJobLoadException);
 }
コード例 #4
0
        public void IsFinal_ReturnsFalse()
        {
            var state = new ScheduledState(DateTime.UtcNow);

            Assert.False(state.IsFinal);
        }
コード例 #5
0
 public void Ctor_SetsTheCorrectDate_WhenTimeSpanIsPassed()
 {
     var state = new ScheduledState(TimeSpan.FromDays(1));
     Assert.True(DateTime.UtcNow.AddDays(1).AddMinutes(-1) < state.EnqueueAt);
     Assert.True(state.EnqueueAt < DateTime.UtcNow.AddDays(1).AddMinutes(1));
 }
コード例 #6
0
 public void Ctor_SetsTheCorrectData_WhenDateIsPassed()
 {
     var date = new DateTime(2012, 12, 12);
     var state = new ScheduledState(date);
     Assert.Equal(date, state.EnqueueAt);
 }
コード例 #7
0
 public void StateName_IsCorrect()
 {
     var state = new ScheduledState(DateTime.UtcNow);
     Assert.Equal(ScheduledState.StateName, state.Name);
 }