Пример #1
0
        public void TestSTPointN()
        {
            using (var db = new PostGisTestDataConnection(TestDatabaseConnectionString))
            {
                const string Wkt = "LINESTRING(0 0, 1 1, 2 2)";
                db.TestGeometries
                .Value(g => g.Id, 1)
                .Value(g => g.Geometry, () => GeometryInput.STGeomFromText(Wkt))
                .Insert();

                Assert.AreEqual(
                    "POINT(0 0)",
                    db.TestGeometries
                    .Where(g => g.Id == 1)
                    .Select(g => g.Geometry.STPointN(1).STAsText())
                    .Single());

                Assert.AreEqual(
                    "POINT(0 0)",
                    db.Select(() => GeometryAccessors.STPointN(Wkt, 1).STAsText()));

                Assert.IsNull(db.Select(() => GeometryAccessors.STPointN((NTSG)null, 1)));
                Assert.IsNull(db.Select(() => GeometryAccessors.STPointN("POINT(0 0)", 1)));
            }
        }