Ejemplo n.º 1
0
        public void HashCode()
        {
            var thickness1 = new Thickness();
            var thickness2 = new Thickness();
            var thickness3 = new Thickness(1.0, 2.0, 3.0, 4.0);
            var thickness4 = new Thickness(1.0, 2.0, 3.0, 4.0);

            Assert.AreEqual(thickness1.GetHashCode(), thickness2.GetHashCode());
            Assert.AreNotEqual(thickness1.GetHashCode(), thickness3.GetHashCode());
            Assert.AreEqual(thickness3.GetHashCode(), thickness4.GetHashCode());
        }
Ejemplo n.º 2
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         if (Visible != null)
         {
             hashCode = hashCode * 59 + Visible.GetHashCode();
         }
         if (Side != null)
         {
             hashCode = hashCode * 59 + Side.GetHashCode();
         }
         if (EdgeShape != null)
         {
             hashCode = hashCode * 59 + EdgeShape.GetHashCode();
         }
         if (Thickness != null)
         {
             hashCode = hashCode * 59 + Thickness.GetHashCode();
         }
         if (TextFont != null)
         {
             hashCode = hashCode * 59 + TextFont.GetHashCode();
         }
         return(hashCode);
     }
 }
Ejemplo n.º 3
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         if (Color != null)
         {
             hashCode = hashCode * 59 + Color.GetHashCode();
         }
         if (Line != null)
         {
             hashCode = hashCode * 59 + Line.GetHashCode();
         }
         if (Thickness != null)
         {
             hashCode = hashCode * 59 + Thickness.GetHashCode();
         }
         if (Range != null)
         {
             hashCode = hashCode * 59 + Range.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (TemplateItemName != null)
         {
             hashCode = hashCode * 59 + TemplateItemName.GetHashCode();
         }
         return(hashCode);
     }
 }
 public override int GetHashCode()
 {
     unchecked {
         int result = (backgroundBrush != null ? backgroundBrush.GetHashCode() : 0);
         result = (result * 397) ^ (insetBrush != null ? insetBrush.GetHashCode() : 0);
         result = (result * 397) ^ (borderBrush != null ? borderBrush.GetHashCode() : 0);
         result = (result * 397) ^ borderThickness.GetHashCode();
         return(result);
     }
 }
Ejemplo n.º 5
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Radius.GetHashCode();
         hashCode = (hashCode * 397) ^ Thickness.GetHashCode();
         hashCode = (hashCode * 397) ^ Weight.GetHashCode();
         return(hashCode);
     }
 }
Ejemplo n.º 6
0
 public void Equals_Object_ReturnsExpected(Thickness thickness, object other, bool expected)
 {
     Assert.Equal(expected, thickness.Equals(other));
     if (other is Thickness otherThickness)
     {
         Assert.Equal(expected, thickness.Equals(otherThickness));
         Assert.Equal(expected, thickness == otherThickness);
         Assert.Equal(!expected, thickness != otherThickness);
         Assert.Equal(expected, thickness.GetHashCode().Equals(otherThickness.GetHashCode()));
     }
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Computes the HashCode for the instance.
        /// </summary>
        /// <returns>The HashCode for the instance.</returns>
        private int ComputeHashCode()
        {
            var hashCode = 754997215;

            unchecked
            {
                hashCode = hashCode * -1521134295 + Color.GetHashCode();
                hashCode = hashCode * -1521134295 + Thickness.GetHashCode();
                hashCode = hashCode * -1521134295 + ComputeDashArrayHashCode(DashArray);
                hashCode = hashCode * -1521134295 + LineJoin.GetHashCode();
            }

            return(hashCode);
        }
Ejemplo n.º 8
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = Thickness.GetHashCode();
         hashCode = (hashCode * 397) ^ (StrokeColor != null ? StrokeColor.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (DashStyle != null ? DashStyle.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ DashCap.GetHashCode();
         hashCode = (hashCode * 397) ^ StartLineCap.GetHashCode();
         hashCode = (hashCode * 397) ^ EndLineCap.GetHashCode();
         hashCode = (hashCode * 397) ^ LineJoin.GetHashCode();
         return(hashCode);
     }
 }
Ejemplo n.º 9
0
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                int hashCode = 41;

                if (BgColor != null)
                {
                    hashCode = hashCode * 59 + BgColor.GetHashCode();
                }

                if (BorderColor != null)
                {
                    hashCode = hashCode * 59 + BorderColor.GetHashCode();
                }

                if (BorderWidth != null)
                {
                    hashCode = hashCode * 59 + BorderWidth.GetHashCode();
                }

                if (AutoRange != null)
                {
                    hashCode = hashCode * 59 + AutoRange.GetHashCode();
                }

                if (Range != null)
                {
                    hashCode = hashCode * 59 + Range.GetHashCode();
                }

                if (Thickness != null)
                {
                    hashCode = hashCode * 59 + Thickness.GetHashCode();
                }

                if (Visible != null)
                {
                    hashCode = hashCode * 59 + Visible.GetHashCode();
                }

                if (YAxis != null)
                {
                    hashCode = hashCode * 59 + YAxis.GetHashCode();
                }

                return(hashCode);
            }
        }
