mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-03-04 00:35:47 +08:00
39 lines
1.0 KiB
C#
39 lines
1.0 KiB
C#
|
|
using Yi.Framework.Common.Const;
|
|||
|
|
using Yi.Framework.Core;
|
|||
|
|
|
|||
|
|
namespace Yi.Framework.XUnitTest
|
|||
|
|
{
|
|||
|
|
public class QuartzTest
|
|||
|
|
{
|
|||
|
|
private QuartzInvoker _quartzInvoker;
|
|||
|
|
public QuartzTest(QuartzInvoker quartzInvoker) =>
|
|||
|
|
(_quartzInvoker) =
|
|||
|
|
(quartzInvoker);
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[Fact]
|
|||
|
|
public async Task StartJob()
|
|||
|
|
{
|
|||
|
|
Dictionary<string, object> data = new Dictionary<string, object>()
|
|||
|
|
{
|
|||
|
|
{JobConst.method,"get" },
|
|||
|
|
{JobConst.url,"https://www.baidu.com" }
|
|||
|
|
};
|
|||
|
|
await _quartzInvoker.StartAsync("*/5 * * * * ?", "HttpJob", jobName: "test", jobGroup: "my", data: data);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[Fact]
|
|||
|
|
public async Task StopJob()
|
|||
|
|
{
|
|||
|
|
await StartJob();
|
|||
|
|
await _quartzInvoker.StopAsync(new Quartz.JobKey("test", "my"));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|