Esempio n. 1
0
        private ConvertMethod LocateMethod(Helper.Units from, Helper.Units to)
        {
            switch (from)
            {
            case Helper.Units.Celsius:
                switch (to)
                {
                case Helper.Units.Fahrenheit:
                    return(new ConvertMethod(CelciusToFahrenheit));

                default:
                    throw new UnitArgumentException(to);
                }

            case Helper.Units.Fahrenheit:
                switch (to)
                {
                case Helper.Units.Celsius:
                    return(new ConvertMethod(CelciusToFahrenheit));

                default:
                    throw new UnitArgumentException(to);
                }

            default:
                throw new UnitArgumentException(from);
            }
        }
Esempio n. 2
0
        private ConvertMethod LocateMethod(Helper.Units from, Helper.Units to)
        {
            switch (from)
            {
            case Helper.Units.Meters:
                switch (to)
                {
                case Helper.Units.Feet:
                    return(new ConvertMethod(MetersToFeet));

                default:
                    throw new UnitArgumentException(to);
                }

            default:
                throw new UnitArgumentException(from);
            }
        }
Esempio n. 3
0
 override public double CalculateExpect(int input, Helper.Units from, Helper.Units to, int fractionLength)
 {
     return(Math.Round(LocateMethod(from, to)(input), fractionLength));
 }
Esempio n. 4
0
 public UnitArgumentException(Helper.Units unit) : base(Enum.GetName(typeof(Helper.Units), unit) + " unit is not supported")
 {
 }
Esempio n. 5
0
 override public double CalculateExpect(int input, Helper.Units from, Helper.Units to, int fractionLength)
 {
     return(Math.Round(OuncesToGrams(input), fractionLength));
 }
Esempio n. 6
0
 public abstract double CalculateExpect(int input, Helper.Units from, Helper.Units to, int fractionLength);
Esempio n. 7
0
        public void SetUnits(Helper.Units from, Helper.Units to)
        {
            SeleniumProcesses.Instance.SetTextBoxValue(fromUnit, Enum.GetName(typeof(Helper.Units), from));

            SeleniumProcesses.Instance.SetTextBoxValue(toUnit, Enum.GetName(typeof(Helper.Units), to));
        }