public void CopyRotateTest() { Point3D referencePoint = new Point3D() { X = 1, Y = 1, Z = 0 }; //Case1:直线段 LineSegment newLine = this.Line.CopyRotate(referencePoint, Math.PI / 2, ArcDirctionType.CLOCK_WISE) as LineSegment; Assert.AreNotEqual(this.Line.GetHashCode(), newLine.GetHashCode()); Assert.AreEqual(Math.Round(newLine.BeginPoint.X, 8), 0); Assert.AreEqual(Math.Round(newLine.BeginPoint.Y, 8), 2); Assert.AreEqual(Math.Round(newLine.EndPoint.X, 8), 0); Assert.AreEqual(Math.Round(newLine.EndPoint.Y, 8), 1); //Case2:圆弧 ArcSegment newArc = this.ArcSegment.CopyRotate(referencePoint, Math.PI / 2, ArcDirctionType.CLOCK_WISE) as ArcSegment; Assert.AreNotEqual(this.ArcSegment.GetHashCode(), newArc.GetHashCode()); Assert.AreEqual(Math.Round(newArc.BeginPoint.X, 8), 1); Assert.AreEqual(Math.Round(newArc.BeginPoint.Y, 8), 2); Assert.AreEqual(Math.Round(newArc.EndPoint.X, 8), 0); Assert.AreEqual(Math.Round(newArc.EndPoint.Y, 8), 1); Assert.AreEqual(newArc.ArcDirection, ArcDirctionType.CLOCK_WISE); }
public void GetHashCodeTest() { //Test1 var code1 = this.ArcSegment_Full.GetHashCode(); var code2 = this.ArcSegment_Part.GetHashCode(); Assert.AreNotEqual(code1, code2); //Test2 Point3D center = new Point3D() { X = 0, Y = 0, Z = 0 }; ArcSegment full = new ArcSegment(center, 1, Types.ArcDirctionType.CLOCK_WISE); var code3 = full.GetHashCode(); Assert.AreEqual(code1, code3); //Test3 Point3D start = new Point3D() { X = 0, Y = 1, Z = 0 }; Point3D end = new Point3D() { X = 1, Y = 0, Z = 0 }; ArcSegment part = new ArcSegment(center, start, end, ArcDirctionType.CLOCK_WISE); var code4 = part.GetHashCode(); Assert.AreEqual(code2, code4); }
public void CopyMoveTest() { //Case1:直线段 LineSegment newLine = this.Line.CopyMove(Math.PI / 2, 1) as LineSegment; Assert.AreNotEqual(this.Line.GetHashCode(), newLine.GetHashCode()); Assert.AreEqual(Math.Round(newLine.BeginPoint.X, 8), 1); Assert.AreEqual(Math.Round(newLine.BeginPoint.Y, 8), 0); Assert.AreEqual(Math.Round(newLine.EndPoint.X, 8), 2); Assert.AreEqual(Math.Round(newLine.EndPoint.Y, 8), 0); //Case2:圆弧 ArcSegment newArc = this.ArcSegment.CopyMove(Math.PI / 2, 1) as ArcSegment; Assert.AreNotEqual(this.ArcSegment.GetHashCode(), newArc.GetHashCode()); Assert.AreEqual(Math.Round(newArc.BeginPoint.X, 8), 1); Assert.AreEqual(Math.Round(newArc.BeginPoint.Y, 8), 1); Assert.AreEqual(Math.Round(newArc.EndPoint.X, 8), 2); Assert.AreEqual(Math.Round(newArc.EndPoint.Y, 8), 0); Assert.AreEqual(newArc.ArcDirection, ArcDirctionType.CLOCK_WISE); }