1
- public class ExeFinderTests :
1
+ public class WildcardFileFinderTests :
2
2
XunitContextBase
3
3
{
4
4
[ Fact ]
@@ -9,45 +9,10 @@ public void MultiMatchDir_order1()
9
9
Directory . SetLastWriteTime ( dir2 , DateTime . Now . AddDays ( - 1 ) ) ;
10
10
Directory . SetLastWriteTime ( dir1 , DateTime . Now ) ;
11
11
var path = Path . Combine ( SourceDirectory , "DirForSearch" , "*" , "TextFile1.txt" ) ;
12
- Assert . True ( ExeFinder . TryFind ( path , out var result ) ) ;
12
+ Assert . True ( WildcardFileFinder . TryFind ( path , out var result ) ) ;
13
13
Assert . True ( File . Exists ( result ) , result ) ;
14
14
}
15
15
16
- [ Fact ]
17
- public void ExpandProgramFilesNoEnv ( )
18
- {
19
- var paths = ExeFinder . ExpandProgramFiles ( new [ ] { "Path" } ) . ToList ( ) ;
20
- Assert . Equal ( "Path" , paths . Single ( ) ) ;
21
- }
22
-
23
- [ Fact ]
24
- public void ExpandProgramFiles ( )
25
- {
26
- var paths = ExeFinder . ExpandProgramFiles ( new [ ] { @"%ProgramFiles%\Path" } ) . ToList ( ) ;
27
- Assert . Equal ( @"%ProgramFiles%\Path" , paths [ 0 ] ) ;
28
- Assert . Equal ( @"%ProgramW6432%\Path" , paths [ 1 ] ) ;
29
- Assert . Equal ( @"%ProgramFiles(x86)%\Path" , paths [ 2 ] ) ;
30
- }
31
-
32
- [ Fact ]
33
- public void EnvPath ( )
34
- {
35
- if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
36
- {
37
- var found = ExeFinder . TryFindInEnvPath ( "cmd.exe" , out var filePath ) ;
38
- Assert . Equal ( true , found ) ;
39
- Assert . Equal ( @"C:\Windows\System32\cmd.exe" , filePath , ignoreCase : true ) ;
40
- }
41
-
42
- if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) ||
43
- RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) )
44
- {
45
- var found = ExeFinder . TryFindInEnvPath ( "sh" , out var filePath ) ;
46
- Assert . Equal ( true , found ) ;
47
- Assert . NotNull ( filePath ) ;
48
- }
49
- }
50
-
51
16
[ Fact ]
52
17
public void MultiMatchDir_order2 ( )
53
18
{
@@ -56,21 +21,21 @@ public void MultiMatchDir_order2()
56
21
Directory . SetLastWriteTime ( dir1 , DateTime . Now . AddDays ( - 1 ) ) ;
57
22
Directory . SetLastWriteTime ( dir2 , DateTime . Now ) ;
58
23
var path = Path . Combine ( SourceDirectory , "DirForSearch" , "*" , "TextFile1.txt" ) ;
59
- Assert . True ( ExeFinder . TryFind ( path , out var result ) ) ;
24
+ Assert . True ( WildcardFileFinder . TryFind ( path , out var result ) ) ;
60
25
Assert . True ( File . Exists ( result ) , result ) ;
61
26
}
62
27
63
28
[ Fact ]
64
29
public void FullFilePath ( )
65
30
{
66
- Assert . True ( ExeFinder . TryFind ( SourceFile , out var result ) ) ;
31
+ Assert . True ( WildcardFileFinder . TryFind ( SourceFile , out var result ) ) ;
67
32
Assert . True ( File . Exists ( result ) , result ) ;
68
33
}
69
34
70
35
[ Fact ]
71
36
public void FullFilePath_missing ( )
72
37
{
73
- Assert . False ( ExeFinder . TryFind ( SourceFile . Replace ( ".cs" , ".foo" ) , out var result ) ) ;
38
+ Assert . False ( WildcardFileFinder . TryFind ( SourceFile . Replace ( ".cs" , ".foo" ) , out var result ) ) ;
74
39
Assert . Null ( result ) ;
75
40
}
76
41
@@ -94,21 +59,21 @@ public void FullFilePath_missing()
94
59
public void WildCardInDir ( )
95
60
{
96
61
var directory = SourceDirectory . Replace ( "Tests" , "Test*" ) ;
97
- var path = Path . Combine ( directory , "ExeFinderTests .cs" ) ;
98
- Assert . True ( ExeFinder . TryFind ( path , out var result ) ) ;
62
+ var path = Path . Combine ( directory , "WildcardFileFinderTests .cs" ) ;
63
+ Assert . True ( WildcardFileFinder . TryFind ( path , out var result ) ) ;
99
64
Assert . True ( File . Exists ( result ) , result ) ;
100
65
}
101
66
102
67
[ Fact ]
103
68
public void WildCardInDir_missing ( )
104
69
{
105
70
var directory = SourceDirectory . Replace ( "Tests" , "Test*.Foo" ) ;
106
- var path = Path . Combine ( directory , "ExeFinderTests .cs" ) ;
107
- Assert . False ( ExeFinder . TryFind ( path , out var result ) ) ;
71
+ var path = Path . Combine ( directory , "WildcardFileFinderTests .cs" ) ;
72
+ Assert . False ( WildcardFileFinder . TryFind ( path , out var result ) ) ;
108
73
Assert . Null ( result ) ;
109
74
}
110
75
111
- public ExeFinderTests ( ITestOutputHelper output ) :
76
+ public WildcardFileFinderTests ( ITestOutputHelper output ) :
112
77
base ( output )
113
78
{
114
79
}
0 commit comments