Exemplo n.º 1
0
        public bool Equals(ShipmentQuantity other)
        {
            if (this.Units == other.Units)
            {
                return(this.Quantity == other.Quantity);
            }

            try
            {
                var quantity = ShipmentQuantityUnitConverter.ConvertToTarget(other.Units, this.Units, other.Quantity);
                return(this.Quantity == quantity);
            }
            catch (ArgumentException)
            {
                return(false);
            }
            catch (InvalidOperationException)
            {
                return(false);
            }
        }
Exemplo n.º 2
0
        public static bool operator >(ShipmentQuantity x, ShipmentQuantity y)
        {
            var quantity = ShipmentQuantityUnitConverter.ConvertToTarget(y.Units, x.Units, y.Quantity);

            return(x.Quantity > quantity);
        }
Exemplo n.º 3
0
        public static ShipmentQuantity operator -(ShipmentQuantity x, ShipmentQuantity y)
        {
            var quantity = ShipmentQuantityUnitConverter.ConvertToTarget(y.Units, x.Units, y.Quantity);

            return(new ShipmentQuantity(x.Quantity - quantity, x.Units));
        }