public void CanCastItemList() { ItemList items = new ItemList(); items.Add(CreateOneItem<FirstItem>(1, "one", null)); items.Add(CreateOneItem<SecondItem>(1, "two", null)); ItemList<FirstItem> firsts = items.Cast<FirstItem>(); Assert.That(firsts.Count, Is.EqualTo(1)); }
public void CanCastItemList() { ItemList items = new ItemList(); items.Add(CreateOneItem <FirstItem>(1, "one", null)); items.Add(CreateOneItem <SecondItem>(1, "two", null)); ItemList <FirstItem> firsts = items.Cast <FirstItem>(); Assert.That(firsts.Count, Is.EqualTo(1)); }
private IList <TagGroup> GetAvailableCategories(ContentItem item) { foreach (var ancestor in Find.EnumerateParents(item, null, true)) { ItemList tagContainers = ancestor.GetChildPagesUnfiltered().Where(new TypeFilter(typeof(Items.TagGroup))); if (tagContainers.Count > 0) { return(tagContainers.Cast <TagGroup>()); } } return(null); }