예제 #1
0
        public void ApplyFermenterToRecipe()
        {
            RecipeFactory     myFactory           = new RecipeFactory();
            IRecipe           myRecipe            = myFactory.GetRecipe(RecipeTypes.Beer);
            IngredientFactory myIngredientFactory = new IngredientFactory();
            var ingredient = myIngredientFactory.GetIngredient(IngredientType.Fermentable);

            ingredient.Amount = 10;
            (ingredient as IFermentable).DiastaticPower = 1.04;
            myRecipe.Ingredients.Add(ingredient);
            myRecipe.BatchVolume            = 6.5;
            myRecipe.TotalEfficiencyPercent = 70;
            var og = myRecipe.GetEstimatedOriginalGravity();

            Assert.AreEqual(myRecipe.Fermentables.Count, 1);
            Assert.AreEqual(Math.Round(og, 3), 1.043);
            ingredient = myIngredientFactory.GetIngredient(IngredientType.Fermenter);
            (ingredient as IFerment).PitchType   = FermenterPitchType.Dry;
            (ingredient as IFerment).Attenuation = 75;
            myRecipe.Ingredients.Add(ingredient);
            var fg = myRecipe.GetEstimatedFinalGravity();

            Assert.AreEqual(Math.Round(fg, 3), 1.011);
        }