public void GetLine() { // -- Triangle -- XYPolygon xypolygon = new XYPolygon(); xypolygon.Points.Add(new XYPoint(1, 2)); xypolygon.Points.Add(new XYPoint(4, 3)); xypolygon.Points.Add(new XYPoint(2, 5)); Assert.AreEqual(new XYLine(1, 2, 4, 3), xypolygon.GetLine(0)); Assert.AreEqual(new XYLine(4, 3, 2, 5), xypolygon.GetLine(1)); Assert.AreEqual(new XYLine(2, 5, 1, 2), xypolygon.GetLine(2)); // -- concave polygon -- XYPolygon xypolygon4 = new XYPolygon(); xypolygon4.Points.Add(new XYPoint(1, 1)); xypolygon4.Points.Add(new XYPoint(9, 1)); xypolygon4.Points.Add(new XYPoint(5, 5)); xypolygon4.Points.Add(new XYPoint(5, 3)); xypolygon4.Points.Add(new XYPoint(3, 3)); xypolygon4.Points.Add(new XYPoint(3, 8)); xypolygon4.Points.Add(new XYPoint(9, 8)); xypolygon4.Points.Add(new XYPoint(9, 11)); xypolygon4.Points.Add(new XYPoint(1, 11)); Assert.AreEqual(new XYLine(1, 1, 9, 1), xypolygon4.GetLine(0)); Assert.AreEqual(new XYLine(9, 1, 5, 5), xypolygon4.GetLine(1)); Assert.AreEqual(new XYLine(5, 5, 5, 3), xypolygon4.GetLine(2)); Assert.AreEqual(new XYLine(5, 3, 3, 3), xypolygon4.GetLine(3)); Assert.AreEqual(new XYLine(3, 3, 3, 8), xypolygon4.GetLine(4)); Assert.AreEqual(new XYLine(3, 8, 9, 8), xypolygon4.GetLine(5)); Assert.AreEqual(new XYLine(9, 8, 9, 11), xypolygon4.GetLine(6)); Assert.AreEqual(new XYLine(9, 11, 1, 11), xypolygon4.GetLine(7)); Assert.AreEqual(new XYLine(1, 11, 1, 1), xypolygon4.GetLine(8)); }