Exemplo n.º 1
0
        public EditRecipeViewModel(IEventAggregator eventAggregator, IStockItemsViewModel stockItemsViewModel, IRecipeRepository recipeRepository)
        {
            this._recipeRepository = recipeRepository;
            StockItemsViewModel = stockItemsViewModel;

            VolumeUnits = new List<VolumeUnit> { VolumeUnit.Litres, VolumeUnit.Gallons };
            _recipe = new Recipe();
            _recipe.SetBrewLength(20.Litres());

            eventAggregator.GetEvent<AddHopToRecipeEvent>().Subscribe(AddHop);
            eventAggregator.GetEvent<AddFermentableToRecipeEvent>().Subscribe(AddFermentable);
        }
Exemplo n.º 2
0
        public void ShouldCalculateBuGuRatioAsZeroIfNoHops()
        {
            var grain1 = new StockFermentable("Wheat", 1.045M);
            var recipe = new Recipe();

            recipe.SetBrewLength(1.Gallons());
            recipe.AddFermentable(grain1, 1.Pound(), 1.045M);

            Assert.AreEqual(0M, recipe.GetBuGuRatio());
        }
Exemplo n.º 3
0
        private static Recipe SimpleRecipe()
        {
            var grain1 = new StockFermentable("Wheat", 1.045M);
            var hop = new Hop("Saaz");
            var recipe = new Recipe();

            recipe.SetBrewLength(1.Gallons());
            recipe.AddFermentable(grain1, 1.Pound(), 1.045M);
            recipe.AddHop(hop, new Weight(10M, MassUnit.Grams), 60, 12.5M);
            return recipe;
        }
Exemplo n.º 4
0
        public void ShouldSetBrewLength()
        {
            var recipe = new Recipe();
            recipe.SetBrewLength(new Volume(100, VolumeUnit.Litres));

            Assert.AreEqual(new Volume(100, VolumeUnit.Litres), recipe.GetBrewLength());
        }
Exemplo n.º 5
0
        public void ShouldCalculateStartingGravityWithMultipleGrains()
        {
            var grain1 = new StockFermentable("Wheat", 1.045M);
            var grain2 = new StockFermentable("Honey", 1.045M);
            var grain3 = new StockFermentable("Two-row", 1.046M);

            var recipe = new Recipe();
            recipe.SetBrewLength(new Volume(3M, VolumeUnit.Gallons));
            recipe.AddFermentable(grain1, new Weight(1M, MassUnit.Pounds), 1.045M);
            recipe.AddFermentable(grain2, new Weight(1M, MassUnit.Pounds), 1.045M);
            recipe.AddFermentable(grain3, new Weight(1M, MassUnit.Pounds), 1.046M);

            Assert.AreEqual(1.045M, recipe.GetStartingGravity());
        }
Exemplo n.º 6
0
        public void ShouldCalculateStartingGravity()
        {
            var grain1 = new StockFermentable("Wheat", 1.035M);

            var recipe = new Recipe();
            recipe.SetBrewLength(new Volume(1, VolumeUnit.Gallons));
            recipe.AddFermentable(grain1, new Weight(1, MassUnit.Pounds), 1.045M);

            Assert.AreEqual(1.045M, recipe.GetStartingGravity());
        }