public void TestSTNPoints() { using (var db = new PostGisTestDataConnection(TestDatabaseConnectionString)) { const string Wkt1 = "POINT(77.29 29.07)"; db.TestGeometries.Value(g => g.Id, 1).Value(g => g.Geometry, () => GeometryInput.STGeomFromText(Wkt1)).Insert(); const string Wkt2 = "LINESTRING(77.29 29.07 1,77.42 29.26 0,77.27 29.31 -1,77.29 29.07 3)"; db.TestGeometries.Value(g => g.Id, 2).Value(g => g.Geometry, () => GeometryInput.STGeomFromText(Wkt2)).Insert(); const string Wkt3 = "LINESTRING EMPTY"; db.TestGeometries.Value(g => g.Id, 3).Value(g => g.Geometry, () => GeometryInput.STGeomFromText(Wkt3)).Insert(); db.TestGeometries.Value(g => g.Id, 4).Value(g => g.Geometry, () => null).Insert(); var nPoints1 = db.TestGeometries.Where(g => g.Id == 1).Select(g => g.Geometry.STNPoints()).Single(); Assert.AreEqual(1, nPoints1); var nPoints2 = db.TestGeometries.Where(g => g.Id == 2).Select(g => g.Geometry.STNPoints()).Single(); Assert.AreEqual(4, nPoints2); var nPoints3 = db.TestGeometries.Where(g => g.Id == 3).Select(g => g.Geometry.STNPoints()).Single(); Assert.AreEqual(0, nPoints3); var nPoints4 = db.TestGeometries.Where(g => g.Id == 4).Select(g => g.Geometry.STNPoints()).Single(); Assert.IsNull(nPoints4); Assert.IsNull(db.Select(() => GeometryAccessors.STNPoints((NTSG)null))); Assert.AreEqual(1, db.Select(() => GeometryAccessors.STNPoints(Wkt1))); Assert.AreEqual(4, db.Select(() => GeometryAccessors.STNPoints(Wkt2))); Assert.AreEqual(0, db.Select(() => GeometryAccessors.STNPoints(Wkt3))); } }