@@ -24,5 +24,60 @@ public void ClearHotReloadEnvironmentVariables_RemovesHotReloadStartup_InCaseInv
24
24
var customStartupHook = "/path/mycoolstartup.dll" ;
25
25
Assert . Equal ( customStartupHook , StartupHook . RemoveCurrentAssembly ( customStartupHook + Path . PathSeparator + typeof ( StartupHook ) . Assembly . Location . ToUpperInvariant ( ) ) ) ;
26
26
}
27
+
28
+ [ Theory ]
29
+ [ CombinatorialData ]
30
+ public void IsMatchingProcess_Matching_SimpleName (
31
+ [ CombinatorialValues ( "" , ".dll" , ".exe" ) ] string extension ,
32
+ [ CombinatorialValues ( "" , ".dll" , ".exe" ) ] string targetExtension )
33
+ {
34
+ var dir = Path . GetDirectoryName ( typeof ( StartupHookTests ) . Assembly . Location ) ! ;
35
+ var name = "a" ;
36
+ var processPath = Path . Combine ( dir , name + extension ) ;
37
+ var targetProcessPath = Path . Combine ( dir , "a" + targetExtension ) ;
38
+
39
+ Assert . True ( StartupHook . IsMatchingProcess ( processPath , targetProcessPath ) ) ;
40
+ }
41
+
42
+ [ Theory ]
43
+ [ CombinatorialData ]
44
+ public void IsMatchingProcess_Matching_DotInName (
45
+ [ CombinatorialValues ( "" , ".dll" , ".exe" ) ] string extension ,
46
+ [ CombinatorialValues ( "" , ".dll" , ".exe" ) ] string targetExtension )
47
+ {
48
+ var dir = Path . GetDirectoryName ( typeof ( StartupHookTests ) . Assembly . Location ) ! ;
49
+ var name = "a.b" ;
50
+ var processPath = Path . Combine ( dir , name + extension ) ;
51
+ var targetProcessPath = Path . Combine ( dir , name + targetExtension ) ;
52
+
53
+ Assert . True ( StartupHook . IsMatchingProcess ( processPath , targetProcessPath ) ) ;
54
+ }
55
+
56
+ [ Theory ]
57
+ [ CombinatorialData ]
58
+ public void IsMatchingProcess_Matching_DotDllInName (
59
+ [ CombinatorialValues ( "" , ".dll" , ".exe" ) ] string extension ,
60
+ [ CombinatorialValues ( "" , ".dll" , ".exe" ) ] string targetExtension )
61
+ {
62
+ var dir = Path . GetDirectoryName ( typeof ( StartupHookTests ) . Assembly . Location ) ! ;
63
+ var name = "a.dll" ;
64
+ var processPath = Path . Combine ( dir , name + extension ) ;
65
+ var targetProcessPath = Path . Combine ( dir , name + targetExtension ) ;
66
+
67
+ Assert . True ( StartupHook . IsMatchingProcess ( processPath , targetProcessPath ) ) ;
68
+ }
69
+
70
+ [ Theory ]
71
+ [ CombinatorialData ]
72
+ public void IsMatchingProcess_NotMatching (
73
+ [ CombinatorialValues ( "" , ".dll" , ".exe" ) ] string extension ,
74
+ [ CombinatorialValues ( "" , ".dll" , ".exe" ) ] string targetExtension )
75
+ {
76
+ var dir = Path . GetDirectoryName ( typeof ( StartupHookTests ) . Assembly . Location ) ! ;
77
+ var processPath = Path . Combine ( dir , "a" + extension ) ;
78
+ var targetProcessPath = Path . Combine ( dir , "b" + targetExtension ) ;
79
+
80
+ Assert . False ( StartupHook . IsMatchingProcess ( processPath , targetProcessPath ) ) ;
81
+ }
27
82
}
28
83
}
0 commit comments