Ejemplo n.º 1
0
        public void DAO_FindAll()
        {
            int            numberProducts  = 8;
            List <Product> createdProducts = new List <Product>(numberProducts);

            for (int i = 0; i < numberProducts; i++)
            {
                product = new Product
                {
                    productName     = productName + i,
                    productPrice    = productPrice,
                    productDate     = productDate,
                    productQuantity = productQuantity,
                    categoryId      = category.categoryId
                };

                productDao.Create(product);
                createdProducts.Add(product);
            }

            List <Product> totalRetrievedProducts = productDao.FindAll();

            Assert.AreEqual(numberProducts, totalRetrievedProducts.Count);

            for (int i = 0; i < numberProducts; i++)
            {
                Assert.AreEqual(totalRetrievedProducts[i], createdProducts[i]);
            }
        }