Example #1
0
        public void CanFilterInExternalLoop()
        {
            ItemList fiveItems = CreateItems(5);
            CountFilter filter = new CountFilter(2, 2);

            int i = 0;
            Assert.IsFalse(filter.Match(fiveItems[i++]));
            Assert.IsFalse(filter.Match(fiveItems[i++]));
            Assert.IsTrue(filter.Match(fiveItems[i++]));
            Assert.IsTrue(filter.Match(fiveItems[i++]));
            Assert.IsFalse(filter.Match(fiveItems[i++]));
        }
Example #2
0
 public virtual MembershipUserCollection GetMembershipUsers(string providerName, int startIndex, int maxResults,
     out int totalRecords)
 {
     totalRecords = 0;
     CountFilter cf = new CountFilter(startIndex, maxResults);
     MembershipUserCollection muc = new MembershipUserCollection();
     foreach (User u in Children)
     {
         if (cf.Match(u))
             muc.Add(u.GetMembershipUser(providerName));
         totalRecords++;
     }
     return muc;
 }
Example #3
0
        public void CanResetFilter()
        {
            ItemList fiveItems = CreateItems(5);
            CountFilter filter = new CountFilter(2, 2);

            foreach (ContentItem item in fiveItems)
                filter.Match(item);
            
            filter.Reset();
            int i = 0;
            Assert.IsFalse(filter.Match(fiveItems[i++]));
            Assert.IsFalse(filter.Match(fiveItems[i++]));
            Assert.IsTrue(filter.Match(fiveItems[i++]));
            Assert.IsTrue(filter.Match(fiveItems[i++]));
            Assert.IsFalse(filter.Match(fiveItems[i++]));
        }