Ejemplo n.º 10
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         if (Line != null)
         {
             hashCode = hashCode * 59 + Line.GetHashCode();
         }
         if (Thickness != null)
         {
             hashCode = hashCode * 59 + Thickness.GetHashCode();
         }
         if (Value != null)
         {
             hashCode = hashCode * 59 + Value.GetHashCode();
         }
         return(hashCode);
     }
 }
Ejemplo n.º 11
0
        public void ThicknessesTest()
        {
            var thickness = new Thickness(1.0);             // 1.0 96th of inch on all 4 sides

            Assert.AreEqual(1.0, thickness.Leading);
            Assert.AreEqual(1.0, thickness.Top);
            Assert.AreEqual(1.0, thickness.Trailing);
            Assert.AreEqual(1.0, thickness.Bottom);

            var thickness2 = new Thickness(1.0, 2.0, 3.0, 4.0);             // 1.0 96th of inch on all 4 sides

            Assert.AreEqual(1.0, thickness2.Leading);
            Assert.AreEqual(2.0, thickness2.Top);
            Assert.AreEqual(3.0, thickness2.Trailing);
            Assert.AreEqual(4.0, thickness2.Bottom);

            Assert.IsFalse(thickness2.Equals(thickness));

            var thickness3 = new Thickness(1.0, 2.0, 3.0, 4.0);             // same as thickness2

            Assert.IsTrue(thickness2.Equals(thickness3));
            Assert.IsTrue(thickness3.Equals(thickness2));

            Assert.IsFalse(thickness.Equals(new Thickness(100.0, 1.0, 1.0, 1.0)));
            Assert.IsFalse(thickness.Equals(new Thickness(1.0, 1.3, 1.0, 1.0)));
            Assert.IsFalse(thickness.Equals(new Thickness(1.0, 1.0, 1.01, 1.0)));
            Assert.IsFalse(thickness.Equals(new Thickness(1.0, 1.0, 1.0, 1.0001)));

            Assert.IsTrue(thickness3.GetHashCode() == thickness2.GetHashCode());

            Assert.IsFalse(thickness2.Equals(34));
            object temp = thickness3;

            Assert.IsTrue(thickness2.Equals(temp));

            Assert.IsTrue(thickness2 == thickness3);
            Assert.IsFalse(thickness2 != thickness3);

            Assert.IsTrue(thickness != thickness3);
            Assert.IsFalse(thickness == thickness3);
        }
