public void ContentParent() { Controller cn = new Controller("/default"); Controller child = cn.Controllers[0]; Controller parent = child.Parent; Assert.AreEqual(cn.ID, parent.ID, string.Format("Id={0}, ParentId={1}", cn.ID, parent.ID)); }
public void ContentLoad() { Console.WriteLine("Loading content \"/default\""); Controller cn = new Controller("/default"); Console.WriteLine(string.Format("ID for {0} is {1}", cn.Title, cn.ID)); Console.WriteLine("Checking content properties"); //Assert.IsNotNull(cn.Users, "The users for the test content came back as null."); Assert.IsNotNull(cn.Files, "The media for this content came back as null (not empty, null)"); Assert.IsNotNull(cn.Controllers, "The list of children came back as null (not empty, null)"); Console.WriteLine("Template ID: {0}", cn.TemplateID); Assert.IsNotNull(cn.Template, "The content template is null"); }
public void ContentSaving() { Console.WriteLine("Saving content \"/test\""); Controller cn = new Controller("/test"); cn.Title = "Test Content"; cn.ControllerID = new Guid("51799860-8138-43b4-9584-183af29503e4"); cn.FileName = "test"; cn.ModuleControlID = new Guid("152D7361-5CFD-4A76-B2C9-4FB230F3773C"); cn.TemplateID = new Guid("602b9110-855e-4888-a721-2d61804fd981"); cn.TemplateControl = "Default.master"; cn.PublishDate = DateTime.Now; cn.ModifyDate = DateTime.Now; cn.Status = PublishStatus.Draft; //cn.DataManager["Settings"] = string.Empty; cn.Save(); Assert.AreNotEqual(cn.ID, Guid.Empty, "The Content's ID was an empty GUID. Doh."); }
public override void DataBind() { List<Controller> crumbs = new List<Controller>(); if (this.ContentPath != null) { Content = new Controller(this.ContentPath); } Controller current = Content; do { crumbs.Add(current); current = current.Parent; } while (current != null); crumbs.Reverse(); this.DataSource = crumbs; base.DataBind(); }
public void FeaturedContent() { Controller cn = new Controller("/default"); Page page = new Page(); page.PageNumber = 1; page.Name = "New featured content page"; page.Body = "Yay"; Page page2 = new Page(); page2.PageNumber = 2; page2.Name = "Page 2"; page2.Body = "Not page 3"; cn.AddPage(page); cn.AddPage(page2); cn.Save(); cn = new Controller("/default"); cn.RemovePage(1); cn.Save(); }
public object Clone() { Controller c = new Controller(); Dictionary<string, object> values = new Dictionary<string, object>(); foreach (string key in new List<string>(this.DataManager.Keys)) { object value = this.DataManager[key]; if (value != null && (value.GetType().IsValueType || value is string)) { values.Add(key, value); } } c.DataManager.Populate(values); return c; }