File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11using System ;
2- using System . Collections . Generic ;
32using System . IO ;
4- using System . Linq ;
5- using System . Text ;
6- using System . Threading . Tasks ;
73
84namespace TestPeterPiper . Support
95{
106 public static class PathSupport
117 {
12- public static string AssemblyDirectory
13- {
14- get
15- {
16- string codeBase = System . Reflection . Assembly . GetExecutingAssembly ( ) . Location ;
17- UriBuilder uri = new UriBuilder ( codeBase ) ;
18- string path = Uri . UnescapeDataString ( uri . Path ) ;
19- var DirInfo = new DirectoryInfo ( path ) ;
20- return DirInfo . Parent ! . FullName ; ;
21- }
22- }
8+ public static string AssemblyDirectory => AppContext . BaseDirectory ;
239 }
2410}
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ public class TestBase64
1919 [ TestMethod ]
2020 public void DecoderTest ( )
2121 {
22- string path = Support . PathSupport . AssemblyDirectory + @"\ TestResource\ ED Data Test.zip";
22+ string path = Path . Combine ( Support . PathSupport . AssemblyDirectory , " TestResource" , " ED Data Test.zip") ;
2323
2424 string NewPath = String . Empty ;
2525 byte [ ] item = File . ReadAllBytes ( path ) ;
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ public class TestHl7Reader
2121 public void Hl7ReaderConstructorTest ( )
2222 {
2323
24- string path = Support . PathSupport . AssemblyDirectory + @"\ TestResource\ TestSetOfMsg.dat";
24+ string path = Path . Combine ( Support . PathSupport . AssemblyDirectory , " TestResource" , " TestSetOfMsg.dat") ;
2525
2626 Hl7StreamReader target = new Hl7StreamReader ( path ) ;
2727 target . Close ( ) ;
@@ -57,8 +57,8 @@ public void Hl7ReaderConstructorTest()
5757 public void ReadTest ( )
5858 {
5959
60- string readpath = Support . PathSupport . AssemblyDirectory + " \\ TestResource\\ TestSetOfMsg.dat";
61- string writepath = Support . PathSupport . AssemblyDirectory + " \\ TestResource\\ TestSetOfMsg2.dat";
60+ string readpath = Path . Combine ( Support . PathSupport . AssemblyDirectory , " TestResource" , " TestSetOfMsg.dat") ;
61+ string writepath = Path . Combine ( Support . PathSupport . AssemblyDirectory , " TestResource" , " TestSetOfMsg2.dat") ;
6262 if ( File . Exists ( writepath ) )
6363 File . Delete ( writepath ) ;
6464
You can’t perform that action at this time.
0 commit comments