如何为测试目的创建IJobExecutionContext类实例?像
IJobExecutionContext context = new ... ???
答案 0 :(得分:1)
你可以使用Moq。 https://github.com/Moq/moq4
IJobExecutionContext mockJobExecutionContext= new Mock<IJobExecutionContext>();
mockJobExecutionContext.Setup(
// ... do method setup here
);
mockJobExecutionContext.SetupProperty(x=>x.JobInstance);
var jobExecutionContext = mockJobExecutionContext.Object;
答案 1 :(得分:0)
JobExecutionContextImpl为IJobExecutionContext提供了一个实现。见https://github.com/quartznet/quartznet/blob/master/src/Quartz/Impl/JobExecutionContextImpl.cs
不确定这是否是测试所需的内容