Ejemplo n.º 12
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         if (ThicknessMode != null)
         {
             hashCode = hashCode * 59 + ThicknessMode.GetHashCode();
         }
         if (Thickness != null)
         {
             hashCode = hashCode * 59 + Thickness.GetHashCode();
         }
         if (LenMode != null)
         {
             hashCode = hashCode * 59 + LenMode.GetHashCode();
         }
         if (Len != null)
         {
             hashCode = hashCode * 59 + Len.GetHashCode();
         }
         if (X != null)
         {
             hashCode = hashCode * 59 + X.GetHashCode();
         }
         if (XAnchor != null)
         {
             hashCode = hashCode * 59 + XAnchor.GetHashCode();
         }
         if (XPad != null)
         {
             hashCode = hashCode * 59 + XPad.GetHashCode();
         }
         if (Y != null)
         {
             hashCode = hashCode * 59 + Y.GetHashCode();
         }
         if (YAnchor != null)
         {
             hashCode = hashCode * 59 + YAnchor.GetHashCode();
         }
         if (YPad != null)
         {
             hashCode = hashCode * 59 + YPad.GetHashCode();
         }
         if (OutlineColor != null)
         {
             hashCode = hashCode * 59 + OutlineColor.GetHashCode();
         }
         if (OutlineWidth != null)
         {
             hashCode = hashCode * 59 + OutlineWidth.GetHashCode();
         }
         if (BorderColor != null)
         {
             hashCode = hashCode * 59 + BorderColor.GetHashCode();
         }
         if (BorderWidth != null)
         {
             hashCode = hashCode * 59 + BorderWidth.GetHashCode();
         }
         if (BgColor != null)
         {
             hashCode = hashCode * 59 + BgColor.GetHashCode();
         }
         if (TickMode != null)
         {
             hashCode = hashCode * 59 + TickMode.GetHashCode();
         }
         if (NTicks != null)
         {
             hashCode = hashCode * 59 + NTicks.GetHashCode();
         }
         if (Tick0 != null)
         {
             hashCode = hashCode * 59 + Tick0.GetHashCode();
         }
         if (DTick != null)
         {
             hashCode = hashCode * 59 + DTick.GetHashCode();
         }
         if (TickVals != null)
         {
             hashCode = hashCode * 59 + TickVals.GetHashCode();
         }
         if (TickText != null)
         {
             hashCode = hashCode * 59 + TickText.GetHashCode();
         }
         if (Ticks != null)
         {
             hashCode = hashCode * 59 + Ticks.GetHashCode();
         }
         if (TickLen != null)
         {
             hashCode = hashCode * 59 + TickLen.GetHashCode();
         }
         if (TickWidth != null)
         {
             hashCode = hashCode * 59 + TickWidth.GetHashCode();
         }
         if (TickColor != null)
         {
             hashCode = hashCode * 59 + TickColor.GetHashCode();
         }
         if (ShowTickLabels != null)
         {
             hashCode = hashCode * 59 + ShowTickLabels.GetHashCode();
         }
         if (TickFont != null)
         {
             hashCode = hashCode * 59 + TickFont.GetHashCode();
         }
         if (TickAngle != null)
         {
             hashCode = hashCode * 59 + TickAngle.GetHashCode();
         }
         if (TickFormat != null)
         {
             hashCode = hashCode * 59 + TickFormat.GetHashCode();
         }
         if (TickFormatStops != null)
         {
             hashCode = hashCode * 59 + TickFormatStops.GetHashCode();
         }
         if (TickPrefix != null)
         {
             hashCode = hashCode * 59 + TickPrefix.GetHashCode();
         }
         if (ShowTickPrefix != null)
         {
             hashCode = hashCode * 59 + ShowTickPrefix.GetHashCode();
         }
         if (TickSuffix != null)
         {
             hashCode = hashCode * 59 + TickSuffix.GetHashCode();
         }
         if (ShowTickSuffix != null)
         {
             hashCode = hashCode * 59 + ShowTickSuffix.GetHashCode();
         }
         if (SeparateThousands != null)
         {
             hashCode = hashCode * 59 + SeparateThousands.GetHashCode();
         }
         if (ExponentFormat != null)
         {
             hashCode = hashCode * 59 + ExponentFormat.GetHashCode();
         }
         if (MinExponent != null)
         {
             hashCode = hashCode * 59 + MinExponent.GetHashCode();
         }
         if (ShowExponent != null)
         {
             hashCode = hashCode * 59 + ShowExponent.GetHashCode();
         }
         if (Title != null)
         {
             hashCode = hashCode * 59 + Title.GetHashCode();
         }
         if (TickValsSrc != null)
         {
             hashCode = hashCode * 59 + TickValsSrc.GetHashCode();
         }
         if (TickTextSrc != null)
         {
             hashCode = hashCode * 59 + TickTextSrc.GetHashCode();
         }
         return(hashCode);
     }
 }
