Ejemplo n.º 1
0
        public void Create_Point_Test_Longtitude_Latitude_Limits()
        {
            //testing valid values for longitude and latitude
            newPoint = tu.CreatePointObject(-180, -90);
            var result = ps.CreatePoint(newPoint);

            Assert.IsNotNull(result);

            newPoint = tu.CreatePointObject(180, 90);
            result   = ps.CreatePoint(newPoint);
            Assert.IsNotNull(result);

            //testing invalid values for longitude and latitude
            newPoint = tu.CreatePointObject(-181, -90);
            Assert.ThrowsException <InvalidPointException>(() => ps.CreatePoint(newPoint));

            newPoint = tu.CreatePointObject(-180, -91);
            Assert.ThrowsException <InvalidPointException>(() => ps.CreatePoint(newPoint));

            newPoint = tu.CreatePointObject(181, 90);
            Assert.ThrowsException <InvalidPointException>(() => ps.CreatePoint(newPoint));

            newPoint = tu.CreatePointObject(180, 91);
            Assert.ThrowsException <InvalidPointException>(() => ps.CreatePoint(newPoint));
        }
Ejemplo n.º 2
0
        public Point CreatePoint(float longitude, float latitude, string description, string name)
        {
            var point = new Point
            {
                Description = description,
                Longitude   = longitude,
                Latitude    = latitude,
                Name        = name
            };

            point = _ps.CreatePoint(point);

            return(point);
        }
Ejemplo n.º 3
0
    public static void GeneratePath(World model, int width, int height)
    {
        for (int y = 0; y < height; y++)
        {
            for (int x = 0; x < width; x++)
            {
                Point p = PointService.CreatePoint(model);
                p.pos       = new Vector(x, y);
                p.gridPos.x = x;
                p.gridPos.y = y;
            }
        }

        for (int i = 0; i < 3; i++)
        {
            ColorType randomFreeColor = ColorService.GetFreeColor(model);
            Point     randomPoint     = PointService.GetPointInGrid(model, MathService.RandomRange(0, width), 0);
            PointService.AddColorToPointWithId(model, randomPoint.id, randomFreeColor);
        }
    }