private static Recipe CreateRecipe(RecipeController recipeController) { Console.WriteLine("Создать рецепт"); Recipe recipe = recipeController.CreateRecipe(); recipeController.GetRecipes().Add(recipe); recipeController.SaveRecipes(); return(recipe); }
public async Task TestGetRecipes() { // Arrange Recipe recipe1 = new Recipe { Author = "user1", Title = "newtitle", Type = "type1", body = "body1", Ingredients = "Ing1" }; Recipe recipe2 = new Recipe { Author = "user2", Title = "oldtitle", Type = "type2", body = "body2", Ingredients = "Ing2" }; _recipes_context.Add(recipe1); _recipes_context.Add(recipe2); _recipes_context.SaveChanges(); // Act var result = await _recipeController.GetRecipes("old"); var Ok_result = result as OkObjectResult; // Assert Assert.IsNotNull(Ok_result); Assert.IsInstanceOfType(result, typeof(OkObjectResult)); }