public void Teardown() { try { userid = 2; controller.ModelState.Clear(); var result = controller.DeleteDishes(item.id, userid); IngredientsController controllerIng = new IngredientsController(); var result2 = controllerIng.GetIngredient().ToList(); Ingredient temping = result2.Find(e => e.name == "testpepperoni"); if (temping != null) { controllerIng.DeleteIngredient(temping.id, userid); } temping = result2.Find(e => e.name == "ost"); if (temping != null) { controllerIng.DeleteIngredient(temping.id, userid); } } catch (Exception e) { } }