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)); }
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); }
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); } }