Esempio n. 1
0
        public void DB_EditSpecificHero_Hero()
        {
            HeroController controller = new HeroController(db);
            Hero           testHero1  = new Hero
            {
                Name   = "Mario",
                Weapon = "Yoshi"
            };

            controller.Create(testHero1, null);

            var  collection = (controller.Index() as ViewResult).ViewData.Model as List <Hero>;
            Hero heroToEdit = (controller.Edit(collection[0].HeroId) as ViewResult).ViewData.Model as Hero;

            heroToEdit.Name = "New Mario";
            controller.Edit(heroToEdit);
            var collection2 = (controller.Index() as ViewResult).ViewData.Model as List <Hero>;

            Assert.AreEqual("New Mario", collection2[0].Name);
        }