public void UseQuartz_CanBeSafelyInvokedMultipleTimes() { // Arrange var services = new ServiceCollection(); var builder = new OpenIddictServerBuilder(services); // Act builder.UseQuartz(); builder.UseQuartz(); builder.UseQuartz(); // Assert Assert.Single(services, service => service.ServiceType == typeof(IJobDetail) && service.ImplementationInstance is IJobDetail job && job.Key.Equals(OpenIddictServerQuartzJob.Identity)); Assert.Single(services, service => service.ServiceType == typeof(ITrigger) && service.ImplementationInstance is ITrigger trigger && trigger.JobKey.Equals(OpenIddictServerQuartzJob.Identity)); }
public void UseQuartz_RegistersTriggerDetails() { // Arrange var services = new ServiceCollection(); var builder = new OpenIddictServerBuilder(services); // Act builder.UseQuartz(); // Assert Assert.Contains(services, service => service.ServiceType == typeof(ITrigger) && service.ImplementationInstance is ITrigger trigger && trigger.JobKey.Equals(OpenIddictServerQuartzJob.Identity)); }
public void UseQuartz_RegistersJobService() { // Arrange var services = new ServiceCollection(); var builder = new OpenIddictServerBuilder(services); // Act builder.UseQuartz(); // Assert Assert.Contains(services, service => service.ServiceType == typeof(OpenIddictServerQuartzJob) && service.ImplementationType == typeof(OpenIddictServerQuartzJob) && service.Lifetime == ServiceLifetime.Transient); }