Esempio n. 1
0
        public ActionResult GetAllProducts()
        {
            productContainer.ClearList();
            productContainer.AllProducts();
            List <Product> productslist = productContainer.GetList();

            return(PartialView("../Partials/_productDisplay", productslist));
        }
Esempio n. 2
0
        public void Check_If_Get_List()
        {
            //Arrange
            var            productDALStub   = new ProductDALStub();
            var            productContainer = new ProductContainer(productDALStub);
            List <Product> products         = new List <Product>();

            productDALStub.ExistReturnValue = false;

            //Act
            var productList = productContainer.GetList();

            //Assert
            Assert.Equal(products, productList);
        }
Esempio n. 3
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);
        }
Esempio n. 4
0
        public void SaveProductsInList()
        {
            if (table.Rows.Count > 0)
            {
                Product          product;
                ProductContainer productcontainer = new ProductContainer(new ProductDAL());
                List <Product>   productslist     = productcontainer.GetList();

                for (int i = 0; i < table.Rows.Count; i++)
                {
                    var dr = table.Rows[i];
                    product = new Product()
                    {
                        id           = Convert.ToInt32(dr["ID"]),
                        productNaam  = dr["Name"].ToString(),
                        prijs        = Convert.ToDouble(dr["Prize"]),
                        omschrijving = dr["Description"].ToString(),
                        tag          = dr["Tag"].ToString()
                    };
                    productslist.Add(product);
                }
                ClearTable();
            }
        }