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++])); }
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; }
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++])); }