public void DeleteRecipe_RecipeDeleted_RecipeIsNotExists() { recipeController.DeleteRecipe(3); navMenu.CategoriesMenuViewModels = NavMenu.GenerateMenu(context.Recipes.ToList()); context.Recipes.Count().Should().Be(2); navMenu.CategoriesMenuViewModels.Count.Should().Be(2); }
public void DeleteRecipe_RecipeWithCategoryDeleted_CategoryDeleted() { recipeController.DeleteRecipe(1); recipeController.DeleteRecipe(3); navMenu.CategoriesMenuViewModels = NavMenu.GenerateMenu(context.Recipes.ToList()); context.Recipes.Count().Should().Be(1); navMenu.CategoriesMenuViewModels.Count.Should().Be(1); }
public void AddRecipe_ExistingCategories_RecipeAddedToExistingCategories() { var newRecipe = new RecipeViewModel() { Categories = "1, 2", Ingredients = "cheese", Instructions = "just cook and eat", Name = "d", RecipeId = 4 }; recipeController.AddRecipe(newRecipe); navMenu.CategoriesMenuViewModels = NavMenu.GenerateMenu(context.Recipes.ToList()); context.Recipes.Count().Should().Be(4); navMenu.CategoriesMenuViewModels.Count.Should().Be(2); }
public void EditRecipe_CategoryChanged_RecipeUpdated() { var newRecipe = new RecipeViewModel() { Categories = "1, 2", Ingredients = "cheese", Instructions = "just cook and eat", Name = "aaaa", RecipeId = 1, }; var newContext = new ApplicationContext(options); recipeController = new RecipeController(newContext); recipeController.EditRecipe(newRecipe).Wait(); navMenu.CategoriesMenuViewModels = NavMenu.GenerateMenu(newContext.Recipes.ToList()); newContext.Recipes.Count().Should().Be(3); newContext.Recipes.First(r => r.RecipeId == 1).Name.Should().Be("aaaa"); navMenu.CategoriesMenuViewModels.Count.Should().Be(2); }