Ejemplo n.º 1
0
        public void TestRedirectToRecipeIndex()
        {
            MyContext TestDb     = GetInMemoryDatabase();
            var       controller = new RecipesController(TestDb);

            var result = controller.Recipe(-1);

            // Assert
            var redirectToActionResult = Assert.IsType <RedirectToActionResult>(result);

            Assert.Equal("Recipes", redirectToActionResult.ControllerName);
            Assert.Equal("Index", redirectToActionResult.ActionName);
        }
Ejemplo n.º 2
0
        public void TestSingleRecipe()
        {
            MyContext TestDb     = GetInMemoryDatabase();
            var       controller = new RecipesController(TestDb);

            var result     = controller.Recipe(10);
            var viewResult = Assert.IsType <ViewResult>(result);

            // Assert
            Recipe Recipe = controller.ViewBag.Recipe;

            Assert.Equal("Burger", Recipe.Title);
            Assert.Equal("Meat", Recipe.Type);
        }