public void DoNotUseSqlStorageProvider() { // arrange var globalConfigDummy = new Mock <IGlobalConfiguration>(); ApplicationConfigurationHelper.AdjustKeys(ConfigurationKeys.HangfireSqlStorageEnabled, false.ToString()); var sut = new HangfireSqlStorageProviderConfiguration(); // act sut.Apply(globalConfigDummy.Object); // assert sut.Enabled.Should().BeFalse(); sut.IsActive.Should().BeFalse(); }
public void UseSqlStorageProviderNegativeProof() { // arrange var globalConfigDummy = new Mock <IGlobalConfiguration>(); const string testConnectionString = "Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;"; ApplicationConfigurationHelper.AdjustKeys(ConfigurationKeys.HangfireSqlStorageEnabled, true.ToString()); ApplicationConfigurationHelper.AdjustKeys(ConfigurationKeys.HangfireSqlConnectionString, testConnectionString); var sut = new HangfireSqlStorageProviderConfiguration(); var act = new Action(() => sut.Apply(globalConfigDummy.Object)); // act // assert act.ShouldThrow <SqlException>(); sut.Enabled.Should().BeTrue(); }