public void disabled_service_should_also_be_reported_as_disabled() { _reader.ReadAppSetting("DisabledServoce.Enabled").Returns("false"); var sut = new AppConfigServiceSettings(_reader); sut.IsEnabled(typeof(DisabledServoce)).Should().BeFalse(); }
/// <summary> /// Check if a service/job should be running. /// </summary> /// <param name="type"> /// A type that implements <see cref="IApplicationService" /> or <see cref="IBackgroundJob"/>. /// </param> /// <returns> /// <c>true</c> if the service/job should be running.;<c>false</c> if it should be shut down. /// </returns> /// <exception cref="ArgumentNullException">type</exception> public bool IsEnabled(Type type) { if (type == null) { throw new ArgumentNullException("type"); } return(_configReader.ReadAppSetting(type.Name + ".Enabled") == "true"); }