public void List_ProvidePageNumber_ShouldReturnProductsForProvidedPageNumber()
        {
            // Arrange:
            const int PAGE_SIZE = 2;
            var       configurationReaderMock = new Mock <IAppConfigurationReader>();

            configurationReaderMock.Setup(reader => reader.GetProductsCountPerPage()).Returns(PAGE_SIZE);

            var productsInRepository = new List <Product>
            {
                new Product {
                    ProductID = 1, Category = "some category"
                },
                new Product {
                    ProductID = 2, Category = "some category"
                },
                new Product {
                    ProductID = 3, Category = "some category"
                },
                new Product {
                    ProductID = 4, Category = "some category"
                },
                new Product {
                    ProductID = 5, Category = "some category"
                }
            };
            var productsSelectorServiceMock = new Mock <IProductsSelectorService>();

            productsSelectorServiceMock.Setup(service => service.GetProductsForSelectedCategory(It.IsAny <string>()))
            .Returns(productsInRepository.AsQueryable());

            var       controller = new ProductsListController(configurationReaderMock.Object, productsSelectorServiceMock.Object, new Mock <ILogger>().Object);
            const int FIRST_PAGE = 1, SECOND_PAGE = 2, LAST_PAGE = 3;

            // Act:
            var resultForFirstPage  = controller.List("some category", FIRST_PAGE).Model as List <Product>;
            var resultForSecondPage = controller.List("some category", SECOND_PAGE).Model as List <Product>;
            var resultForLastPage   = controller.List("some category", LAST_PAGE).Model as List <Product>;

            // Assert:
            Assert.AreEqual(expected: 2, actual: resultForFirstPage.Count);
            Assert.AreEqual(1, resultForFirstPage[0].ProductID);
            Assert.AreEqual(2, resultForFirstPage[1].ProductID);

            Assert.AreEqual(2, resultForSecondPage.Count);
            Assert.AreEqual(3, resultForSecondPage[0].ProductID);
            Assert.AreEqual(4, resultForSecondPage[1].ProductID);

            Assert.AreEqual(1, resultForLastPage.Count);
            Assert.AreEqual(5, resultForLastPage[0].ProductID);
        }
        public void List_ProvideFirstPageNumber_ShouldReturnAllProducts_WhenProductsCountDoesNotExceedMaxCountPerPage()
        {
            // Arrange:
            const int PAGE_SIZE = 6;
            var       configurationReaderMock = new Mock <IAppConfigurationReader>();

            configurationReaderMock.Setup(reader => reader.GetProductsCountPerPage()).Returns(PAGE_SIZE);

            var productsInRepository = new List <Product>
            {
                new Product {
                    ProductID = 1, Category = "some category"
                },
                new Product {
                    ProductID = 2, Category = "some category"
                },
                new Product {
                    ProductID = 3, Category = "some category"
                },
                new Product {
                    ProductID = 4, Category = "some category"
                },
                new Product {
                    ProductID = 5, Category = "some category"
                }
            };
            var productsSelectorServiceMock = new Mock <IProductsSelectorService>();

            productsSelectorServiceMock.Setup(service => service.GetProductsForSelectedCategory(It.IsAny <string>()))
            .Returns(productsInRepository.AsQueryable());

            var       controller = new ProductsListController(configurationReaderMock.Object, productsSelectorServiceMock.Object, new Mock <ILogger>().Object);
            const int FIRST_PAGE = 1;

            // Act:
            var result = controller.List("some category", FIRST_PAGE).Model as List <Product>;

            // Assert:
            Assert.AreEqual(expected: productsInRepository, actual: result);
        }