public void GetHashCodeForEqualStrokes() { var stroke = new SerializableStroke(_attributes, _points); var anotherPoints = new Point[_points.Length]; _points.CopyTo(anotherPoints, 0); var anotherStroke = new SerializableStroke(_attributes, anotherPoints); var strokeHash = stroke.GetHashCode(); var anotherStrokeHash = anotherStroke.GetHashCode(); Assert.Equal(strokeHash, anotherStrokeHash); }
public void GetHashCodeForNonEqualStrokesByPoints() { var stroke = new SerializableStroke(_attributes, _points); var anotherPoints = new Point[_points.Length]; _points.CopyTo(anotherPoints, 0); anotherPoints[0] = new Point(anotherPoints[0].X + 1, anotherPoints[0].Y - 1); var anotherStroke = new SerializableStroke(_attributes, anotherPoints); var strokeHash = stroke.GetHashCode(); var anotherStrokeHash = anotherStroke.GetHashCode(); Assert.NotEqual(strokeHash, anotherStrokeHash); }
public void GetHashCodeForNonEqualStrokesByAttributes() { var stroke = new SerializableStroke(_attributes, _points); var anotherPoints = new Point[_points.Length]; _points.CopyTo(anotherPoints, 0); var anotherAttributes = new StrokeAttributes { Color = ARGBColor.Default, Height = stroke.Attributes.Height + 2, Width = 2, IgnorePressure = true, IsHighlighter = !stroke.Attributes.IsHighlighter, StylusTip = StylusTip.Ellipse }; var anotherStroke = new SerializableStroke(anotherAttributes, anotherPoints); var strokeHash = stroke.GetHashCode(); var anotherStrokeHash = anotherStroke.GetHashCode(); Assert.NotEqual(strokeHash, anotherStrokeHash); }