Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        public static bool IsOn(this IToggled toggledFeature)
        {
            var appSettingKeyForToggledFeature = string.Format("{0}.{1}", "Toggler", toggledFeature.GetType().Name);

            return(ConfigurationManager.AppSettings[appSettingKeyForToggledFeature] == "true");
        }
Esempio n. 4
0
 public static bool IsFeatureOn <T>(this IToggled <T> toggledFeature) where T : IFeature, new()
 {
     return(new T().IsOn());
 }
Esempio n. 5
0
 public void ToggledFeatureShouldBeEnabledIfConfiguredSoInAppSettings()
 {
     testFeature = new TestFeature();
     Assert.That(testFeature.IsOn(), Is.True);
 }
Esempio n. 6
0
 public void ToggledFeatureIsDisableIfNotMentionedInAppSettings()
 {
     testFeature = new TestFeatureNotInAppSettings();
     Assert.That(testFeature.IsOn(), Is.False);
 }
Esempio n. 7
0
 public void ToggledFeatureIsDisableIfNotMentionedInAppSettings()
 {
     testFeature = new TestFeatureNotInAppSettings();
     Assert.That(testFeature.IsOn(), Is.False);
 }
Esempio n. 8
0
 public void ToggledFeatureShouldBeDisabledIfConfiguredSoInAppSettings()
 {
     testFeature = new TestFeatureDisabled();
     Assert.That(testFeature.IsOn(), Is.False);
 }