Ejemplo n.º 1
0
        public void TestEditGet()
        {
            var controller = new BubbleTeaController();
            var result0    = controller.Edit(0);

            Assert.IsInstanceOfType(result0, typeof(HttpNotFoundResult));

            var db      = new CS4PEEntities();
            var item    = db.BubleTea.First();
            var result1 = controller.Edit(item.id);
            var view    = result1 as ViewResult;

            Assert.IsNotNull(view);

            var model = view.Model as BubleTea;

            Assert.IsNotNull(model);
            Assert.AreEqual(item.id, model.id);
        }
Ejemplo n.º 2
0
        public void TestEditPost()
        {
            var db         = new CS4PEEntities();
            var item       = db.BubleTea.First();
            var controller = new BubbleTeaController();
            var result     = controller.Edit(item.id);
            var view       = result as ViewResult;

            Assert.IsNotNull(view);

            var model = view.Model as BubleTea;

            Assert.IsNotNull(model);

            var result1  = controller.Edit(model);
            var redirect = result1 as RedirectToRouteResult;

            Assert.IsNotNull(redirect);
            Assert.AreEqual("Index", redirect.RouteValues["action"]);
        }