Example #1
0
        public void RectWrappingAroundGlobeIsValid()
        {
            Rect rect = new Rect
            {
                xMin = -200,
                xMax = 200,
                yMin = -10,
                yMax = 10
            };

            Assert.True(GeoRectUtils.IsValidGeoRect(rect));
        }
Example #2
0
        public ActionResult <IEnumerable <GeoCoordinates> > GetUsersIn(double minLongitude, double maxLongitude, double minLatitude, double maxLatitude)
        {
            Rect rect = new Rect
            {
                xMin = minLongitude,
                xMax = maxLongitude,
                yMin = minLatitude,
                yMax = maxLatitude
            };

            if (!GeoRectUtils.IsValidGeoRect(rect))
            {
                return(BadRequest());
            }

            return(Ok(Users.GetActiveUsersIn(rect.Intersects).Select((user) => user.LastKnownLocation)));
        }
Example #3
0
        public void RectCrossingPolesNotValid()
        {
            Rect rectCrossingNorth = new Rect
            {
                xMin = -10,
                xMax = 10,
                yMin = 50,
                yMax = 100
            };

            Rect rectCrossingSouth = new Rect
            {
                xMin = -10,
                xMax = 10,
                yMin = 50,
                yMax = 100
            };

            Assert.False(GeoRectUtils.IsValidGeoRect(rectCrossingNorth));
            Assert.False(GeoRectUtils.IsValidGeoRect(rectCrossingSouth));
        }
Example #4
0
 public void RectIsValidTheory(Rect rect, string message)
 {
     Assert.True(GeoRectUtils.IsValidGeoRect(rect), message);
 }