public static IDisposable SetUpToggledWithFeature <T>(this IToggled <T> toggled, bool toggle) where T : IFeature, new() { if (_togglerShimsContext == null || !_togglerShimsContext.Created) { _togglerShimsContext = new TogglerShimsContext(); } var shimsContext = _togglerShimsContext.shimsContext; Fakes.ShimToggledExtensions.IsFeatureOnOf1IToggledOfM0 <T>(toggled1 => toggled1 == toggled && toggle); return(_togglerShimsContext); }
public static IDisposable SetUpToggled(this IToggled toggled, bool toggle) { if (_togglerShimsContext == null || !_togglerShimsContext.Created) { _togglerShimsContext = new TogglerShimsContext(); } var shimsContext = _togglerShimsContext.shimsContext; Fakes.ShimToggledExtensions.IsOnIToggled = toggled1 => toggled == toggled1 && toggle; return(_togglerShimsContext); }
public static bool IsOn(this IToggled toggledFeature) { var appSettingKeyForToggledFeature = string.Format("{0}.{1}", "Toggler", toggledFeature.GetType().Name); return(ConfigurationManager.AppSettings[appSettingKeyForToggledFeature] == "true"); }
public static bool IsFeatureOn <T>(this IToggled <T> toggledFeature) where T : IFeature, new() { return(new T().IsOn()); }
public void ToggledFeatureShouldBeEnabledIfConfiguredSoInAppSettings() { testFeature = new TestFeature(); Assert.That(testFeature.IsOn(), Is.True); }
public void ToggledFeatureIsDisableIfNotMentionedInAppSettings() { testFeature = new TestFeatureNotInAppSettings(); Assert.That(testFeature.IsOn(), Is.False); }
public void ToggledFeatureShouldBeDisabledIfConfiguredSoInAppSettings() { testFeature = new TestFeatureDisabled(); Assert.That(testFeature.IsOn(), Is.False); }