public static Either <string, IngredientsCount> Wrap(IngredientsCount ingredients) { return(new IngredientsCount { AppleCount = $@"{ingredients.AppleCount};+wrapping for N apples;" }); }
public static Either <string, IngredientsCount> AddToffee(IngredientsCount ingredients) { return(new IngredientsCount { AppleCount = $@"{ingredients.AppleCount}; +toffee for N apples " }); }
public static ToffeeAppleProduct toToffeeAppleProduct(IngredientsCount ingredients) { return(new ToffeeAppleProduct { ApplesCount = ingredients.ApplesCount, }); }
public static Either <string, IngredientsCount> Prep(IngredientsCount ingredients) { return(new IngredientsCount { AppleCount = ingredients.AppleCount.Trim(), ApplesCount = Convert.ToInt32(ingredients.AppleCount.Trim()), }); }
private Either <string, IngredientsCount> CreateToffeeAppleRequestForStringQ(string appleCount) { Either <string, IngredientsCount> ingredients = new IngredientsCount { AppleCount = appleCount }; return(ingredients); }
public void AddIngredients(string[] ingredients) { Occurances++; foreach (var ing in ingredients) { if (IngredientsCount.ContainsKey(ing)) { IngredientsCount[ing] += 1; } else { IngredientsCount[ing] = 1; } } }
public static Either <string, IngredientsCount> Validate(IngredientsCount ingredientsCount) { if (string.IsNullOrWhiteSpace(ingredientsCount.AppleCount)) { return("is null or empty!"); } try { var appleCount = Convert.ToInt32(ingredientsCount.AppleCount.Trim()); } catch { return("AppleCount cannot be converted to a number!"); } return(ingredientsCount); }