public void CalculateBoilOff_Passes()
        {
            ICalculateBoilOffFactory calculatorFactory = new CalculateBoilOffFactory();
            ICalculateBoilOff        calculator        = calculatorFactory.GetCalculator(new BoilOffStrategy());

            calculator.BoilTimeInMinutes        = 60;
            calculator.StartingVolumeInGallons  = 5;
            calculator.EvaporationRateInPercent = 4;
            var boiledOffVolumeInGalls = calculator.Calculate();

            Assert.AreEqual(0.2, boiledOffVolumeInGalls);
        }
Пример #2
0
        public void FinalVolumeCalculation_Passes()
        {
            ICalculateBoilOffFactory volumeCalculationFactory = new CalculateBoilOffFactory();
            var calculator = volumeCalculationFactory.GetCalculator(new FinalVolumeStrategy());

            //possibly should abstract this out further in to a Filter in case people want different parameters in boil off calculation.
            calculator.BoilOffInGallons = .2;
            calculator.LossFromCoolingShrinkageInGallons = .192;
            calculator.StartingVolumeInGallons           = 5;
            var finalVolume = calculator.Calculate();

            Assert.AreEqual(finalVolume, 4.608);
        }
Пример #3
0
        public void CalculateVolumeShrinkageFromCooling_Passes()
        {
            ICalculateBoilOffFactory boilCalculatorFactory = new CalculateBoilOffFactory();
            ICalculateBoilOff        boilCalculator        = boilCalculatorFactory.GetCalculator(new BoilOffStrategy());

            boilCalculator.BoilTimeInMinutes        = 60;
            boilCalculator.StartingVolumeInGallons  = 5;
            boilCalculator.EvaporationRateInPercent = 4;
            var boiledOffVolumeInGalls = boilCalculator.Calculate();

            Assert.AreEqual(0.2, boiledOffVolumeInGalls);

            ICalculateVolumeShrinkageFromCoolingFactory calculatorFactory = new CalculateVolumeShrinkageFromCoolingFactory();
            ICalculateVolumeShrinkageFromCooling        calculator        = calculatorFactory.GetCalculator(new VolumeShrinkageFromCoolingStrategy());

            calculator.VolumeAfterBoilOff      = 5 - boiledOffVolumeInGalls;
            calculator.StartingVolumeInGallons = 5;
            calculator.CoolingLossInPercent    = 4;
            var shrinkageFromCoolingInGals = calculator.Calculate();

            Assert.AreEqual(0.192, shrinkageFromCoolingInGals);
        }