public void shouldReturnAtLeastOneCategory()
        {
            CategoryService categoryService = new CategoryService();
            List<Category> categories = categoryService.GetAllCategories();

            Assert.Greater(categories.Count, 0);
        }
        public void shouldReturnAlLeastOneProductWhenCategory()
        {
            CategoryService categoryService = new CategoryService();
            Category category = categoryService.GetAllCategories()[0];
            List<Product> products = categoryService.GetProductsByCategory(category);

            Assert.Greater(products.Count, 0);
        }
        public void shouldReturnAllProductOfCategoryWhenCategorySpecified()
        {
            CategoryService categoryService = new CategoryService();
            Category category = categoryService.GetAllCategories()[0];
            List<Product> products = categoryService.GetProductsByCategory(category);

            foreach(Product p in products)
            {
                Assert.AreEqual(category.Name, p.category.Name);
            }
        }
Esempio n. 4
0
 private void Init()
 {
     categoryService=new CategoryService();
     cbCategories.DataSource = categoryService.GetAllCategories();
     cbCategories.DisplayMember="Name"  ;
 }