/// <summary>
        /// Try to parse the given text to a Geography object.
        /// </summary>
        /// <param name="text">Text to parse.</param>
        /// <param name="targetValue">Geography to return.</param>
        /// <param name="reason">The detailed reason of parsing error.</param>
        /// <returns>True if succeeds, false if not.</returns>
        private static bool TryUriStringToGeography(string text, out Geography targetValue, out string reason)
        {
            reason = null;

            if (!TryRemoveLiteralPrefix(ExpressionConstants.LiteralPrefixGeography, ref text))
            {
                targetValue = default(Geography);
                return(false);
            }

            if (!TryRemoveQuotes(ref text))
            {
                targetValue = default(Geography);
                return(false);
            }

            try
            {
                targetValue = LiteralUtils.ParseGeography(text);
                return(true);
            }
            catch (ParseErrorException e)
            {
                targetValue = default(Geography);
                reason      = e.Message;
                return(false);
            }
        }
        public void GeographyWorksWithTwoDimensions()
        {
            GeographyPoint geographyPoint = LiteralUtils.ParseGeography("POINT(10 30)") as GeographyPoint;

            geographyPoint.Latitude.ShouldBe(30.0);
            geographyPoint.Longitude.ShouldBe(10.0);
        }
Beispiel #3
0
        public void GeographyWorksWithTwoDimensions()
        {
            GeographyPoint geographyPoint = LiteralUtils.ParseGeography("POINT(10 30)") as GeographyPoint;

            Assert.Equal(30.0, geographyPoint.Latitude);
            Assert.Equal(10.0, geographyPoint.Longitude);
            Assert.Null(geographyPoint.Z);
            Assert.Null(geographyPoint.M);
        }