コード例 #1
0
        public ActionResult GetAllProducts()
        {
            productContainer.ClearList();
            productContainer.AllProducts();
            List <Product> productslist = productContainer.GetList();

            return(PartialView("../Partials/_productDisplay", productslist));
        }
コード例 #2
0
        public void Check_if_list_is_cleared()
        {
            //Arrange
            var            productDALStub   = new ProductDALStub();
            var            productContainer = new ProductContainer(productDALStub);
            List <Product> products         = new List <Product>();
            Product        product          = new Product();

            //Act
            products.Add(product);
            products.Add(product);
            products.Add(product);

            var list = productContainer.GetList();

            productContainer.ClearList();
            //Assert
            var result   = list.Count();
            var expected = 0;

            Assert.Equal(expected, result);
        }