public void IServiceCollectionExtensions_Return_IJobRegistrator() { IServiceCollection serviceCollection = new ServiceCollection(); var result = IServiceCollectionExtensions.UseQuartzHostedService(serviceCollection, null); result.Should() .NotBeNull() .And.BeAssignableTo <IJobRegistrator>() .Subject.Services.Should().Equal(serviceCollection); }
public void IServiceCollectionExtensions_Register_ISchedulerFactory() { IServiceCollection serviceCollection = new ServiceCollection(); IServiceCollectionExtensions.UseQuartzHostedService(serviceCollection, null); var testClass = serviceCollection.BuildServiceProvider().GetRequiredService <ISchedulerFactory>(); testClass.Should() .NotBeNull() .And.BeOfType <StdSchedulerFactory>(); }
public void IServiceCollectionExtensions_Register_HostedService() { IServiceCollection serviceCollection = new ServiceCollection(); IServiceCollectionExtensions.UseQuartzHostedService(serviceCollection, null); var testClass = serviceCollection.BuildServiceProvider().GetRequiredService <IHostedService>(); testClass.Should() .NotBeNull() .And.BeOfType <SilkierQuartz.HostedService.QuartzHostedService>(); }
public void IServiceCollectionExtensions_Register_ISchedulerFactory_WithParams() { IServiceCollection serviceCollection = new ServiceCollection(); IServiceCollectionExtensions.UseQuartzHostedService(serviceCollection, options => { options.Add("quartz.threadPool.threadCount", "1"); }); // TODO: ѕроверить что параметры передались в конструктор var testClass = serviceCollection.BuildServiceProvider().GetRequiredService <ISchedulerFactory>(); testClass.Should() .NotBeNull() .And.BeOfType <StdSchedulerFactory>(); }