@@ -12,14 +12,11 @@ namespace LinqToDBPostGisNetTopologySuite.Tests
12
12
[ TestFixture ]
13
13
class GeometryConstructorsTests : TestsBase
14
14
{
15
- private Version CurrentVersion ;
16
-
17
15
[ SetUp ]
18
16
public void Setup ( )
19
17
{
20
18
using ( var db = new PostGisTestDataConnection ( TestDatabaseConnectionString ) )
21
19
{
22
- this . CurrentVersion = new Version ( db . Select ( ( ) => VersionFunctions . PostGISLibVersion ( ) ) ) ;
23
20
db . TestGeometries . Delete ( ) ;
24
21
db . TestGeographies . Delete ( ) ;
25
22
}
@@ -299,100 +296,103 @@ public void TestSTPoint()
299
296
[ Test ]
300
297
public void TestSTPointZ ( )
301
298
{
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 ;
303
305
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 ;
308
308
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
+ }
311
314
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 ) ;
316
326
}
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 ) ;
329
327
}
330
328
331
329
[ Test ]
332
330
public void TestSTPointM ( )
333
331
{
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 ;
335
338
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 ;
340
341
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
+ }
343
347
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 ) ;
348
359
}
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 ) ;
361
360
}
362
361
363
362
[ Test ]
364
363
public void TestSTPointZM ( )
365
364
{
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 ;
367
372
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 ;
373
375
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
+ }
376
381
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 ) ;
381
395
}
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 ) ;
396
396
}
397
397
398
398
[ Test ]
@@ -428,7 +428,7 @@ public void TestSTPolygon()
428
428
. Single ( ) ) ;
429
429
430
430
// TODO: ? reason of error? ST_Polygon(text) not works in 2.5 ?
431
- if ( this . CurrentVersion >= base . Version300 )
431
+ if ( base . CurrentVersion >= base . Version300 )
432
432
{
433
433
db . TestGeometries
434
434
. Value ( g => g . Id , 3 )
@@ -449,7 +449,7 @@ public void TestSTTileEnvelope()
449
449
{
450
450
using ( var db = new PostGisTestDataConnection ( TestDatabaseConnectionString ) )
451
451
{
452
- if ( this . CurrentVersion >= base . Version300 )
452
+ if ( base . CurrentVersion >= base . Version300 )
453
453
{
454
454
db . TestGeometries
455
455
. Value ( g => g . Id , 1 )
@@ -508,7 +508,7 @@ public void TestSTHexagon()
508
508
{
509
509
using ( var db = new PostGisTestDataConnection ( TestDatabaseConnectionString ) )
510
510
{
511
- if ( this . CurrentVersion >= base . Version310 )
511
+ if ( base . CurrentVersion >= base . Version310 )
512
512
{
513
513
var origin = db . Select ( ( ) => GeometryConstructors . STMakePoint ( 0 , 0 ) ) ;
514
514
@@ -528,7 +528,7 @@ public void TestSTSquare()
528
528
{
529
529
using ( var db = new PostGisTestDataConnection ( TestDatabaseConnectionString ) )
530
530
{
531
- if ( this . CurrentVersion >= Version310 )
531
+ if ( base . CurrentVersion >= Version310 )
532
532
{
533
533
var origin = db . Select ( ( ) => GeometryConstructors . STMakePoint ( 0 , 0 ) ) ;
534
534
0 commit comments