public void Should_Call_Words_Repo_With_Correct_Arguments(int pageNumber, int pageSize)
        {
            _wordsRepository.GetPageOfWords(pageSize, pageNumber).Returns(new List <WordResponseModel> {
            });

            _dictionaryController.Index(pageNumber);
            _wordsRepository.Received().GetPageOfWords(_dictionaryConfiguration.Value.pageSize, pageNumber);
            var res = _dictionaryController.Index(pageNumber);
        }
Exemplo n.º 2
0
        public IActionResult Index(int page = 1, string ErrorMessage = null)
        {
            if (ErrorMessage != null)
            {
                _dictionaryModel.ErrorMessage = ErrorMessage;
            }
            _pageSize = _dictionaryConfiguration.pageSize;
            _dictionaryModel.wordsDictionary = _wordsRepository.GetPageOfWords(_pageSize, page);
            _dictionaryModel.page            = page;

            return(View(_dictionaryModel));
        }
        public IActionResult Page(int pageNumber = 1)
        {
            List <WordResponseModel> words = _wordsRepository
                                             .GetPageOfWords(_dictionaryConfiguration.pageSize, pageNumber);

            if (words.Count > 0)
            {
                return(Ok(new { page = pageNumber, words }));
            }
            else
            {
                return(NotFound());
            }
        }