public void AddPreformattedTest() { var target = new ContentViewModel(); const string text = "A test for paragraph {0}"; ContentViewModel actual = target.AddPreformatted(text); target.AddPreformatted("Test"); Assert.IsTrue(actual.GetContent().Any()); var p = actual.GetContent().First(); Assert.AreEqual(ContentType.Preformatted, p.Type); Assert.AreEqual(text, p.Text); Assert.AreEqual("Test", actual.GetContent().Last().Text); }
public ActionResult WidgetContentFive(string widgetContext) { System.Threading.Thread.Sleep(1000); // Fake waiting time to show javascript spinner var model = new ContentViewModel(); model.AddSubTitle("Data context: " + (UserService.Dashboard.GetDataContext(widgetContext) ?? "not set")); model.AddParagraph("This model changes its information based on the data context, set in the right hand sidebar."); model.AddParagraph("It is useful for making a set of widgets display a different kind of information as a whole."); model.AddParagraph("A user selected data context is saved for that user across all pages/widgets"); model.AddParagraph("You can access the Data Context in your widget controllers using the dashboard service:"); model.AddPreformatted(@" public ActionResult WidgetContentFive(string widgetContext) { ... string dataContext = UserService.Dashboard.GetDataContext(widgetContext); ... } "); return(PartialView("EditorTemplates/ContentViewModel", model)); }