public IDataRecipe Get(int id)
        {
            var success = new DataRecipe {
                Id   = id,
                Name = "Mock Data Recipe",
            };
            IDataRecipe fail = null;

            return(id < 0 ? fail : success);
        }
        public void Constructor_ThrowsArgumentNullExceptionOnDataRecipe()
        {
            IDataRecipe            recipe      = null;
            List <IDataIngredient> ingredients = new List <IDataIngredient> {
                new DataIngredient()
            };
            List <IDataRecipeIngredient> recipeIngredients = new List <IDataRecipeIngredient> {
                new DataRecipeIngredient()
            };
            Action action = () => new Recipe(recipe, ingredients, recipeIngredients);

            action();
        }
        public Recipe(
            IDataRecipe recipe,
            List <IDataIngredient> ingredients,
            List <IDataRecipeIngredient> recipeIngredients)
        {
            if (recipe == null)
            {
                throw new ArgumentNullException("recipe");                 //nameof(recipe)
            }
            if (ingredients == null)
            {
                throw new ArgumentNullException("ingredients");                 //nameof(ingredients)
            }
            if (!ingredients.Any())
            {
                throw new ArgumentException("'ingredients' is empty.", "ingredients");
            }

            if (recipeIngredients == null)
            {
                throw new ArgumentNullException("recipeIngredients");                 //nameof(recipeIngredients)
            }
            if (!recipeIngredients.Any())
            {
                throw new ArgumentException("'recipeIngredients' is empty.", "recipeIngredients");
            }

            // Build recipe list.
            var recipeItems = new List <IIngredient>();

            foreach (var recipeIngredient in recipeIngredients)
            {
                var dataIngredient = ingredients.Single(m => m.Id == recipeIngredient.IngredientId);                 //I'm being lazy...
                var recipeItem     = new Ingredient(
                    amount: recipeIngredient.Amount,
                    foodItem: new FoodItem(dataIngredient)
                    );
                recipeItems.Add(recipeItem);
            }

            this.name        = recipe.Name;
            this.ingredients = recipeItems;
        }