public void GetProductsForSelectedCategory_ProvideSelectedCategoryWhichIsNotAllCategoryToMethod_ShouldReturnProductsFromSelectedCategory()
        {
            // Arrange:
            const string ALL_CATEGORY_OPTION     = "all category";
            var          configurationReaderMock = new Mock <IAppConfigurationReader>();

            configurationReaderMock.Setup(reader => reader.GetAllCategoryOptionName()).Returns(ALL_CATEGORY_OPTION);

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

            repositoryMock.SetupGet(repo => repo.Products).Returns(productsInRepository.AsQueryable());

            var          service           = new ProductsSelectorService(repositoryMock.Object, configurationReaderMock.Object, new Mock <ILogger>().Object);
            const string SELECTED_CATEGORY = "category 3";

            // Act:
            var result = service.GetProductsForSelectedCategory(SELECTED_CATEGORY);

            // Assert:
            Assert.AreEqual(expected: 2, actual: result.Count());
            Assert.IsTrue(result.First().ProductID == 4 && result.First().Category == SELECTED_CATEGORY);
            Assert.IsTrue(result.ElementAt(1).ProductID == 5 && result.ElementAt(1).Category == SELECTED_CATEGORY);
        }
        public void GetProductsForSelectedCategory_ProvideSelectedCategoryAsAllCategoryOptionToMethod_ShouldReturnAllProductsFromRepository()
        {
            // Arrange:
            const string ALL_CATEGORY_OPTION     = "all category";
            var          configurationReaderMock = new Mock <IAppConfigurationReader>();

            configurationReaderMock.Setup(reader => reader.GetAllCategoryOptionName()).Returns(ALL_CATEGORY_OPTION);

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

            repositoryMock.SetupGet(repo => repo.Products).Returns(productsInRepository.AsQueryable());

            var service = new ProductsSelectorService(repositoryMock.Object, configurationReaderMock.Object, new Mock <ILogger>().Object);

            // Act:
            var result = service.GetProductsForSelectedCategory(ALL_CATEGORY_OPTION);

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