A feature toggle that turns on within a specific date range.
상속: DynamicFeatureToggleBase
예제 #1
0
        public void Toggle_Is_Disabled_When_FromDate_Is_In_The_Future()
        {
            DateTime? fromDate = DateTime.Now.AddDays(1);
            const bool enabled = true;

            var toggle = new DateRangeToggle(TestName, enabled, fromDate, null);

            Assert.IsFalse(toggle.IsEnabled());
        }
예제 #2
0
        public void Toggle_Is_Disabled_When_Date_Range_In_Past()
        {
            DateTime fromDate = DateTime.Now.AddDays(-2);
            DateTime toDate = DateTime.Now.AddDays(-1);
            const bool enabled = true;

            var toggle = new DateRangeToggle(TestName, enabled, fromDate, toDate);

            Assert.IsFalse(toggle.IsEnabled());
        }
예제 #3
0
        public void Toggle_Is_Disabled_When_ToDate_Is_In_The_Past()
        {
            DateTime? toDate = DateTime.Now.AddDays(-1);
            const bool enabled = true;

            var toggle = new DateRangeToggle(TestName, enabled, null, toDate);

            Assert.IsFalse(toggle.IsEnabled());
        }
예제 #4
0
        public void ToString_Outputs_Object_State()
        {
            DateTime fromDate = DateTime.Now.AddDays(-2);
            DateTime toDate = DateTime.Now.AddDays(2);
            const bool enabled = true;

            var toggle = new DateRangeToggle(TestName, enabled, fromDate, toDate);

            string representation = toggle.ToString();
            StringAssert.Contains(toggle.Name, representation);
            StringAssert.Contains(fromDate.Year.ToString(CultureInfo.InvariantCulture), representation);
        }
예제 #5
0
        public void Toggle_That_Is_Not_Enabled_Evaluates_To_False()
        {
            DateTime fromDate = DateTime.Now.AddDays(-1);
            DateTime toDate = DateTime.Now.AddDays(1);
            const bool enabled = false;

            var toggle = new DateRangeToggle(TestName, enabled, fromDate, toDate);

            Assert.IsFalse(toggle.IsEnabled());
        }