public void GetPage_SelectedPageLessThen1_Page()
        {
            PageState testPageState = new PageState()
            {
                CodesOnPage = 10, LastPage = 6, OperatorId = 1, OperatorName = null, Page = -10
            };
            var codeList = new List <Code>()
            {
                new Code()
            };
            var codeViewModelList = new List <CodeViewModel>()
            {
                new CodeViewModel()
            };

            mockUnitOfWork.Setup(m => m.Codes.Get(It.IsAny <Expression <Func <Code, bool> > >(), It.IsAny <Func <IQueryable <Code>,
                                                                                                                 IOrderedQueryable <Code> > >(), It.IsAny <string>())).Returns(codeList);
            mockUnitOfWork.Setup(m => m.Operators.GetById(It.Is <int>(x => x == testPageState.OperatorId))).Returns(new Operator()
            {
                Name = "Zhora"
            });
            mockMapper.Setup(m => m.Map <IEnumerable <Code>,
                                         IEnumerable <CodeViewModel> >(It.Is <IEnumerable <Code> >(x => x.Equals(codeList)))).Returns(codeViewModelList);

            var result = manager.GetPage(testPageState);

            Assert.That(result.PageState.Page, Is.GreaterThanOrEqualTo(1));
        }
        public void GetPage_nullPageState_null()
        {
            PageState testPageState     = null;
            var       codeList          = new List <Code>();
            var       codeViewModelList = new List <CodeViewModel>();

            mockUnitOfWork.Setup(m => m.Codes.Get(It.IsAny <Expression <Func <Code, bool> > >(), It.IsAny <Func <IQueryable <Code>,
                                                                                                                 IOrderedQueryable <Code> > >(), It.IsAny <string>())).Returns(codeList);
            mockUnitOfWork.Setup(m => m.Operators.GetById(It.Is <int>(x => x == testPageState.OperatorId))).Returns(new Operator {
                Name = "Zhora"
            });
            mockMapper.Setup(m => m.Map <IEnumerable <Code>,
                                         IEnumerable <CodeViewModel> >(It.Is <IEnumerable <Code> >(x => x.Equals(codeList)))).Returns(codeViewModelList);

            var result = manager.GetPage(testPageState);

            Assert.That(result, Is.Null);
        }