1- namespace UnitTests . Data . Providers
1+ using System . IO ;
2+ namespace UnitTests . Data . Providers
23{
34
45 [ NUnit . Framework . TestFixture ]
@@ -23,19 +24,21 @@ public void TestFixtureTearDown()
2324 ( ( double ) _msLineal / _msVector * 100 ) ) ) ;
2425 }
2526
26- private const string ReallyBigShapeFile =
27- //@"C:\Users\obe.IVV-AACHEN\Documents\vaglag\vaglag.shp";
28- @"C:\temp\Data\niedersachsen.shp\roads.shp" ;
27+
28+ private string GetTestFile ( )
29+ {
30+ return Path . Combine ( Path . GetDirectoryName ( this . GetType ( ) . Assembly . CodeBase . Replace ( "file:///" , "" ) ) , @"TestData\roads_ugl.shp" ) ;
31+ }
2932
3033 [ NUnit . Framework . Test ]
3134 public void TestPerformanceVectorLayer ( )
3235 {
33- NUnit . Framework . Assert . IsTrue ( System . IO . File . Exists ( ReallyBigShapeFile ) ,
36+ NUnit . Framework . Assert . IsTrue ( System . IO . File . Exists ( GetTestFile ( ) ) ,
3437 "Specified shapefile is not present!" ) ;
3538
3639 var map = new SharpMap . Map ( new System . Drawing . Size ( 1024 , 768 ) ) ;
3740
38- var shp = new SharpMap . Data . Providers . ShapeFile ( ReallyBigShapeFile , false , false ) ;
41+ var shp = new SharpMap . Data . Providers . ShapeFile ( GetTestFile ( ) , false , false ) ;
3942 var lyr = new SharpMap . Layers . VectorLayer ( "Roads" , shp ) ;
4043
4144 map . Layers . Add ( lyr ) ;
@@ -44,20 +47,20 @@ public void TestPerformanceVectorLayer()
4447 RepeatedRendering ( map , shp . GetFeatureCount ( ) , NumberOfRenderCycles , out _msVector ) ;
4548
4649 var res = map . GetMap ( ) ;
47- var path = System . IO . Path . ChangeExtension ( ReallyBigShapeFile , ".vector.png" ) ;
50+ var path = System . IO . Path . ChangeExtension ( GetTestFile ( ) , ".vector.png" ) ;
4851 res . Save ( path , System . Drawing . Imaging . ImageFormat . Png ) ;
4952 System . Console . WriteLine ( "\n Result saved at file://" + path . Replace ( '\\ ' , '/' ) ) ;
5053 }
5154
5255 [ NUnit . Framework . Test ]
5356 public void TestPerformanceLinealLayer ( )
5457 {
55- NUnit . Framework . Assert . IsTrue ( System . IO . File . Exists ( ReallyBigShapeFile ) ,
58+ NUnit . Framework . Assert . IsTrue ( System . IO . File . Exists ( GetTestFile ( ) ) ,
5659 "Specified shapefile is not present!" ) ;
5760
5861 var map = new SharpMap . Map ( new System . Drawing . Size ( 1024 , 768 ) ) ;
5962
60- var shp = new SharpMap . Data . Providers . ShapeFile ( ReallyBigShapeFile , false , false ) ;
63+ var shp = new SharpMap . Data . Providers . ShapeFile ( GetTestFile ( ) , false , false ) ;
6164 var lyr = new SharpMap . Layers . Symbolizer . LinealVectorLayer ( "Roads" , shp )
6265 {
6366 Symbolizer =
@@ -75,7 +78,7 @@ public void TestPerformanceLinealLayer()
7578 RepeatedRendering ( map , shp . GetFeatureCount ( ) , 1 , out tmp ) ;
7679
7780 var res = map . GetMap ( ) ;
78- var path = System . IO . Path . ChangeExtension ( ReallyBigShapeFile , "lineal.png" ) ;
81+ var path = System . IO . Path . ChangeExtension ( GetTestFile ( ) , "lineal.png" ) ;
7982 res . Save ( path , System . Drawing . Imaging . ImageFormat . Png ) ;
8083 System . Console . WriteLine ( "\n Result saved at file://" + path . Replace ( '\\ ' , '/' ) ) ;
8184 }
@@ -107,10 +110,10 @@ private static void RepeatedRendering(SharpMap.Map map, int numberOfFeatures, in
107110 [ NUnit . Framework . Test ]
108111 public void TestExecuteIntersectionQuery ( )
109112 {
110- NUnit . Framework . Assert . IsTrue ( System . IO . File . Exists ( ReallyBigShapeFile ) ,
113+ NUnit . Framework . Assert . IsTrue ( System . IO . File . Exists ( GetTestFile ( ) ) ,
111114 "Specified shapefile is not present!" ) ;
112115
113- var shp = new SharpMap . Data . Providers . ShapeFile ( ReallyBigShapeFile , false , false ) ;
116+ var shp = new SharpMap . Data . Providers . ShapeFile ( GetTestFile ( ) , false , false ) ;
114117 shp . Open ( ) ;
115118
116119 var fds = new SharpMap . Data . FeatureDataSet ( ) ;
@@ -144,10 +147,10 @@ public void TestExecuteIntersectionQuery()
144147 [ NUnit . Framework . Test ]
145148 public void TestExecuteIntersectionQueryWithFilterDelegate ( )
146149 {
147- NUnit . Framework . Assert . IsTrue ( System . IO . File . Exists ( ReallyBigShapeFile ) ,
150+ NUnit . Framework . Assert . IsTrue ( System . IO . File . Exists ( GetTestFile ( ) ) ,
148151 "Specified shapefile is not present!" ) ;
149152
150- var shp = new SharpMap . Data . Providers . ShapeFile ( ReallyBigShapeFile , false , false ) ;
153+ var shp = new SharpMap . Data . Providers . ShapeFile ( GetTestFile ( ) , false , false ) ;
151154 shp . Open ( ) ;
152155
153156 var fds = new SharpMap . Data . FeatureDataSet ( ) ;
0 commit comments