Пример #1
0
        public void CoordinatesCalculationsTest()
        {
            RegularPolygonFactory factory = new RegularPolygonFactory();

            RegularPolygon a = factory.GetRegularPolygon(3, 2);


            Point[] d = a.GetCoordinates();


            Point[] g = { new Point {
                              x = 0, y = 0
                          }, new Point{
                              x = (float)-1.732051, y = (float)-0.9999999
                          }, new Point{
                              x = (float)-1.732051, y = (float)0.9999999
                          } };

            for (int i = 0; i < d.Length; i++)
            {
                Assert.AreEqual(Math.Round(d[i].x, 2), Math.Round(g[i].x, 2));
                Assert.AreEqual(Math.Round(d[i].y, 2), Math.Round(g[i].y, 2));
            }
        }