Example #1
0
        private bool isOverExchangePricesNotNull(ExchangePrices ep)
        {
            if (ep != null)
            {
                return(true);
            }

            return(false);
        }
Example #2
0
        public override bool Equals(object obj)
        {
            ExchangePrices other = obj as ExchangePrices;

            //if(other == null) return false;

            //if(AvailableToBack.Count != other.AvailableToBack.Count) return false;
            //if(AvailableToLay.Count  != other.AvailableToLay.Count)  return false;

            //for(int i = 0; i < AvailableToBack.Count; i++)
            //{
            //    if(AvailableToBack[i] != other.AvailableToBack[i])
            //        return false;
            //}

            //for(int i = 0; i < AvailableToLay.Count; i++)
            //{
            //    if(AvailableToLay[i] != other.AvailableToLay[i])
            //        return false;
            //}

            //return true;

            bool otherIsNotNull = isOverExchangePricesNotNull(other);

            if (!otherIsNotNull)
            {
                return(false);
            }

            bool availableToBackCountsAreEqual = isOverExchangePricesHasEqualCount(AvailableToBack.Count, other.AvailableToBack.Count);
            bool availableToLayCountsAreEqual  = isOverExchangePricesHasEqualCount(AvailableToLay.Count, other.AvailableToLay.Count);

            if (!availableToBackCountsAreEqual || !availableToLayCountsAreEqual)
            {
                return(false);
            }

            bool availableToBackPriceSizesAreEqual = isPriceSizeCollectionsEqual(AvailableToBack, other.AvailableToBack);
            bool availableToLayPriceSizesAreEqual  = isPriceSizeCollectionsEqual(AvailableToLay, other.AvailableToLay);

            if (!availableToBackPriceSizesAreEqual || !availableToLayPriceSizesAreEqual)
            {
                return(false);
            }

            return(true);
        }