Example #1
0
        public IConversionResult DoConversion(IUnitOfMeasure fromUnit, IUnitOfMeasure toUnit, decimal value)
        {
            if (fromUnit == null || toUnit == null || Type != fromUnit.GetUnitConversionType() || Type != toUnit.GetUnitConversionType())
            {
                throw new IncompatibleConversionException(this.Type.ToString(), _fromUnitDesc, _toUnitDesc);
            }

            return(fromUnit.ConvertTo(value, toUnit));
        }