public void GetBreadCrumbs() { phBreadCrumbs.Controls.Clear(); BreadCrumbs breadcrumbs = base.CurrentPortalPage.BreadCrumbs; if (BreadcrumbClassSetting != "") { breadcrumbs.CssClass = BreadcrumbClassSetting; } if (BreadcrumbSeparatorSetting != "") { breadcrumbs.Separator = BreadcrumbSeparatorSetting; } // Remove the number of levels set by the administrator if (RemoveLevelsSetting != 0) { int levels = breadcrumbs.Count - RemoveLevelsSetting; for (int i = breadcrumbs.Count; i > levels; i--) { breadcrumbs.RemoveAt(i - 1); } } phBreadCrumbs.Controls.Add(new LiteralControl(breadcrumbs.ToString())); }
public void TestToStringWorksProperly() { BreadCrumbs crumbs = new BreadCrumbs(2); crumbs.Push("sam"); crumbs.Push("hello"); crumbs.Push("world"); Assert.AreEqual(3, crumbs.Count()); Assert.AreEqual("hello | world", crumbs.ToString()); }
public void TestLinkedCrumbs() { BreadCrumbs crumbs = new BreadCrumbs(2); crumbs.Push("bob"); crumbs.Push("linked", true); crumbs.Push("new"); crumbs.Pop(); Assert.AreEqual(1, crumbs.Count()); Assert.AreEqual("bob", crumbs.ToString()); }