Exemple #1
0
        public void TestSTHasArc()
        {
            using (var db = new PostGisTestDataConnection(TestDatabaseConnectionString))
            {
                db.TestGeometries
                .Value(g => g.Id, 1)
                .Value(g => g.Geometry, () =>
                       GeometryConstructors.STCollect(
                           GeometryInput.STGeomFromText("LINESTRING(1 2, 3 4, 5 6)"),
                           GeometryInput.STGeomFromText("CIRCULARSTRING(1 1, 2 3, 4 5, 6 7, 5 6)")))
                .Insert();

                db.TestGeometries
                .Value(g => g.Id, 2)
                .Value(g => g.Geometry, () => null)
                .Insert();

                Assert.IsTrue(db.TestGeometries
                              .Where(g => g.Id == 1)
                              .Select(g => g.Geometry.STHasArc())
                              .Single());

                Assert.IsNull(db.TestGeometries
                              .Where(g => g.Id == 2)
                              .Select(g => g.Geometry.STHasArc())
                              .Single());

                Assert.IsTrue(db.Select(() => GeometryAccessors.STHasArc("CIRCULARSTRING(1 1, 2 3, 4 5, 6 7, 5 6)")));
            }
        }