コード例 #1
0
        public double CalculateWaterNeededExtract(ICalculateWaterNeededExtract extractData)
        {
            double ltt              = extractData.LossToTrubInGallons;
            double tup              = extractData.TopUpWaterInGallons;
            double dfv              = extractData.DesiredFinalVolumeInGallons;
            double coolingLoss      = extractData.GetCoolingLossInGallons();
            double X1               = (dfv - tup + ltt) * (extractData.EvaporationRatePercent / 100) * ((double)extractData.BoilTimeInMinutes / 60);
            double X2               = (X1 + coolingLoss) + (((X1 + coolingLoss) * (extractData.EvaporationRatePercent / 100) * (double)extractData.BoilTimeInMinutes / 60));
            double totalWaterNeeded = dfv + X2 + ltt;

            return(Math.Round(totalWaterNeeded, 2));
        }
コード例 #2
0
        public void WaterNeededExtractCalculation_Passes()
        {
            ICalculateWaterNeededExtractFactory waterNeededFactory           = new CalculateWaterNeededExtractFactory();
            ICalculateWaterNeededExtract        waterNeededExtractCalculator = waterNeededFactory.GetCalculator(new CalculateWaterNeededExtractStrategy());

            waterNeededExtractCalculator.BoilTimeInMinutes           = 60;
            waterNeededExtractCalculator.DesiredFinalVolumeInGallons = 6;
            waterNeededExtractCalculator.EvaporationRatePercent      = 12.79;
            waterNeededExtractCalculator.LossToTrubInGallons         = 0.5;
            waterNeededExtractCalculator.MashWaterVolumeInQuarts     = 16;
            waterNeededExtractCalculator.TopUpWaterInGallons         = 0;
            waterNeededExtractCalculator.GetCoolingLossInGallons();
            var totalWaterNeeded = waterNeededExtractCalculator.Calculate();

            Assert.AreEqual(7.72, totalWaterNeeded);
        }