Exemplo n.º 1
0
 /// <summary>Gets the compatible Measure Unit of two unit prices</summary>
 /// <exception cref = "PriceException">Thrown when measure units are not equal</exception>
 public static MeasureUnit GetMeasureUnit(UnitPrice p1, UnitPrice p2) =>
 !CompatibleMeasureUnits(p1, p2) ? throw new PriceException(PriceException.MEASURE_UNITS_NOT_EQUAL) :
       p1 != null ? p1.MeasureUnit : p2?.MeasureUnit;
Exemplo n.º 2
0
 /// <summary>Checks if unit prices have compatible Measure Units</summary>
 public static bool CompatibleMeasureUnits(UnitPrice p1, UnitPrice p2) =>
 Z(p1).IsZero || Z(p2).IsZero || p1.MeasureUnit == p2.MeasureUnit;