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); } }
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); } }
override public double CalculateExpect(int input, Helper.Units from, Helper.Units to, int fractionLength) { return(Math.Round(LocateMethod(from, to)(input), fractionLength)); }
public UnitArgumentException(Helper.Units unit) : base(Enum.GetName(typeof(Helper.Units), unit) + " unit is not supported") { }
override public double CalculateExpect(int input, Helper.Units from, Helper.Units to, int fractionLength) { return(Math.Round(OuncesToGrams(input), fractionLength)); }
public abstract double CalculateExpect(int input, Helper.Units from, Helper.Units to, int fractionLength);
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)); }