//checkif the object properties are the same
        private void AreTableModelViewEqual(TableModelView <PollEntity> exceptedTable, TableModelView <PollEntity> resultTable)
        {
            var listResutPolls    = resultTable.Elements.ToList();
            var listExpectedPolls = exceptedTable.Elements.ToList();

            Assert.AreEqual(exceptedTable.NumberOfFilteredElm, resultTable.NumberOfFilteredElm);
            Assert.AreEqual(listExpectedPolls.Count, listResutPolls.Count);
            for (int i = 0; i < listExpectedPolls.Count; i++)
            {
                Assert.AreEqual(listExpectedPolls[i].Id, listResutPolls[i].Id);
            }
        }
        public void GetPollsFromFilterOption_Option_nameSortQuestion_Element3_page4()
        {
            var options = new FilterOptionModelView()
            {
                elements = 3, page = 4, nameSort = "Question"
            };
            var paginationHandler = new PaginationHandler <PollEntity>(x => x.Question, x => true);
            var resultTable       = paginationHandler.GetEntityFromFilterOption(options, listPolls.AsQueryable());
            var expectedTable     = new TableModelView <PollEntity>()
            {
                Elements = new List <PollEntity>()
                {
                    listPolls[7], listPolls[6]
                }, NumberOfFilteredElm = 11
            };

            AreTableModelViewEqual(expectedTable, resultTable);
        }
        public void GetPollsFromFilterOption_Option_Phrasepizza_nameSortQuestion_Element2_page1()
        {
            var options = new FilterOptionModelView()
            {
                elements = 2, page = 1, nameSort = "View", phrase = "pizza"
            };
            var paginationHandler = new PaginationHandler <PollEntity>(x => x.View, x => x.Question.ToLower().Contains(options.phrase));
            var resultTable       = paginationHandler.GetEntityFromFilterOption(options, listPolls.AsQueryable());
            var expectedTable     = new TableModelView <PollEntity>()
            {
                Elements = new List <PollEntity>()
                {
                    listPolls[6], listPolls[7]
                }, NumberOfFilteredElm = 2
            };

            AreTableModelViewEqual(expectedTable, resultTable);
        }
        public void GetPollsFromFilterOption_Option_Element5_page3()
        {
            var options = new FilterOptionModelView()
            {
                elements = 5, page = 3
            };
            var paginationHandler = new PaginationHandler <PollEntity>(x => x.DateTime, x => true);
            var resultTable       = paginationHandler.GetEntityFromFilterOption(options, listPolls.AsQueryable());
            var expectedTable     = new TableModelView <PollEntity>()
            {
                Elements = new List <PollEntity>()
                {
                    listPolls[9]
                }, NumberOfFilteredElm = 11
            };

            AreTableModelViewEqual(expectedTable, resultTable);
        }