Ejemplo n.º 13
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         if (Visible != null)
         {
             hashCode = hashCode * 59 + Visible.GetHashCode();
         }
         if (Type != null)
         {
             hashCode = hashCode * 59 + Type.GetHashCode();
         }
         if (Symmetric != null)
         {
             hashCode = hashCode * 59 + Symmetric.GetHashCode();
         }
         if (Array != null)
         {
             hashCode = hashCode * 59 + Array.GetHashCode();
         }
         if (ArrayMinus != null)
         {
             hashCode = hashCode * 59 + ArrayMinus.GetHashCode();
         }
         if (Value != null)
         {
             hashCode = hashCode * 59 + Value.GetHashCode();
         }
         if (ValueMinus != null)
         {
             hashCode = hashCode * 59 + ValueMinus.GetHashCode();
         }
         if (TraceRef != null)
         {
             hashCode = hashCode * 59 + TraceRef.GetHashCode();
         }
         if (TraceRefMinus != null)
         {
             hashCode = hashCode * 59 + TraceRefMinus.GetHashCode();
         }
         if (Color != null)
         {
             hashCode = hashCode * 59 + Color.GetHashCode();
         }
         if (Thickness != null)
         {
             hashCode = hashCode * 59 + Thickness.GetHashCode();
         }
         if (Width != null)
         {
             hashCode = hashCode * 59 + Width.GetHashCode();
         }
         if (ArraySrc != null)
         {
             hashCode = hashCode * 59 + ArraySrc.GetHashCode();
         }
         if (ArrayMinusSrc != null)
         {
             hashCode = hashCode * 59 + ArrayMinusSrc.GetHashCode();
         }
         return(hashCode);
     }
 }
Ejemplo n.º 14
0
 /// <summary>
 ///     TODO
 /// </summary>
 /// <returns></returns>
 public override int GetHashCode()
 {
     return(Length.GetHashCode() + Width.GetHashCode() + Thickness.GetHashCode() +
            Volume.GetHashCode() + Asymmetry.GetHashCode() +
            (Asymmetry == 0.0 ? 0 : AsymmetryVector.GetHashCode()));
 }
Ejemplo n.º 15
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         if (Label != null)
         {
             hashCode = hashCode * 59 + Label.GetHashCode();
         }
         if (Groups != null)
         {
             hashCode = hashCode * 59 + Groups.GetHashCode();
         }
         if (X != null)
         {
             hashCode = hashCode * 59 + X.GetHashCode();
         }
         if (Y != null)
         {
             hashCode = hashCode * 59 + Y.GetHashCode();
         }
         if (Color != null)
         {
             hashCode = hashCode * 59 + Color.GetHashCode();
         }
         if (ColorArray != null)
         {
             hashCode = hashCode * 59 + ColorArray.GetHashCode();
         }
         if (CustomData != null)
         {
             hashCode = hashCode * 59 + CustomData.GetHashCode();
         }
         if (Line != null)
         {
             hashCode = hashCode * 59 + Line.GetHashCode();
         }
         if (Pad != null)
         {
             hashCode = hashCode * 59 + Pad.GetHashCode();
         }
         if (Thickness != null)
         {
             hashCode = hashCode * 59 + Thickness.GetHashCode();
         }
         if (HoverInfo != null)
         {
             hashCode = hashCode * 59 + HoverInfo.GetHashCode();
         }
         if (HoverLabel != null)
         {
             hashCode = hashCode * 59 + HoverLabel.GetHashCode();
         }
         if (HoverTemplate != null)
         {
             hashCode = hashCode * 59 + HoverTemplate.GetHashCode();
         }
         if (HoverTemplateArray != null)
         {
             hashCode = hashCode * 59 + HoverTemplateArray.GetHashCode();
         }
         if (LabelSrc != null)
         {
             hashCode = hashCode * 59 + LabelSrc.GetHashCode();
         }
         if (XSrc != null)
         {
             hashCode = hashCode * 59 + XSrc.GetHashCode();
         }
         if (YSrc != null)
         {
             hashCode = hashCode * 59 + YSrc.GetHashCode();
         }
         if (ColorSrc != null)
         {
             hashCode = hashCode * 59 + ColorSrc.GetHashCode();
         }
         if (CustomDataSrc != null)
         {
             hashCode = hashCode * 59 + CustomDataSrc.GetHashCode();
         }
         if (HoverTemplateSrc != null)
         {
             hashCode = hashCode * 59 + HoverTemplateSrc.GetHashCode();
         }
         return(hashCode);
     }
 }
Ejemplo n.º 16
0
 public override int GetHashCode()
 {
     return(Start.GetHashCode()
            ^ End.GetHashCode()
            ^ Thickness.GetHashCode());
 }