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); }
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); }