public async Task TestUploadFileFail() { using (var context = new MyRecipesContext(options)) { RecipeImage image = new RecipeImage(); try { RecipesController recipeController = new RecipesController(context, configuration); IActionResult okResult = await recipeController.UploadRecipe(image) as IActionResult; } catch (Exception e) { // Assert Assert.IsInstanceOfType(e, typeof(ArgumentException)); } } }