public void InvalidDayInConfig()
        {
            var sut = new AppSettingsProvider();

            var ex = Assert.Throws<ToggleConfigurationError>(() => sut.GetDaysOfWeek(new InvalidDayToggle()).ToList());

            Assert.Equal("The value 'Sun' in config key 'FeatureToggle.InvalidDayToggle' is not a valid day of the week. Days should be specified in long format. E.g. Friday and not Fri.", ex.Message);
        }
        public void ReadDate()
        {
            var sut = new AppSettingsProvider();

            var result = sut.EvaluateDateTimeToggleValue(new BeforeDate());

            var expected = new DateTime(2050, 1, 2, 4, 5, 8);

            Assert.Equal(result, expected);
        }
        public void ReadDaysTimePeriod()
        {
            IDaysOfWeekToggleValueProvider sut = new AppSettingsProvider();

            var daysFromConfig = sut.GetDaysOfWeek(new MondayAndFridayToggle());

            var expected = new[] {DayOfWeek.Monday, DayOfWeek.Friday};

            Assert.Equal(expected, daysFromConfig);
        }
        protected EnabledOnOrBeforeDateFeatureToggle()
        {
            NowProvider = () => DateTime.Now;
#if (WINDOWS_PHONE || NETFX_CORE)

            ToggleValueProvider = new ApplicationResourcesSettingsProvider();
#else

            ToggleValueProvider = new AppSettingsProvider();
#endif
        }
        public EnabledOnOrAfterAssemblyVersionWhereToggleIsDefinedToggle()
        {
#if (WINDOWS_PHONE || NETFX_CORE)

            ToggleValueProvider = new ApplicationResourcesSettingsProvider();

#else

            ToggleValueProvider = new AppSettingsProvider();
#endif
        }
        protected SimpleFeatureToggle()
        {
            #if (WINDOWS_PHONE || NETFX_CORE)

            ToggleValueProvider = new ApplicationResourcesSettingsProvider();

            #else

            ToggleValueProvider = new AppSettingsProvider();
            #endif
        }
        public void ReadTimePeriod()
        {
            ITimePeriodProvider sut = new AppSettingsProvider();

            var periodFromConfig = sut.EvaluateTimePeriod(new TimePeriod());

            var expected = new Tuple<DateTime, DateTime>(new DateTime(2050, 1, 2, 4, 5, 8),
                new DateTime(2099, 8, 7, 6, 5, 4));

            Assert.Equal(expected, periodFromConfig);
        }
        public void ErrorWhen404()
        {
            using (WebApp.Start<Startup>(AlternateUrl))
            {
                var sut = new AppSettingsProvider();

                var toggle = new InvalidHttpJsonToggle();

                Assert.Throws<WebException>(() => sut.EvaluateBooleanToggleValue(toggle));
            }
        }
        public void ReadBooleanFalseFromHttpJsonEndpoint()
        {
            using (WebApp.Start<Startup>(Url))
            {
                var sut = new AppSettingsProvider();

                var toggle = new HttpJsonFalseToggle();

                Assert.False(sut.EvaluateBooleanToggleValue(toggle));
            }
        }
Ejemplo n.º 10
0
 protected HttpJsonFeatureToggle()
 {
     ToggleValueProvider = new AppSettingsProvider();
 }