Update baseline test (#8014)

This commit is contained in:
Mikael Mengistu 2019-02-28 17:11:23 -08:00 committed by GitHub
parent f8c3f02345
commit d2a4435ac8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 30 additions and 25 deletions

View File

@ -36,13 +36,13 @@ namespace Microsoft.AspNetCore
} }
var zipPath = Path.Combine(AppContext.BaseDirectory, zipName); var zipPath = Path.Combine(AppContext.BaseDirectory, zipName);
var tempDirectoryPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
if (!Directory.Exists(AppContext.BaseDirectory + "unzipped")) try
{ {
ZipFile.ExtractToDirectory(AppContext.BaseDirectory, "unzipped"); Directory.CreateDirectory(tempDirectoryPath);
} ZipFile.ExtractToDirectory(zipPath, tempDirectoryPath);
var nugetAssembliesPath = Path.Combine(tempDirectoryPath, "shared", config.Name, previousVersion);
var nugetAssembliesPath = Path.Combine(AppContext.BaseDirectory, "unzipped", "shared", config.Name, previousVersion);
var files = Directory.GetFiles(nugetAssembliesPath, "*.dll"); var files = Directory.GetFiles(nugetAssembliesPath, "*.dll");
foreach (var file in files) foreach (var file in files)
@ -64,13 +64,18 @@ namespace Microsoft.AspNetCore
{ {
var localAssemblyVersion = AssemblyName.GetAssemblyName(file).Version; var localAssemblyVersion = AssemblyName.GetAssemblyName(file).Version;
var dllName = Path.GetFileName(file); var dllName = Path.GetFileName(file);
Assert.True(nugetAssemblyVersions.ContainsKey(dllName), $"Expected {dllName} to be in the downloaded dlls"); Assert.Contains(dllName, nugetAssemblyVersions.Keys);
Assert.True(localAssemblyVersion.CompareTo(nugetAssemblyVersions[dllName]) >= 0, $"Expected the local version of {dllName} to be greater than or equal to the already released version."); Assert.InRange(localAssemblyVersion.CompareTo(nugetAssemblyVersions[dllName]), 0, int.MaxValue);
} }
catch (BadImageFormatException) { } catch (BadImageFormatException) { }
}); });
} }
finally
{
Directory.Delete(tempDirectoryPath, true);
}
}
[Theory] [Theory]
[MemberData(nameof(GetSharedFxConfig))] [MemberData(nameof(GetSharedFxConfig))]