Exemple #1
0
        public void TestSTIsRing()
        {
            using (var db = new PostGisTestDataConnection(TestDatabaseConnectionString))
            {
                const string Wkt1 = "LINESTRING(0 0, 0 1, 1 1, 1 0, 0 0)";
                db.TestGeometries.Value(g => g.Id, 1).Value(g => g.Geometry, () => GeometryInput.STGeomFromText(Wkt1)).Insert();
                const string Wkt2 = "LINESTRING(0 0, 0 1, 1 0, 1 1, 0 0)";
                db.TestGeometries.Value(g => g.Id, 2).Value(g => g.Geometry, () => GeometryInput.STGeomFromText(Wkt2)).Insert();
                db.TestGeometries.Value(g => g.Id, 3).Value(g => g.Geometry, () => null).Insert();

                Assert.IsTrue(db.TestGeometries.Where(g => g.Id == 1).Select(g => g.Geometry.STIsRing()).Single());
                Assert.IsFalse(db.TestGeometries.Where(g => g.Id == 2).Select(g => g.Geometry.STIsRing()).Single());
                Assert.IsNull(db.TestGeometries.Where(g => g.Id == 3).Select(g => g.Geometry.STIsRing()).Single());

                Assert.IsNull(db.Select(() => GeometryAccessors.STIsRing((NTSG)null)));
                Assert.IsTrue(db.Select(() => GeometryAccessors.STIsRing(Wkt1)));
                Assert.IsFalse(db.Select(() => GeometryAccessors.STIsRing(Wkt2)));
            }
        }