public static void Schema_Throws_WhenValueIsNull() { var instance = new EFCoreStorageOptions(); Assert.Throws <ArgumentNullException>("value", () => instance.Schema = default); }
public void Ctor_CreatesInstance() { var options = new EFCoreStorageOptions { DistributedLockTimeout = new TimeSpan(1, 0, 0), QueuePollInterval = new TimeSpan(0, 1, 0), JobExpirationCheckInterval = new TimeSpan(2, 0, 0), CountersAggregationInterval = new TimeSpan(0, 2, 0), }; var instance = new EFCoreStorage(OptionsActionStub, options); Assert.NotNull(Assert.IsType <DbContextOptions <HangfireContext> >( instance.GetFieldValue("_contextOptions"))); Assert.Same(options, Assert.IsType <EFCoreStorageOptions>( instance.GetFieldValue("_options"))); Assert.NotNull(instance.DefaultQueueProvider); Assert.Same(instance, instance.DefaultQueueProvider.GetFieldValue("_storage")); Assert.NotNull(instance.QueueProviders); Assert.Empty(instance.QueueProviders); Assert.Equal(options.DistributedLockTimeout, instance.DistributedLockTimeout); Assert.Equal(options.QueuePollInterval, instance.QueuePollInterval); Assert.Equal(options.JobExpirationCheckInterval, instance.JobExpirationCheckInterval); Assert.Equal(options.CountersAggregationInterval, instance.CountersAggregationInterval); }
public void Ctor_Throws_WhenOptionsParameterIsNull() { var contextOptions = OptionsActionStub; EFCoreStorageOptions options = null; Assert.Throws <ArgumentNullException>(nameof(options), () => new EFCoreStorage(OptionsAction, options)); }
public static void Ctor_Throws_WhenContextOptionsActionParameterIsNull() { Action <DbContextOptionsBuilder> optionsAction = null; var options = new EFCoreStorageOptions(); Assert.Throws <ArgumentNullException>(nameof(optionsAction), () => new EFCoreStorage(optionsAction, options)); }
public static void CountersAggregationInterval_Throws_WhenValueIsNonPositive() { var instance = new EFCoreStorageOptions(); Assert.Throws <ArgumentOutOfRangeException>("value", () => instance.CountersAggregationInterval = default); Assert.Throws <ArgumentOutOfRangeException>("value", () => instance.CountersAggregationInterval = new TimeSpan(-1)); }
public static void DistributedLockTimeout_Throws_WhenValueIsNonPositive() { var instance = new EFCoreStorageOptions(); Assert.Throws <ArgumentOutOfRangeException>("value", () => instance.DistributedLockTimeout = default); Assert.Throws <ArgumentOutOfRangeException>("value", () => instance.DistributedLockTimeout = new TimeSpan(-1)); }
public static void SlidingInvisibilityTimeout_Throws_WhenValueIsNonPositive() { var instance = new EFCoreStorageOptions(); Assert.Throws <ArgumentOutOfRangeException>("value", () => instance.SlidingInvisibilityTimeout = default); Assert.Throws <ArgumentOutOfRangeException>("value", () => instance.SlidingInvisibilityTimeout = new TimeSpan(-1)); }
public static void CountersAggregationInterval_GetsAndSetsCorrectly() { var instance = new EFCoreStorageOptions(); var value = new TimeSpan(0, 20, 0); instance.CountersAggregationInterval = value; Assert.Equal(value, instance.CountersAggregationInterval); Assert.Equal(value, Assert.IsType <TimeSpan>( instance.GetFieldValue("_countersAggregationInterval"))); }
public static void DistributedLockTimeout_GetsAndSetsCorrectly() { var instance = new EFCoreStorageOptions(); var value = new TimeSpan(0, 20, 0); instance.DistributedLockTimeout = value; Assert.Equal(value, instance.DistributedLockTimeout); Assert.Equal(value, Assert.IsType <TimeSpan>( instance.GetFieldValue("_distributedLockTimeout"))); }
public static void Schema_GetsAndSetsCorrectly() { var instance = new EFCoreStorageOptions(); var value = "test"; instance.Schema = value; Assert.Equal(value, instance.Schema); Assert.Equal(value, Assert.IsType <string>( instance.GetFieldValue("_schema"))); }
public static void SlidingInvisibilityTimeout_GetsAndSetsCorrectly() { var instance = new EFCoreStorageOptions(); var value = new TimeSpan(0, 20, 0); instance.SlidingInvisibilityTimeout = value; Assert.Equal(value, instance.SlidingInvisibilityTimeout); Assert.Equal(value, Assert.IsType <TimeSpan>( instance.GetFieldValue("_slidingInvisibilityTimeout"))); }
public static void JobExpirationCheckInterval_GetsAndSetsCorrectly() { var instance = new EFCoreStorageOptions(); var value = new TimeSpan(0, 20, 0); instance.JobExpirationCheckInterval = value; Assert.Equal(value, instance.JobExpirationCheckInterval); Assert.Equal(value, Assert.IsType <TimeSpan>( instance.GetFieldValue("_jobExpirationCheckInterval"))); }
public static IGlobalConfiguration <EFCoreStorage> UseEFCoreStorage( [NotNull] this IGlobalConfiguration configuration, [NotNull] Action <DbContextOptionsBuilder> optionsAction, [NotNull] EFCoreStorageOptions options) { if (configuration is null) { throw new ArgumentNullException(nameof(configuration)); } return(configuration.UseStorage(new EFCoreStorage(optionsAction, options))); }
public void GetMonitoringApi_ReturnsCorrectResult() { var options = new EFCoreStorageOptions(); var instance = new EFCoreStorage(OptionsAction, options); var result = instance.GetMonitoringApi(); Assert.NotNull(result); var api = Assert.IsType <EFCoreStorageMonitoringApi>(result); Assert.Same(instance, Assert.IsType <EFCoreStorage>(result.GetFieldValue("_storage"))); }
public void GetConnection_ReturnsCorrectResult() { var options = new EFCoreStorageOptions(); var instance = new EFCoreStorage(OptionsAction, options); var result = instance.GetConnection(); Assert.NotNull(result); var connection = Assert.IsType <EFCoreStorageConnection>(result); Assert.Same(instance, Assert.IsType <EFCoreStorage>( connection.GetFieldValue("_storage"))); }
public static void Ctor_CreatesInstance() { var instance = new EFCoreStorageOptions(); Assert.Equal(new TimeSpan(0, 10, 0), Assert.IsType <TimeSpan>( instance.GetFieldValue("_distributedLockTimeout"))); Assert.Equal(new TimeSpan(0, 0, 15), Assert.IsType <TimeSpan>( instance.GetFieldValue("_queuePollInterval"))); Assert.Equal(new TimeSpan(0, 5, 0), Assert.IsType <TimeSpan>( instance.GetFieldValue("_countersAggregationInterval"))); Assert.Equal(new TimeSpan(0, 30, 0), Assert.IsType <TimeSpan>( instance.GetFieldValue("_jobExpirationCheckInterval"))); Assert.Equal(new TimeSpan(0, 5, 0), Assert.IsType <TimeSpan>( instance.GetFieldValue("_slidingInvisibilityTimeout"))); Assert.Empty(Assert.IsType <string>(instance.GetFieldValue("_schema"))); }