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);
        }
Exemple #2
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);
        }