Esempio n. 1
0
        public void TestCategoryNameValidatorEmpty()
        {
            string       category  = String.Empty;
            CategoryName categName = new CategoryName();

            Assert.IsFalse(categName.CategoryNameValidator(category));
        }
Esempio n. 2
0
        public void TestCategoryNameValidator()
        {
            string       category  = "Games";
            CategoryName categName = new CategoryName();

            Assert.IsTrue(categName.CategoryNameValidator(category));
        }
Esempio n. 3
0
        public void TestCategoryNameValidatorFalse()
        {
            string       category  = "Játé kok";
            CategoryName categName = new CategoryName();

            Assert.IsFalse(categName.CategoryNameValidator(category));
        }
Esempio n. 4
0
        public ActionResult Create([Bind(Include = "Category_Name")] CategoryName categoryName)
        {
            if (ModelState.IsValid)
            {
                if (categoryName.CategoryNameValidator(categoryName.Category_Name))
                {
                    db.CategoryNames.Add(categoryName);
                    db.SaveChanges();
                }
                return(RedirectToAction("Index"));
            }

            return(View(categoryName));
        }