Exemplo n.º 1
0
        public RoundTripTableItem Clone()
        {
            RoundTripTableItem result = new RoundTripTableItem
            {
                Bool1    = this.Bool1,
                Date1    = this.Date1,
                Double1  = this.Double1,
                EnumType = this.EnumType,
                Int1     = this.Int1,
                Long1    = this.Long1,
                String1  = this.String1,
            };

            if (this.ComplexType1 != null)
            {
                result.ComplexType1 = this.ComplexType1.Select(ct => ct == null ? null : ct.Clone()).ToArray();
            }

            if (this.ComplexType2 != null)
            {
                result.ComplexType2 = this.ComplexType2.Clone();
            }

            return(result);
        }
Exemplo n.º 2
0
        public override bool Equals(object obj)
        {
            const double       acceptableDifference = 1e-6;
            RoundTripTableItem other = obj as RoundTripTableItem;

            if (other == null)
            {
                return(false);
            }
            if (!this.Bool1.Equals(other.Bool1))
            {
                return(false);
            }
            if (!Util.CompareArrays(this.ComplexType1, other.ComplexType1))
            {
                return(false);
            }
            if ((this.ComplexType2 == null) != (other.ComplexType2 == null))
            {
                return(false);
            }
            if (this.Date1.HasValue != other.Date1.HasValue)
            {
                return(false);
            }
            if (this.Date1.HasValue && !this.Date1.Value.ToUniversalTime().Equals(other.Date1.Value.ToUniversalTime()))
            {
                return(false);
            }
            if (Math.Abs(this.Double1 - other.Double1) > acceptableDifference)
            {
                return(false);
            }
            if (!this.EnumType.Equals(other.EnumType))
            {
                return(false);
            }
            if (!this.Int1.Equals(other.Int1))
            {
                return(false);
            }
            if (!this.Long1.Equals(other.Long1))
            {
                return(false);
            }
            if (this.String1 != other.String1)
            {
                return(false);
            }
            return(true);
        }