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,40 +36,45 @@ 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");
foreach (var file in files)
var files = Directory.GetFiles(nugetAssembliesPath, "*.dll");
foreach (var file in files)
{
try
{ {
var assemblyVersion = AssemblyName.GetAssemblyName(file).Version; try
var dllName = Path.GetFileName(file); {
nugetAssemblyVersions.Add(dllName, assemblyVersion); var assemblyVersion = AssemblyName.GetAssemblyName(file).Version;
var dllName = Path.GetFileName(file);
nugetAssemblyVersions.Add(dllName, assemblyVersion);
}
catch (BadImageFormatException) { }
} }
catch (BadImageFormatException) { }
}
files = Directory.GetFiles(dir, "*.dll"); files = Directory.GetFiles(dir, "*.dll");
Assert.All(files, file => Assert.All(files, file =>
{
try
{ {
var localAssemblyVersion = AssemblyName.GetAssemblyName(file).Version; try
var dllName = Path.GetFileName(file); {
Assert.True(nugetAssemblyVersions.ContainsKey(dllName), $"Expected {dllName} to be in the downloaded dlls"); var localAssemblyVersion = AssemblyName.GetAssemblyName(file).Version;
Assert.True(localAssemblyVersion.CompareTo(nugetAssemblyVersions[dllName]) >= 0, $"Expected the local version of {dllName} to be greater than or equal to the already released version."); var dllName = Path.GetFileName(file);
} Assert.Contains(dllName, nugetAssemblyVersions.Keys);
catch (BadImageFormatException) { } Assert.InRange(localAssemblyVersion.CompareTo(nugetAssemblyVersions[dllName]), 0, int.MaxValue);
}
catch (BadImageFormatException) { }
}); });
}
finally
{
Directory.Delete(tempDirectoryPath, true);
}
} }
[Theory] [Theory]