internal void ParseIngredients() { var parser = new IngredientsParser(); List <IngredientsParser.ParsedAnnotation> annotations = new List <IngredientsParser.ParsedAnnotation>(); var _parsedIngredients = parser.Parse(_currentProduct.DisplayIngredients, annotations); var translator = new IngredientLanguageNames(_repo); var nutrientTranslator = new NutrientLanguageNames(_repo); var euNumbers = new EUAdditiveLanguageNames(_repo); foreach (var parsedIngredient in _parsedIngredients.Ingredients) { Product.Ingredients.Add(new IngredientViewModel(parsedIngredient, Product)); } var additives = DetectEUNumbers(_parsedIngredients.Ingredients, euNumbers).OrderBy(w => w.EUNumber); foreach (var additive in additives) { Product.EUAdditives.Add(new EUAdditiveViewModel(additive.EUNumber, additive.DisplayName)); } var allergens = CollectAllergens(_parsedIngredients.Ingredients); foreach (var allergen in allergens) { Product.Allergens.Add(new AllergenViewModel(allergen.Name, allergen.DisplayName)); } ProcessNutrients(); Product.Translate(); }
public IncredientsParserTests() { _parser = new IngredientsParser(); }