Exemplo n.º 1
0
        public void TimeDelayJobTests_NegativeTime_InstantExecution()
        {
            // Arrange
            var job = new TimeDelayJob(TimeSpan.FromSeconds(-1));

            // Act

            // Assert
            Assert.True(job.IsFinished);
            Assert.True(job.Task.IsCompleted);
            Assert.False(job.Task.IsCanceled);
            Assert.False(job.Task.IsFaulted);
            Assert.True(job.Task.Status == TaskStatus.RanToCompletion);
        }
Exemplo n.º 2
0
        public void TimeDelayJobTests_NegativeTime_InstantExecution()
        {
            // Arrange
            var job = new TimeDelayJob(TimeSpan.FromSeconds(-1));

            // Act

            // Assert
            Assert.True(job.IsFinished);
            Assert.True(job.Task.IsCompleted);
            Assert.False(job.Task.IsCanceled);
            Assert.False(job.Task.IsFaulted);
            Assert.True(job.Task.Status == TaskStatus.RanToCompletion);
        }
Exemplo n.º 3
0
        public void TimeDelayJobTests_2000ms_UpdatedAtTheCorrectTime()
        {
            // Arrange
            var job = new TimeDelayJob(TimeSpan.FromSeconds(2));

            // Act & assert
            job.Update(500);

            Assert.False(job.IsFinished);

            job.Update(1499);
            Assert.False(job.IsFinished);
            job.Update(1);
            Assert.True(job.IsFinished);
        }
Exemplo n.º 4
0
        public void TimeDelayJobTests_2000ms_UpdatedAtTheCorrectTime()
        {
            // Arrange
            var job = new TimeDelayJob(TimeSpan.FromSeconds(2));

            // Act & assert
            job.Update(500);

            Assert.False(job.IsFinished);

            job.Update(1499);
            Assert.False(job.IsFinished);
            job.Update(1);
            Assert.True(job.IsFinished);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Delays execution for a supplied time amount (in milliseconds)
 /// </summary>
 /// <param name="delayInMilliseconds"></param>
 public static Task TimeDelay(float delayInMilliseconds)
 {
     var timeDelayJob = new TimeDelayJob(delayInMilliseconds);
     return CreateTaskFromJob(timeDelayJob);
 }
Exemplo n.º 6
0
        /// <summary>
        /// Delays execution for a supplied time amount
        /// </summary>
        /// <param name="delay"></param>
        public static Task TimeDelay(TimeSpan delay)
        {
            var timeDelayJob = new TimeDelayJob(delay);

            return CreateTaskFromJob(timeDelayJob);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Delays execution for a supplied time amount (in milliseconds)
        /// </summary>
        /// <param name="delayInMilliseconds"></param>
        public static Task TimeDelay(float delayInMilliseconds)
        {
            var timeDelayJob = new TimeDelayJob(delayInMilliseconds);

            return(CreateTaskFromJob(timeDelayJob));
        }
Exemplo n.º 8
0
        /// <summary>
        /// Delays execution for a supplied time amount
        /// </summary>
        /// <param name="delay"></param>
        public static Task TimeDelay(TimeSpan delay)
        {
            var timeDelayJob = new TimeDelayJob(delay);

            return(CreateTaskFromJob(timeDelayJob));
        }