コード例 #1
0
        public void CheckStock_GetProducts_ReturnListOfAllProducts()
        {
            //Arrange
            StockRepository2 stockRepository      = new StockRepository2();
            List <Product>   productsOnRepository = new List <Product>();

            productsOnRepository.Add(new Product());
            productsOnRepository.Add(new Product());
            stockRepository.Products = productsOnRepository;

            //Act
            List <Product> listOfProducts = stockRepository.GetProducts();

            //Assert
            CollectionAssert.AreEqual(listOfProducts, productsOnRepository);
        }
コード例 #2
0
        public void CheckStock_CheckStockForProductsMarkedUnsellable_ReturnOnlyProductsMarkedAsUnsellable()
        {
            StockRepository2 stockRepository      = new StockRepository2();
            List <Product>   productsOnRepository = new List <Product>();

            productsOnRepository.Add(new Product {
                Description = "Item1", Price = 10.0m, Unsellable = true
            });
            productsOnRepository.Add(new Product {
                Description = "Item1", Price = 10.0m, Unsellable = false
            });
            stockRepository.Products = productsOnRepository;

            List <Product> unsellables = stockRepository.GetUnsellableProducts();

            Assert.AreEqual(1, unsellables.Count);
        }