Example #1
0
        public void TestGetProductsPagination3_3()
        {
            // Arrange
            IProductRepository productRepository = new DefaultExampleProductRepository();
            int start = 3, pageSize = 3;

            // Act
            var products = productRepository.GetProducts(resource, start, pageSize);

            // Assert
            Assert.IsNotNull(products);
            Assert.IsTrue(products.Count() == 3);
        }
Example #2
0
        public void TestGetProducts()
        {
            // Arrange
            IProductRepository productRepository = new DefaultExampleProductRepository();


            // Act
            var products = productRepository.GetProducts(resource);

            // Assert
            Assert.IsNotNull(products);
            Assert.IsTrue(products.Count() == 20);
        }
Example #3
0
        public void TestOutputPaginatedProductsOutOfBound1()
        {
            // make some fakes for the test
            IProductRepository productRepository = new DefaultExampleProductRepository();
            ICurrencyService   currencyService   = new CurrencyService();
            var productListVisualizer            = new ProductListVisualizer(productRepository, currencyService);

            // Act
            productListVisualizer.SetCurrencyCode(1);

            try
            {
                productListVisualizer.OutputPaginatedProducts(-11, 5);
            }
            catch (Exception ex)
            {
                // Assert
                Assert.Fail(ex.Message); // If it gets to this line, no exception was thrown
            }
        }