public void TestSTNumPatches() { using (var db = new PostGisTestDataConnection(TestDatabaseConnectionString)) { const string Ewkt = @"POLYHEDRALSURFACE( ((0 0 0, 0 0 1, 0 1 1, 0 1 0, 0 0 0)), ((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)), ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)), ((1 1 0, 1 1 1, 1 0 1, 1 0 0, 1 1 0)), ((0 1 0, 0 1 1, 1 1 1, 1 1 0, 0 1 0)), ((0 0 1, 1 0 1, 1 1 1, 0 1 1, 0 0 1)) )"; db.TestGeometries.Value(g => g.Id, 1).Value(g => g.Geometry, () => GeometryInput.STGeomFromEWKT(Ewkt)).Insert(); db.TestGeometries.Value(g => g.Id, 2).Value(g => g.Geometry, () => GeometryInput.STGeomFromText("POINT(1 1)")).Insert(); db.TestGeometries.Value(g => g.Id, 3).Value(g => g.Geometry, () => null).Insert(); Assert.AreEqual(6, db.TestGeometries.Where(g => g.Id == 1).Select(g => g.Geometry.STNumPatches()).Single()); Assert.IsNull(db.TestGeometries.Where(g => g.Id == 2).Select(g => g.Geometry.STNumPatches()).Single()); Assert.IsNull(db.TestGeometries.Where(g => g.Id == 3).Select(g => g.Geometry.STNumPatches()).Single()); Assert.IsNull(db.Select(() => GeometryAccessors.STNumPatches((NTSG)null))); Assert.AreEqual(6, db.Select(() => GeometryAccessors.STNumPatches(Ewkt))); } }