@@ -36,40 +36,45 @@ public async Task BaselineTest(SharedFxConfig config)
36
36
}
37
37
38
38
var zipPath = Path . Combine ( AppContext . BaseDirectory , zipName ) ;
39
+ var tempDirectoryPath = Path . Combine ( Path . GetTempPath ( ) , Path . GetRandomFileName ( ) ) ;
39
40
40
- if ( ! Directory . Exists ( AppContext . BaseDirectory + "unzipped" ) )
41
+ try
41
42
{
42
- ZipFile . ExtractToDirectory ( AppContext . BaseDirectory , "unzipped" ) ;
43
- }
44
-
45
- var nugetAssembliesPath = Path . Combine ( AppContext . BaseDirectory , "unzipped" , "shared" , config . Name , previousVersion ) ;
43
+ Directory . CreateDirectory ( tempDirectoryPath ) ;
44
+ ZipFile . ExtractToDirectory ( zipPath , tempDirectoryPath ) ;
45
+ var nugetAssembliesPath = Path . Combine ( tempDirectoryPath , "shared" , config . Name , previousVersion ) ;
46
46
47
- var files = Directory . GetFiles ( nugetAssembliesPath , "*.dll" ) ;
48
- foreach ( var file in files )
49
- {
50
- try
47
+ var files = Directory . GetFiles ( nugetAssembliesPath , "*.dll" ) ;
48
+ foreach ( var file in files )
51
49
{
52
- var assemblyVersion = AssemblyName . GetAssemblyName ( file ) . Version ;
53
- var dllName = Path . GetFileName ( file ) ;
54
- nugetAssemblyVersions . Add ( dllName , assemblyVersion ) ;
50
+ try
51
+ {
52
+ var assemblyVersion = AssemblyName . GetAssemblyName ( file ) . Version ;
53
+ var dllName = Path . GetFileName ( file ) ;
54
+ nugetAssemblyVersions . Add ( dllName , assemblyVersion ) ;
55
+ }
56
+ catch ( BadImageFormatException ) { }
55
57
}
56
- catch ( BadImageFormatException ) { }
57
- }
58
58
59
- files = Directory . GetFiles ( dir , "*.dll" ) ;
59
+ files = Directory . GetFiles ( dir , "*.dll" ) ;
60
60
61
- Assert . All ( files , file =>
62
- {
63
- try
61
+ Assert . All ( files , file =>
64
62
{
65
- var localAssemblyVersion = AssemblyName . GetAssemblyName ( file ) . Version ;
66
- var dllName = Path . GetFileName ( file ) ;
67
- Assert . True ( nugetAssemblyVersions . ContainsKey ( dllName ) , $ "Expected { dllName } to be in the downloaded dlls") ;
68
- Assert . True ( localAssemblyVersion . CompareTo ( nugetAssemblyVersions [ dllName ] ) >= 0 , $ "Expected the local version of { dllName } to be greater than or equal to the already released version.") ;
69
- }
70
- catch ( BadImageFormatException ) { }
63
+ try
64
+ {
65
+ var localAssemblyVersion = AssemblyName . GetAssemblyName ( file ) . Version ;
66
+ var dllName = Path . GetFileName ( file ) ;
67
+ Assert . Contains ( dllName , nugetAssemblyVersions . Keys ) ;
68
+ Assert . InRange ( localAssemblyVersion . CompareTo ( nugetAssemblyVersions [ dllName ] ) , 0 , int . MaxValue ) ;
69
+ }
70
+ catch ( BadImageFormatException ) { }
71
71
72
- } ) ;
72
+ } ) ;
73
+ }
74
+ finally
75
+ {
76
+ Directory . Delete ( tempDirectoryPath , true ) ;
77
+ }
73
78
}
74
79
75
80
[ Theory ]
0 commit comments