示例#1
0
        public void Feature_IsEnabledEqualsFalse_Objects_ShouldFilterRecords()
        {
            var jsonSettings = GetJsonSettings(EnvironmentEnum.DEV, PlatformEnum.Web);
            var feature      = new FilterFeature(jsonSettings);

            Assert.IsFalse(feature.IsEnabled());

            var guidObjects     = TestFilterData.GetGuidObjects();
            var filteredResults = feature.GetFilteredGuidObjects(guidObjects);
            var itemsToFilter   = feature.FilterValues.Select(s => new Guid(s));

            foreach (var guidToFilter in itemsToFilter)
            {
                Assert.IsTrue(filteredResults.Where(w => w.Id == guidToFilter).Count() == 0);
            }
        }
示例#2
0
        public void Feature_IsEnabledEqualsFalse_DataSet_ShouldFilterRecords()
        {
            var jsonSettings = GetJsonSettings(EnvironmentEnum.DEV, PlatformEnum.Web);
            var feature      = new FilterFeature(jsonSettings);

            Assert.IsFalse(feature.IsEnabled());

            var guidDataSet   = TestFilterData.GetFullGuidList();
            var originalGuids = guidDataSet.Tables[0].AsEnumerable().Select(s => s.Field <Guid>("ID"));

            var filteredResults = feature.GetFilteredGuidItems(guidDataSet).Tables[0].AsEnumerable().Select(s => s.Field <Guid>("ID"));
            var itemsToFilter   = feature.FilterValues.Select(s => new Guid(s));

            foreach (var guidToFilter in itemsToFilter)
            {
                Assert.IsTrue(filteredResults.Where(w => w == guidToFilter).Count() == 0);
            }
        }