public ActionResult Other2()
        {
            var movie = new Movie { Title = "CustomTitle" };

            var db = new GenericDBContext();
            var cats = db.Categories.ToArray();
            return this.View(movie);
        }
        public void TestImportProducts()
        {
            var products = new[]
                               {
                                   new Product
                                       {
                                           Name = "Test Product A " + Guid.NewGuid(),
                                           Description = "Test Description A",
                                           Price = 1,
                                           IsFeatured = false,
                                           IsPublished = false
                                       },
                                       new Product
                                       {
                                           Name = "Test Product B " + Guid.NewGuid(),
                                           Description = "Test Description B",
                                           Price = 2,
                                           IsFeatured = false,
                                           IsPublished = false
                                       },
                                       new Product
                                       {
                                           Name = "Test Product C " + Guid.NewGuid(),
                                           Description = "Test Description C",
                                           Price = 3,
                                           IsFeatured = false,
                                           IsPublished = false
                                       }
                               };

            var svc = new ProductImportService();
            var newProductIds = svc.ImportProducts(products);

            var testDbContext = new GenericDBContext();
            foreach (var productId in newProductIds)
            {
                var actual = testDbContext.Products.Count(p => p.ProductId == productId);
                Assert.AreEqual(1, actual);
            }

            testDbContext.Dispose();
        }
        public void TestImportProductSimple()
        {
            var newProduct = new Product
                                 {
                                     ProductId = 0,
                                     Name = "Test Product " + Guid.NewGuid(),
                                     Description = "Test Description",
                                     Price = 1,
                                     IsFeatured = false,
                                     IsPublished = false
                                 };
            var svc = new ProductImportService();
            var newProductId = svc.ImportProductSimple(newProduct);

            var testDbContext = new GenericDBContext();
            Assert.AreEqual(1, testDbContext.Products.Count(p => p.ProductId == newProductId));
            testDbContext.Dispose();
        }
        ////public ActionResult ShowCategories(int startFrom = 0, int categoriesPerPageParam = 10)
        ////{
        ////    using (var db = new MVCDemo.DAL.DatabaseFirst.Mvc4Application1DBEntities())
        ////    {
        ////        int categoriesPerPage = categoriesPerPageParam;
        ////        var categories = db.Categories.OrderBy(category => category.CategoryId).Skip(startFrom).Take(categoriesPerPage).ToList();
        ////        int categoriesCount = db.Categories.Count();
        ////        ////ViewBag.CategoriesCount = categoriesCount;
        ////        this.ViewBag.PageNo = startFrom / categoriesPerPage;
        ////        this.ViewBag.PagesCount = categoriesCount / categoriesPerPage;
        ////        this.ViewBag.CategoriesPerPage = categoriesPerPage;
        ////        return this.View(categories);
        ////    }
        ////}
        public string ShopCategoryTest()
        {
            using (var db = new GenericDBContext())
            {
                var generalCategory = db.Categories.Single(c => c.CategoryId == 1);
                var computerPeriphCategory = db.Categories.Single(c => c.CategoryId == 3);
                var miceCategory = db.Categories.Where(c => c.CategoryId == 4).Single();

                if (miceCategory.ParentCategory != null)
                {
                    miceCategory.ParentCategory = miceCategory.ParentCategory.CategoryId == 3
                                                      ? generalCategory
                                                      : computerPeriphCategory;
                }

                db.SaveChanges();

                return "ShopCategoryTest complete";
            }
        }