整理代码格式

This commit is contained in:
Falcon 2025-02-20 16:48:31 +08:00
parent 6092239b29
commit ace506c577
2 changed files with 226 additions and 225 deletions

View File

@ -1,4 +1,5 @@
using Microsoft.VisualStudio.TestTools.UnitTesting; using Falcon.SugarApi.TimedBackgroundTask;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System; using System;
namespace Falcon.SugarApi.Test namespace Falcon.SugarApi.Test
@ -12,10 +13,7 @@ namespace Falcon.SugarApi.Test
var cron = new CronExpression("0 30 3 * * 1-5"); // 工作日凌晨3:30:00 var cron = new CronExpression("0 30 3 * * 1-5"); // 工作日凌晨3:30:00
var nextTime = cron.GetNextOccurrence(now20250213102512); var nextTime = cron.GetNextOccurrence(now20250213102512);
if(nextTime == null) {
Assert.Fail("nextTime is null!");
return;
}
Assert.IsTrue(DateToString(nextTime) == "20250214033000"); Assert.IsTrue(DateToString(nextTime) == "20250214033000");
cron = new CronExpression("");//下一秒触发 cron = new CronExpression("");//下一秒触发
nextTime = cron.GetNextOccurrence(now20250213102512); nextTime = cron.GetNextOccurrence(now20250213102512);

View File

@ -1,14 +1,15 @@
using Falcon.SugarApi; using System;
using Falcon.SugarApi.TimedBackgroundTask;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
/// <summary> namespace Falcon.SugarApi.TimedBackgroundTask
/// Cron表达式
/// </summary>
public class CronExpression
{ {
/// <summary>
/// Cron表达式
/// </summary>
public class CronExpression
{
/// <summary> /// <summary>
/// 可选的秒范围枚举 /// 可选的秒范围枚举
/// </summary> /// </summary>
@ -239,4 +240,6 @@ public class CronExpression
} }
throw new ArgumentException("提供的cron表达式错误",nameof(exp)); throw new ArgumentException("提供的cron表达式错误",nameof(exp));
} }
}
} }