You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ComputedJobTest.cs 1.6 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //using System;
  2. //using System.Collections.Generic;
  3. //using System.Text;
  4. //using DotNetCore.CAP.Processor;
  5. //using Xunit;
  6. //namespace DotNetCore.CAP.Test.Job
  7. //{
  8. // public class ComputedJobTest
  9. // {
  10. // [Fact]
  11. // public void UpdateNext_LastRunNever_SchedulesNow()
  12. // {
  13. // // Arrange
  14. // var now = new DateTime(2000, 1, 1, 8, 0, 0);
  15. // var cronJob = new CronJob(Cron.Daily());
  16. // var computed = new ComputedCronJob(cronJob);
  17. // // Act
  18. // computed.UpdateNext(now);
  19. // // Assert
  20. // Assert.Equal(computed.Next, now);
  21. // }
  22. // [Fact]
  23. // public void UpdateNext_LastRun_BeforePrev_SchedulesNow()
  24. // {
  25. // // Arrange
  26. // var now = new DateTime(2000, 1, 1, 8, 0, 0);
  27. // var cronJob = new CronJob(Cron.Daily(), now.Subtract(TimeSpan.FromDays(2)));
  28. // var computed = new ComputedCronJob(cronJob);
  29. // // Act
  30. // computed.UpdateNext(now);
  31. // // Assert
  32. // Assert.Equal(computed.Next, now);
  33. // }
  34. // [Fact]
  35. // public void UpdateNext_LastRun_AfterPrev_SchedulesNormal()
  36. // {
  37. // // Arrange
  38. // var now = new DateTime(2000, 1, 1, 8, 0, 0);
  39. // var cronJob = new CronJob(Cron.Daily(), now.Subtract(TimeSpan.FromSeconds(5)));
  40. // var computed = new ComputedCronJob(cronJob);
  41. // // Act
  42. // computed.UpdateNext(now);
  43. // // Assert
  44. // Assert.True(computed.Next > now);
  45. // }
  46. // }
  47. //}