コード例 #1
0
        public void ReadDate()
#endif
        {
            var result = DateTime.MaxValue;

            var sut = new ApplicationResourcesSettingsProvider();

#if NETFX_CORE
            await
#endif
            RunOn.Dispatcher(() =>
            {
                ApplicationResourcesSetter.Set("FeatureToggle.SimpleToggle", "01-Feb-2000 23:22:21");
                result = sut.EvaluateDateTimeToggleValue(new SimpleToggle());
            });

            AssertFacade.Equal(new DateTime(2000, 2, 1, 23, 22, 21), result);
        }
コード例 #2
0
        public void ReadBooleanFalse()
#endif
        {
            var result = true;

            var sut = new ApplicationResourcesSettingsProvider();

#if NETFX_CORE
            await
#endif
            RunOn.Dispatcher(() =>
            {
                ApplicationResourcesSetter.Set("FeatureToggle.BooleanFalse", false);
                result = sut.EvaluateBooleanToggleValue(new BooleanFalse());
            });


            AssertFacade.False(result);
        }
コード例 #3
0
        public void ReadDatePeriod()
#endif
        {
            var result = Tuple.Create(DateTime.MinValue, DateTime.MaxValue);

            var sut = new ApplicationResourcesSettingsProvider();

#if NETFX_CORE
            await
#endif
            RunOn.Dispatcher(() =>
            {
                ApplicationResourcesSetter.Set("FeatureToggle.PeriodToggle", "01-Jan-2000 23:22:21 | 01-Jan-2001 23:22:21");
                result = sut.EvaluateTimePeriod(new PeriodToggle());
            });

            AssertFacade.Equal(new DateTime(2000, 1, 1, 23, 22, 21), result.Item1);
            AssertFacade.Equal(new DateTime(2001, 1, 1, 23, 22, 21), result.Item2);
        }
コード例 #4
0
        public void BeEnabledOnExactMatchingVersion()
#endif

        {
            var result = false;

            var sut = new MyVersionToggleFor_v0_0_2_1();


#if NETFX_CORE
            await
#endif
            RunOn.Dispatcher(() =>
            {
                ApplicationResourcesSetter.Set("FeatureToggle.MyVersionToggleFor_v0_0_2_1", "0.0.2.1");
                result = sut.FeatureEnabled;
            });

            AssertFacade.True(result);
        }
コード例 #5
0
        public void ReadDaysOfWeek()
#endif
        {
            List <DayOfWeek> result = null;

            var sut = new ApplicationResourcesSettingsProvider();

#if NETFX_CORE
            await
#endif
            RunOn.Dispatcher(() =>
            {
                ApplicationResourcesSetter.Set("FeatureToggle.DaysToggle", "Wednesday, Saturday");
                result = sut.GetDaysOfWeek(new DaysToggle()).ToList();
            });

            AssertFacade.Equal(DayOfWeek.Wednesday, result[0]);
            AssertFacade.Equal(DayOfWeek.Saturday, result[1]);
            AssertFacade.Equal(2, result.Count);
        }
コード例 #6
0
        public void BeEnabledWhenAssemblyVersionIsAboveConfiguredAssemblyVersion()
#endif

        {
            var result = false;

            var sut = new MyVersionToggleFor_v0_0_2_0();



#if NETFX_CORE
            await
#endif
            RunOn.Dispatcher(() =>
            {
                ApplicationResourcesSetter.Set("FeatureToggle.MyVersionToggleFor_v0_0_2_0", "0.0.2.0");
                result = sut.FeatureEnabled;
            });

            AssertFacade.True(result);
        }
コード例 #7
0
        public void ErrorWhenKeyNotInConfig()
#endif
        {
            Exception expectedEx = null;

#if NETFX_CORE
            await
#endif
            RunOn.Dispatcher(() =>
            {
                try
                {
                    new ApplicationResourcesSettingsProvider().EvaluateBooleanToggleValue(new NotInConfig());
                }
                catch (Exception ex)
                {
                    expectedEx = ex;
                }
            });

            AssertFacade.True(expectedEx.Message.EndsWith("was not found in Application.Current.Resources"));
        }