public void special_case_with_circle()
        {
            var json      = GetObjectFromJson <FeatureCollection>("ng_with_circle");
            var geography = GeoToSql.Translate(json);

            AssertIsEqualToRepresentationInFile(geography, "ng_with_circle");
        }
        public void empty_geometry_leads_to_empty_geojson_part1()
        {
            var geo     = SqlGeography.Parse("GEOMETRYCOLLECTION EMPTY");
            var geojson = GeoToSql.Translate(geo);

            geojson.ShouldBeAssignableTo <GeometryCollection>();
            ((GeometryCollection)geojson).Geometries.Count.ShouldBe(0);
        }
        public void feature_collection_becomes_geometrycollection()
        {
            var json     = GetObjectFromJson <FeatureCollection>("ng_earthquakes");
            var geometry = GeoToSql.Translate(json);

            Debug.WriteLine(geometry.ToString());
            AssertIsEqualToRepresentationInFile(geometry, "ng_earthquakes");
        }
        public void checking_geo_json_representations_of_sqlgeography(string fileName, Type expectedType)
        {
            var content = ResourceLoader.LoadSqlType(fileName);
            var obj     = GeoToSql.Translate(content);

            obj.ShouldBeAssignableTo(expectedType);
            AssertIsEqualToGeoJsonFile(obj, fileName, expectedType);
        }
        public void test_parsing_with_negative_numbers()
        {
            var content = ResourceLoader.LoadSqlType("polygon_w_neg_nums");
            var geoJson = GeoToSql.Translate(content);

            geoJson.ShouldBeOfType <GeometryCollection>();
            ((GeometryCollection)geoJson).Geometries.Count.ShouldBe(3);
            ((GeometryCollection)geoJson).Geometries.ShouldAllBe(go => go is Polygon);
        }
        protected override void AdditionalSetup()
        {
            var content = ResourceLoader.LoadSqlType("ng_with_circle");
            var geoJson = GeoToSql.Translate(content);

            geoJson.ShouldBeOfType <FeatureCollection>();

            newFeatureCollection = (FeatureCollection)geoJson;
            loadedGeoJson        = GetObjectFromJson <FeatureCollection>("ng_with_circle");
        }
        private SqlGeography SqlGeographyFromJsonFile(string jsonFile)
        {
            var json = GetObjectFromJson <IGeometryObject>(jsonFile);

            return(GeoToSql.Translate((GeoJSONObject)json));
        }
Beispiel #8
0
        public void attempted_conversions_require_setting_spatial_reference_system()
        {
            var p = new Point(new GeographicPosition(23.0, 23.0));

            Assert.Throws <NoSpatialReferenceDefinedException>(() => GeoToSql.Translate(p));
        }
        public void invalid_op_when_parsing_circle_in_collection_style()
        {
            var content = ResourceLoader.LoadSqlType("ng_with_circle");

            Assert.Throws <InvalidOperationException>(() => GeoToSql.Translate(content)).Message.ShouldContain("circle-like structures");
        }