@@ -12,14 +12,11 @@ namespace LinqToDBPostGisNetTopologySuite.Tests
1212 [ TestFixture ]
1313 class GeometryConstructorsTests : TestsBase
1414 {
15- private Version CurrentVersion ;
16-
1715 [ SetUp ]
1816 public void Setup ( )
1917 {
2018 using ( var db = new PostGisTestDataConnection ( TestDatabaseConnectionString ) )
2119 {
22- this . CurrentVersion = new Version ( db . Select ( ( ) => VersionFunctions . PostGISLibVersion ( ) ) ) ;
2320 db . TestGeometries . Delete ( ) ;
2421 db . TestGeographies . Delete ( ) ;
2522 }
@@ -299,100 +296,103 @@ public void TestSTPoint()
299296 [ Test ]
300297 public void TestSTPointZ ( )
301298 {
302- if ( CurrentVersion < new Version ( "3.2.0" ) ) return ;
299+ if ( base . CurrentVersion >= base . Version320 )
300+ {
301+ const double X = 1 ;
302+ const double Y = 2 ;
303+ const double Z = 3 ;
304+ const int Srid = 4326 ;
303305
304- const double X = 1 ;
305- const double Y = 2 ;
306- const double Z = 3 ;
307- const int Srid = 4326 ;
306+ NTSG res1 ;
307+ NTSG res2 ;
308308
309- NTSG res1 ;
310- NTSG res2 ;
309+ using ( var db = new PostGisTestDataConnection ( TestDatabaseConnectionString ) )
310+ {
311+ res1 = db . Select ( ( ) => GeometryConstructors . STPointZ ( X , Y , Z , Srid ) ) ;
312+ res2 = db . Select ( ( ) => GeometryConstructors . STPointZ ( X , Y , Z ) ) ;
313+ }
311314
312- using ( var db = new PostGisTestDataConnection ( TestDatabaseConnectionString ) )
313- {
314- res1 = db . Select ( ( ) => GeometryConstructors . STPointZ ( X , Y , Z , Srid ) ) ;
315- res2 = db . Select ( ( ) => GeometryConstructors . STPointZ ( X , Y , Z ) ) ;
315+ Assert . IsNotNull ( res1 ) ;
316+ Assert . AreEqual ( X , res1 . Coordinates [ 0 ] . X ) ;
317+ Assert . AreEqual ( Y , res1 . Coordinates [ 0 ] . Y ) ;
318+ Assert . AreEqual ( Z , res1 . Coordinates [ 0 ] . Z ) ;
319+ Assert . AreEqual ( Srid , res1 . SRID ) ;
320+
321+ Assert . IsNotNull ( res2 ) ;
322+ Assert . AreEqual ( X , res2 . Coordinates [ 0 ] . X ) ;
323+ Assert . AreEqual ( Y , res2 . Coordinates [ 0 ] . Y ) ;
324+ Assert . AreEqual ( Z , res2 . Coordinates [ 0 ] . Z ) ;
325+ Assert . AreEqual ( - 1 , res2 . SRID ) ;
316326 }
317-
318- Assert . IsNotNull ( res1 ) ;
319- Assert . AreEqual ( X , res1 . Coordinates [ 0 ] . X ) ;
320- Assert . AreEqual ( Y , res1 . Coordinates [ 0 ] . Y ) ;
321- Assert . AreEqual ( Z , res1 . Coordinates [ 0 ] . Z ) ;
322- Assert . AreEqual ( Srid , res1 . SRID ) ;
323-
324- Assert . IsNotNull ( res2 ) ;
325- Assert . AreEqual ( X , res2 . Coordinates [ 0 ] . X ) ;
326- Assert . AreEqual ( Y , res2 . Coordinates [ 0 ] . Y ) ;
327- Assert . AreEqual ( Z , res2 . Coordinates [ 0 ] . Z ) ;
328- Assert . AreEqual ( - 1 , res2 . SRID ) ;
329327 }
330328
331329 [ Test ]
332330 public void TestSTPointM ( )
333331 {
334- if ( CurrentVersion < Version320 ) return ;
332+ if ( base . CurrentVersion >= base . Version320 )
333+ {
334+ const double X = 4 ;
335+ const double Y = 5 ;
336+ const double M = 6 ;
337+ const int Srid = 4326 ;
335338
336- const double X = 4 ;
337- const double Y = 5 ;
338- const double M = 6 ;
339- const int Srid = 4326 ;
339+ NTSG res1 ;
340+ NTSG res2 ;
340341
341- NTSG res1 ;
342- NTSG res2 ;
342+ using ( var db = new PostGisTestDataConnection ( TestDatabaseConnectionString ) )
343+ {
344+ res1 = db . Select ( ( ) => GeometryConstructors . STPointM ( X , Y , M , Srid ) ) ;
345+ res2 = db . Select ( ( ) => GeometryConstructors . STPointM ( X , Y , M ) ) ;
346+ }
343347
344- using ( var db = new PostGisTestDataConnection ( TestDatabaseConnectionString ) )
345- {
346- res1 = db . Select ( ( ) => GeometryConstructors . STPointM ( X , Y , M , Srid ) ) ;
347- res2 = db . Select ( ( ) => GeometryConstructors . STPointM ( X , Y , M ) ) ;
348+ Assert . IsNotNull ( res1 ) ;
349+ Assert . AreEqual ( X , res1 . Coordinates [ 0 ] . X ) ;
350+ Assert . AreEqual ( Y , res1 . Coordinates [ 0 ] . Y ) ;
351+ Assert . AreEqual ( M , res1 . Coordinates [ 0 ] . M ) ;
352+ Assert . AreEqual ( Srid , res1 . SRID ) ;
353+
354+ Assert . IsNotNull ( res2 ) ;
355+ Assert . AreEqual ( X , res2 . Coordinates [ 0 ] . X ) ;
356+ Assert . AreEqual ( Y , res2 . Coordinates [ 0 ] . Y ) ;
357+ Assert . AreEqual ( M , res2 . Coordinates [ 0 ] . M ) ;
358+ Assert . AreEqual ( - 1 , res2 . SRID ) ;
348359 }
349-
350- Assert . IsNotNull ( res1 ) ;
351- Assert . AreEqual ( X , res1 . Coordinates [ 0 ] . X ) ;
352- Assert . AreEqual ( Y , res1 . Coordinates [ 0 ] . Y ) ;
353- Assert . AreEqual ( M , res1 . Coordinates [ 0 ] . M ) ;
354- Assert . AreEqual ( Srid , res1 . SRID ) ;
355-
356- Assert . IsNotNull ( res2 ) ;
357- Assert . AreEqual ( X , res2 . Coordinates [ 0 ] . X ) ;
358- Assert . AreEqual ( Y , res2 . Coordinates [ 0 ] . Y ) ;
359- Assert . AreEqual ( M , res2 . Coordinates [ 0 ] . M ) ;
360- Assert . AreEqual ( - 1 , res2 . SRID ) ;
361360 }
362361
363362 [ Test ]
364363 public void TestSTPointZM ( )
365364 {
366- if ( CurrentVersion < Version320 ) return ;
365+ if ( base . CurrentVersion >= base . Version320 )
366+ {
367+ const double X = 23.0 ;
368+ const double Y = 41.1 ;
369+ const double Z = 2.1 ;
370+ const double M = 1 ;
371+ const int Srid = 4326 ;
367372
368- const double X = 23.0 ;
369- const double Y = 41.1 ;
370- const double Z = 2.1 ;
371- const double M = 1 ;
372- const int Srid = 4326 ;
373+ NTSG res1 ;
374+ NTSG res2 ;
373375
374- NTSG res1 ;
375- NTSG res2 ;
376+ using ( var db = new PostGisTestDataConnection ( TestDatabaseConnectionString ) )
377+ {
378+ res1 = db . Select ( ( ) => GeometryConstructors . STPointZM ( X , Y , Z , M , Srid ) ) ;
379+ res2 = db . Select ( ( ) => GeometryConstructors . STPointZM ( X , Y , Z , M ) ) ;
380+ }
376381
377- using ( var db = new PostGisTestDataConnection ( TestDatabaseConnectionString ) )
378- {
379- res1 = db . Select ( ( ) => GeometryConstructors . STPointZM ( X , Y , Z , M , Srid ) ) ;
380- res2 = db . Select ( ( ) => GeometryConstructors . STPointZM ( X , Y , Z , M ) ) ;
382+ Assert . IsNotNull ( res1 ) ;
383+ Assert . AreEqual ( X , res1 . Coordinates [ 0 ] . X ) ;
384+ Assert . AreEqual ( Y , res1 . Coordinates [ 0 ] . Y ) ;
385+ Assert . AreEqual ( Z , res1 . Coordinates [ 0 ] . Z ) ;
386+ Assert . AreEqual ( M , res1 . Coordinates [ 0 ] . M ) ;
387+ Assert . AreEqual ( Srid , res1 . SRID ) ;
388+
389+ Assert . IsNotNull ( res2 ) ;
390+ Assert . AreEqual ( X , res2 . Coordinates [ 0 ] . X ) ;
391+ Assert . AreEqual ( Y , res2 . Coordinates [ 0 ] . Y ) ;
392+ Assert . AreEqual ( Z , res2 . Coordinates [ 0 ] . Z ) ;
393+ Assert . AreEqual ( M , res2 . Coordinates [ 0 ] . M ) ;
394+ Assert . AreEqual ( - 1 , res2 . SRID ) ;
381395 }
382-
383- Assert . IsNotNull ( res1 ) ;
384- Assert . AreEqual ( X , res1 . Coordinates [ 0 ] . X ) ;
385- Assert . AreEqual ( Y , res1 . Coordinates [ 0 ] . Y ) ;
386- Assert . AreEqual ( Z , res1 . Coordinates [ 0 ] . Z ) ;
387- Assert . AreEqual ( M , res1 . Coordinates [ 0 ] . M ) ;
388- Assert . AreEqual ( Srid , res1 . SRID ) ;
389-
390- Assert . IsNotNull ( res2 ) ;
391- Assert . AreEqual ( X , res2 . Coordinates [ 0 ] . X ) ;
392- Assert . AreEqual ( Y , res2 . Coordinates [ 0 ] . Y ) ;
393- Assert . AreEqual ( Z , res2 . Coordinates [ 0 ] . Z ) ;
394- Assert . AreEqual ( M , res2 . Coordinates [ 0 ] . M ) ;
395- Assert . AreEqual ( - 1 , res2 . SRID ) ;
396396 }
397397
398398 [ Test ]
@@ -428,7 +428,7 @@ public void TestSTPolygon()
428428 . Single ( ) ) ;
429429
430430 // TODO: ? reason of error? ST_Polygon(text) not works in 2.5 ?
431- if ( this . CurrentVersion >= base . Version300 )
431+ if ( base . CurrentVersion >= base . Version300 )
432432 {
433433 db . TestGeometries
434434 . Value ( g => g . Id , 3 )
@@ -449,7 +449,7 @@ public void TestSTTileEnvelope()
449449 {
450450 using ( var db = new PostGisTestDataConnection ( TestDatabaseConnectionString ) )
451451 {
452- if ( this . CurrentVersion >= base . Version300 )
452+ if ( base . CurrentVersion >= base . Version300 )
453453 {
454454 db . TestGeometries
455455 . Value ( g => g . Id , 1 )
@@ -508,7 +508,7 @@ public void TestSTHexagon()
508508 {
509509 using ( var db = new PostGisTestDataConnection ( TestDatabaseConnectionString ) )
510510 {
511- if ( this . CurrentVersion >= base . Version310 )
511+ if ( base . CurrentVersion >= base . Version310 )
512512 {
513513 var origin = db . Select ( ( ) => GeometryConstructors . STMakePoint ( 0 , 0 ) ) ;
514514
@@ -528,7 +528,7 @@ public void TestSTSquare()
528528 {
529529 using ( var db = new PostGisTestDataConnection ( TestDatabaseConnectionString ) )
530530 {
531- if ( this . CurrentVersion >= Version310 )
531+ if ( base . CurrentVersion >= Version310 )
532532 {
533533 var origin = db . Select ( ( ) => GeometryConstructors . STMakePoint ( 0 , 0 ) ) ;
534534
0 commit comments