public void FormListLogicTest()
    {
      var _manager = new PaginationManager(data);
      var result = _manager.FormProgramsPage(pageSize: 2, page: 1);
      var programs = data.Programs.Data.OrderBy(x => x.Name).Take(2);
      Assert.AreEqual(result.Count(), 2);
      Assert.AreEqual(result.First().Name, programs.First().Name);
      Assert.AreEqual(result.Last().Name, programs.Last().Name);

      var result2 = _manager.FormMyRobotsPage(robots:data.Robots.Data, pageSize: 2, page: 1);
      var robots = data.Robots.Data.OrderBy(x => x.RobotID).Take(1);
      Assert.AreEqual(result2.Count(), 1);
      Assert.AreEqual(result2.First().RobotID, robots.First().RobotID);
    }
        public void FormListLogicTest()
        {
            var _manager = new PaginationManager(data);
            var result   = _manager.FormProgramsPage(pageSize: 2, page: 1);
            var programs = data.Programs.Data.OrderBy(x => x.Name).Take(2);

            Assert.AreEqual(result.Count(), 2);
            Assert.AreEqual(result.First().Name, programs.First().Name);
            Assert.AreEqual(result.Last().Name, programs.Last().Name);

            var result2 = _manager.FormMyRobotsPage(robots: data.Robots.Data, pageSize: 2, page: 1);
            var robots  = data.Robots.Data.OrderBy(x => x.RobotID).Take(1);

            Assert.AreEqual(result2.Count(), 1);
            Assert.AreEqual(result2.First().RobotID, robots.First().RobotID);
        }
Example #3
0
        public ViewResult ShowAllPrograms(int page = 1)
        {
            var robotSelectListContent =
                _robotManager.GetRobotsByUser(FakeSession.User).
                Select(robot => new
            {
                RobotID   = robot.RobotID + "",
                RobotName = "Robot №" + robot.RobotID
            }).ToList();

            ViewBag.robotSelectListContent       = new MultiSelectList(robotSelectListContent, "RobotID", "RobotName");
            ViewBag.robotSelectListContentLength = _robotManager.GetRobotsByUser(FakeSession.User).Count();

            return(View(new PagedContentViewModel <Program>
            {
                PageContent = _paginationManager.FormProgramsPage(pageSize, page),
                PagingInfo = new PagingInfo
                {
                    CurrentPage = page,
                    ItemsPerPage = pageSize,
                    TotalItems = _contentManager.AmountPrograms
                }
            }));
        }