Ejemplo n.º 1
0
        public void TestSTMemSize()
        {
            using (var db = new PostGisTestDataConnection(TestDatabaseConnectionString))
            {
                db.TestGeometries
                .Value(g => g.Id, 1)
                .Value(g => g.Geometry, () => GeometryInput.STGeomFromText("POINT(0 0)"))
                .Insert();
                db.TestGeometries
                .Value(g => g.Id, 2)
                .Value(g => g.Geometry, () => null)
                .Insert();

                Assert.AreEqual(32, db.TestGeometries
                                .Where(g => g.Id == 1)
                                .Select(g => g.Geometry.STMemSize())
                                .Single());

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

                // TODO: need explicit cast text to geometry
                if (this.CurrentVersion >= new Version("3.0.0"))
                {
                    Assert.AreEqual(32, db.Select(() => GeometryAccessors.STMemSize("POINT(0 0)")));
                    Assert.IsNull(db.Select(() => GeometryAccessors.STMemSize((NTSG)null)));
                }
            }
        }