Exemplo n.º 1
0
        /// <summary>
        /// Returns true if Product instances are equal
        /// </summary>
        /// <param name="other">Instance of Product to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Product other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     ProductId == other.ProductId ||
                     ProductId != null &&
                     ProductId.Equals(other.ProductId)
                     ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     ProductNumber == other.ProductNumber ||
                     ProductNumber != null &&
                     ProductNumber.Equals(other.ProductNumber)
                 ) &&
                 (
                     Color == other.Color ||
                     Color != null &&
                     Color.Equals(other.Color)
                 ) &&
                 (
                     StandardCost == other.StandardCost ||
                     StandardCost != null &&
                     StandardCost.Equals(other.StandardCost)
                 ) &&
                 (
                     ListPrice == other.ListPrice ||
                     ListPrice != null &&
                     ListPrice.Equals(other.ListPrice)
                 ) &&
                 (
                     Size == other.Size ||
                     Size != null &&
                     Size.Equals(other.Size)
                 ) &&
                 (
                     Weight == other.Weight ||
                     Weight != null &&
                     Weight.Equals(other.Weight)
                 ) &&
                 (
                     ProductLine == other.ProductLine ||
                     ProductLine != null &&
                     ProductLine.Equals(other.ProductLine)
                 ) &&
                 (
                     Class == other.Class ||
                     Class != null &&
                     Class.Equals(other.Class)
                 ) &&
                 (
                     Style == other.Style ||
                     Style != null &&
                     Style.Equals(other.Style)
                 ) &&
                 (
                     SubCategory == other.SubCategory ||
                     SubCategory != null &&
                     SubCategory.Equals(other.SubCategory)
                 ) &&
                 (
                     Model == other.Model ||
                     Model != null &&
                     Model.Equals(other.Model)
                 ) &&
                 (
                     Photo == other.Photo ||
                     Photo != null &&
                     Photo.Equals(other.Photo)
                 ) &&
                 (
                     Review == other.Review ||
                     Review != null &&
                     Review.SequenceEqual(other.Review)
                 ));
        }