Esempio n. 1
0
        public void Type_TestingTypeIsPublic_TypeIsSavedInClass()
        {
            Category target = new Category();
            target.Type = testString;

            Assert.AreEqual(testString, target.Type);
        }
Esempio n. 2
0
        public void Styles_AddCategory_OneCategoryInCategory()
        {
            Style style = new Style();
            Category target = new Category();
            target.Styles.Add(style);

            Assert.AreEqual(1, target.Styles.Count);
        }
Esempio n. 3
0
        public void Categories_AddCategory_OneCategoryInStyle()
        {
            Category category = new Category();
            Style target = new Style();
            target.Categories.Add(category);

            Assert.AreEqual(1, target.Categories.Count);
        }
        public ActionResult Create(Category category)
        {
            if (ModelState.IsValid)
            {
                db.Categories.Add(category);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(category);
        }
Esempio n. 5
0
        public void CategoryID_TestingIdIsPublic_IdIsSavedInClass()
        {
            Category target = new Category();

            Random random = new Random();

            for(int counter = 0; counter < 10; counter++)
            {
                int testId = random.Next();
                target.CategoryID = testId;

                Assert.AreEqual(testId, target.CategoryID);
            }
        }
Esempio n. 6
0
        public void CategoryConstructor_Null_NoStylesCreated()
        {
            Category target = new Category();

            Assert.AreEqual(0, target.Styles.Count);
        }
 public ActionResult Edit(Category category)
 {
     if (ModelState.IsValid)
     {
         db.Entry(category).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(category);
 }