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;
            }
        }
Example #2
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);
            }
        }