private bool ValidateDrinkName(string drinkName, out string errorMessage) { var drinkInfo = _drinkInfoQuery.GetDrinkInfo(drinkName); if (drinkInfo == null) { errorMessage = $"{ErrorPrefix} Requested drink ( {drinkName} ) is not available"; return(false); } errorMessage = ""; return(true); }
public Drink Prepare(string drinkName, IList <string> selectedTopicNames, out string preparationResult) { if (!_drinkValidator.ValidateDrinkParameters(drinkName, selectedTopicNames, out preparationResult)) { return(null); } var drinkInfo = _drinkInfoQuery.GetDrinkInfo(drinkName); Drink drink = _simpleDrinkFactory.Create(drinkInfo); var topics = drinkInfo.AllowedTopics.Where(x => selectedTopicNames.Contains(x.Name)); drink = AddTopicsToDrink(drink, topics); preparationResult = $"{SuccessPrefix} {drink.Description}"; return(drink); }