xxl-job的dotnet core 执行器实现
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.
 
 

42 lines
1.1 KiB

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using DotXxlJob.Core.Model;
using Microsoft.Extensions.DependencyInjection;
using Xunit;
namespace DotXxlJob.Core.Tests
{
public class DefaultJobHandlerFactory
{
[Fact]
public async Task Repeated_Job_Handler()
{
var services = new ServiceCollection();
services.AddXxlJobExecutor(options => options.AdminAddresses = "http://localhost");
services.AddDefaultXxlJobHandlers();
services.AddJobHandler<TestJobHandler>();
using (var provider = services.BuildServiceProvider())
{
Assert.Throws<ArgumentException>(() => provider.GetRequiredService<IJobHandlerFactory>());
}
}
[JobHandler("simpleHttpJobHandler")]
private class TestJobHandler : IJobHandler
{
public void Dispose()
{
}
public Task<ReturnT> Execute(JobExecuteContext context)
{
throw new NotImplementedException();
}
}
}
}