예제 #1
0
		public void Init()
		{
			exchangeItem = new ExchangeItem();
			exchangeItem.Quantity = new Quantity("Q");
			ElementSet elementSet = new ElementSet();
			elementSet.ID = "ES";
			exchangeItem.ElementSet = elementSet;
		}
예제 #2
0
        ///<summary>
        /// Check if the current instance equals another instance of this class.
        ///</summary>
        ///<param name="obj">The instance to compare the current instance with.</param>
        ///<returns><code>true</code> if the instances are the same instance or have the same content.</returns>
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }
            ExchangeItem item = (ExchangeItem)obj;

            return(item.Quantity.Equals(Quantity) &&
                   item.ElementSet.Equals(ElementSet));
        }
예제 #3
0
		public void Equals()
		{
			ExchangeItem exchangeItem = new ExchangeItem();
			exchangeItem.Quantity = new Quantity("Q");
			ElementSet elementSet = new ElementSet();
			elementSet.ID = "ES";
			exchangeItem.ElementSet = elementSet;

			Assert.IsTrue(exchangeItem.Equals(this.exchangeItem));

			exchangeItem.Quantity = new Quantity("Q1");
			Assert.IsFalse(exchangeItem.Equals(this.exchangeItem));
			exchangeItem.Quantity = new Quantity("Q");
			elementSet.ID = "ES2";

			Assert.IsFalse(exchangeItem.Equals(this.exchangeItem));
			Assert.IsFalse(exchangeItem.Equals(null));
			Assert.IsFalse(exchangeItem.Equals("string"));
		}