Beispiel #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldBeAbleToParseWeirdlyFormattedPoints()
        internal virtual void ShouldBeAbleToParseWeirdlyFormattedPoints()
        {
            assertEqual(pointValue(WGS84, 1.0, 2.0), PointValue.Parse(" \t\n { latitude : 2.0  ,longitude :1.0  } \t"));
            // TODO: Should some/all of these fail?
            assertEqual(pointValue(WGS84, 1.0, 2.0), PointValue.Parse(" \t\n { latitude : 2.0  ,longitude :1.0 , } \t"));
            assertEqual(pointValue(Cartesian, 2.0E-8, -1.0E7), PointValue.Parse(" \t\n { x :+.2e-7,y: -1.0E07 , } \t"));
            assertEqual(pointValue(Cartesian, 2.0E-8, -1.0E7), PointValue.Parse(" \t\n { x :+.2e-7,y: -1.0E07 , garbage} \t"));
            assertEqual(pointValue(Cartesian, 2.0E-8, -1.0E7), PointValue.Parse(" \t\n { gar ba ge,x :+.2e-7,y: -1.0E07} \t"));
        }
Beispiel #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldBeAbleToParseIncompletePointWithHeaderInformation()
        internal virtual void ShouldBeAbleToParseIncompletePointWithHeaderInformation()
        {
            string headerInformation = "{latitude: 40.7128}";
            string data = "{longitude: -74.0060, height: 567.8, crs:wgs-84-3D}";

            assertThrows(typeof(InvalidValuesArgumentException), () => PointValue.Parse(data));

            // this should work
            PointValue.Parse(data, PointValue.ParseHeaderInformation(headerInformation));
        }
Beispiel #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldBeAbleToParsePointThatOverridesHeaderInformation()
        internal virtual void ShouldBeAbleToParsePointThatOverridesHeaderInformation()
        {
            string headerInformation = "{crs:wgs-84}";
            string data = "{latitude: 40.7128, longitude: -74.0060, height: 567.8, crs:wgs-84-3D}";

            PointValue expected = PointValue.Parse(data);
            PointValue actual   = PointValue.Parse(data, PointValue.ParseHeaderInformation(headerInformation));

            assertEqual(expected, actual);
            assertEquals("wgs-84-3d", actual.CoordinateReferenceSystem.Name.ToLower());
        }
Beispiel #4
0
        //-------------------------------------------------------------
        // Parser tests

//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldBeAbleToParsePoints()
        internal virtual void ShouldBeAbleToParsePoints()
        {
            assertEqual(pointValue(WGS84, 13.2, 56.7), PointValue.Parse("{latitude: 56.7, longitude: 13.2}"));
            assertEqual(pointValue(WGS84, -74.0060, 40.7128), PointValue.Parse("{latitude: 40.7128, longitude: -74.0060, crs: 'wgs-84'}"));                             // - explicitly WGS84
            assertEqual(pointValue(Cartesian, -21, -45.3), PointValue.Parse("{x: -21, y: -45.3}"));                                                                     // - default to cartesian 2D
            assertEqual(pointValue(WGS84, -21, -45.3), PointValue.Parse("{x: -21, y: -45.3, srid: 4326}"));                                                             // - explicitly set WGS84 by SRID
            assertEqual(pointValue(Cartesian, 17, -52.8), PointValue.Parse("{x: 17, y: -52.8, crs: 'cartesian'}"));                                                     // - explicit cartesian 2D
            assertEqual(pointValue(WGS84_3D, 13.2, 56.7, 123.4), PointValue.Parse("{latitude: 56.7, longitude: 13.2, height: 123.4}"));                                 // - defaults to WGS84-3D
            assertEqual(pointValue(WGS84_3D, 13.2, 56.7, 123.4), PointValue.Parse("{latitude: 56.7, longitude: 13.2, z: 123.4}"));                                      // - defaults to WGS84-3D
            assertEqual(pointValue(WGS84_3D, -74.0060, 40.7128, 567.8), PointValue.Parse("{latitude: 40.7128, longitude: -74.0060, height: 567.8, crs: 'wgs-84-3D'}")); // - explicitly WGS84-3D
            assertEqual(pointValue(Cartesian_3D, -21, -45.3, 7.2), PointValue.Parse("{x: -21, y: -45.3, z: 7.2}"));                                                     // - default to cartesian 3D
            assertEqual(pointValue(Cartesian_3D, 17, -52.8, -83.1), PointValue.Parse("{x: 17, y: -52.8, z: -83.1, crs: 'cartesian-3D'}"));                              // - explicit cartesian 3D
        }
Beispiel #5
0
 private InvalidValuesArgumentException AssertCannotParse(string text)
 {
     return(assertThrows(typeof(InvalidValuesArgumentException), () => PointValue.Parse(text)));
 }
Beispiel #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldBeAbleToParsePointWithUnquotedCrs()
        internal virtual void ShouldBeAbleToParsePointWithUnquotedCrs()
        {
            assertEqual(pointValue(WGS84_3D, -74.0060, 40.7128, 567.8), PointValue.Parse("{latitude: 40.7128, longitude: -74.0060, height: 567.8, crs:wgs-84-3D}"));                     // - explicitly WGS84-3D, without quotes
        }