コード例 #1
0
        public void Parse_converts_a_string_into_ingredient()
        {
            var ingredient = _parser.Parse("1 cup flour");

            ingredient.Should().NotBeNull();
            ingredient.Name.Should().Be("flour");
            ingredient.Quantity.Should().Be(1);
            ingredient.Unit.Should().Be(Unit.Cup);
        }
コード例 #2
0
ファイル: Recipe.cs プロジェクト: JoelViney/CoreCooking
        /// <summary>Generates the Ingredients and Steps</summary>
        public void ProcessRecipe()
        {
            this.Steps = new List <string>();
            if (!String.IsNullOrEmpty(this.StepsText))
            {
                string[] lines = this.StepsText.Split(new string[] { "\n", "\r\n" }, StringSplitOptions.None);
                this.Steps = new List <string>(lines);
            }

            IngredientParser parser = new IngredientParser();

            this.Ingredients = parser.Parse(this.IngredientsText);
        }