Example #1
0
        // GET: JsonToggler
        public virtual ActionResult Index()
        {
            var feature1 = new DateFeature();
            var feature2 = new BasicFeature();
            var feature3 = new Filter_Feature();
            var feature4 = new SQLFeature();

            var isEnabled = feature2.IsEnabled();

            var listOfGuids = new List <Guid>();

            listOfGuids.Add(new Guid("00000000-0000-0000-0000-000000000001"));
            listOfGuids.Add(new Guid("00000000-0000-0000-0000-000000000002"));
            listOfGuids.Add(new Guid("00000000-0000-0000-0000-000000000003"));
            listOfGuids.Add(new Guid("00000000-0000-0000-0000-000000000004"));
            listOfGuids.Add(new Guid("00000000-0000-0000-0000-000000000005"));

            var result = feature3.FilterCollection <Guid, Guid>(listOfGuids, "").ToList();

            var listOfObjects = GetListOfSomeObject();
            var result2       = feature3.FilterCollection <SomeObject, Guid>(listOfObjects, "Id").ToList();

            //This will do the opposite of the original filter... This will filter only if the feature is enabled.
            var result3 = feature3.FilterCollection <SomeObject, Guid>(listOfObjects, "Id", true).ToList();

            var vm = new JsonTogglerFeatureViewModel()
            {
                BasicFeature = feature2, SQLFeature = feature4, DateFeature = feature1, Filter_Feature = feature3, OriginalCollection = listOfGuids, UpdatedCollection = result
            };

            return(View(vm));
        }
Example #2
0
        public void Feature_CommandGreaterThanNowByYear_IsEnabled_ReturnsFalse()
        {
            var jsonSettings = GetJsonSettings(EnvironmentEnum.LOCAL, PlatformEnum.Web);
            var feature      = new DateFeature(jsonSettings);

            feature.Command = DateTime.UtcNow.AddYears(1).ToString();

            Assert.IsFalse(feature.IsEnabled());
        }
Example #3
0
        public void Feature_CommandEqualToNow_IsEnabled_ReturnsTrue()
        {
            var jsonSettings = GetJsonSettings(EnvironmentEnum.LOCAL, PlatformEnum.Web);
            var feature      = new DateFeature(jsonSettings);

            feature.Command = DateTime.UtcNow.ToString();

            Assert.IsTrue(feature.IsEnabled());
        }