public void DocumentsList_VerifyLimit() { var mvcProxy = new MvcControllerProxy(); mvcProxy.ControllerName = typeof(DocumentsListController).FullName; var documentsListController = new DocumentsListController(); documentsListController.Model.SelectionMode = SelectionMode.AllItems; documentsListController.Model.DisplayMode = ListDisplayMode.Limit; documentsListController.Model.SortExpression = "Title ASC"; documentsListController.Model.ItemsPerPage = 1; mvcProxy.Settings = new ControllerSettings(documentsListController); var docs = documentsListController.Model.CreateListViewModel(null, 1).Items.ToArray(); Assert.IsTrue(docs.Length.Equals(1), "Number of docs is not correct"); Assert.AreEqual(DocumentTitle + 1, docs[0].Fields.Title.Value, "Wrong title"); }
public void DocumentsList_VerifySortingLastPublished() { var mvcProxy = new MvcControllerProxy(); mvcProxy.ControllerName = typeof(DocumentsListController).FullName; var documentsListController = new DocumentsListController(); documentsListController.Model.SelectionMode = SelectionMode.AllItems; documentsListController.Model.SortExpression = "PublicationDate DESC"; mvcProxy.Settings = new ControllerSettings(documentsListController); var docs = documentsListController.Model.CreateListViewModel(null, 1).Items.ToArray(); Assert.IsTrue(docs.Length.Equals(3), "Number of docs is not correct"); //// expected: Document2, Document3, Document1 Assert.AreEqual(DocumentTitle + 2, docs[0].Fields.Title.Value, "Wrong title"); Assert.AreEqual(DocumentTitle + 3, docs[1].Fields.Title.Value, "Wrong title"); Assert.AreEqual(DocumentTitle + 1, docs[2].Fields.Title.Value, "Wrong title"); }