Пример #1
0
        public void DocumentsList_VerifyPaging()
        {
            var mvcProxy = new MvcControllerProxy();

            mvcProxy.ControllerName = typeof(DocumentsListController).FullName;
            var documentsListController = new DocumentsListController();

            documentsListController.Model.SelectionMode  = SelectionMode.AllItems;
            documentsListController.Model.DisplayMode    = ListDisplayMode.Paging;
            documentsListController.Model.SortExpression = "Title ASC";
            documentsListController.Model.ItemsPerPage   = 1;
            mvcProxy.Settings = new ControllerSettings(documentsListController);

            var docsPage1 = documentsListController.Model.CreateListViewModel(null, 1).Items.ToArray();

            Assert.IsTrue(docsPage1.Length.Equals(1), "Number of docs is not correct");
            Assert.AreEqual(DocumentTitle + 1, docsPage1[0].Fields.Title.Value, "Wrong title");

            var docsPage2 = documentsListController.Model.CreateListViewModel(null, 2).Items.ToArray();

            Assert.IsTrue(docsPage2.Length.Equals(1), "Number of docs is not correct");
            Assert.AreEqual(DocumentTitle + 2, docsPage2[0].Fields.Title.Value, "Wrong title");

            var docsPage3 = documentsListController.Model.CreateListViewModel(null, 3).Items.ToArray();

            Assert.IsTrue(docsPage3.Length.Equals(1), "Number of docs is not correct");
            Assert.AreEqual(DocumentTitle + 3, docsPage3[0].Fields.Title.Value, "Wrong title");
        }
        public void DocumentsList_VerifySortingTitleAZ()
        {
            var mvcProxy = new MvcControllerProxy();

            mvcProxy.ControllerName = typeof(DocumentsListController).FullName;
            var documentsListController = new DocumentsListController();

            documentsListController.Model.SelectionMode  = SelectionMode.AllItems;
            documentsListController.Model.SortExpression = "Title ASC";
            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: Document1, Document2, Document3
            Assert.AreEqual(DocumentTitle + 1, docs[0].Fields.Title.Value, "Wrong title");
            Assert.AreEqual(DocumentTitle + 2, docs[1].Fields.Title.Value, "Wrong title");
            Assert.AreEqual(DocumentTitle + 3, docs[2].Fields.Title.Value, "Wrong title");
        }