Ejemplo n.º 1
0
        public void AddProductToCategory()
        {
            LinkedList <Product> expected = new LinkedList <Product>();

            expected.AddLast(new Product("P21", "Fraid Egg", 10, "yami"));
            var newProd = new Product("P10023", "bla", 10, "da");

            handler.AddProductToDatabase(newProd);
            expected.AddFirst(newProd);
            handler.AddProductToCategory("C1", "P10023");
            var find = handler.GetAllCategoryProducts("C1");

            Product[] expectedresults = new Product[expected.Count];
            Product[] findresults     = new Product[find.Count];
            expected.CopyTo(expectedresults, 0);
            find.CopyTo(findresults, 0);
            for (int i = 0; i < expectedresults.Length; i++)
            {
                Assert.AreEqual(expectedresults[i], findresults[i]);
            }
        }