This commit is contained in:
Pavel Krymets 2016-03-04 14:12:16 -08:00
parent 304127ec0d
commit 1d7cff48d4
19 changed files with 159 additions and 156 deletions

View file

@ -17,13 +17,13 @@ namespace Microsoft.Extensions.DependencyModel
private static void CheckMetadata(Library library)
{
if (string.Equals(library.LibraryType, "package", StringComparison.OrdinalIgnoreCase))
if (string.Equals(library.Type, "package", StringComparison.OrdinalIgnoreCase))
{
if (string.IsNullOrWhiteSpace(library.PackageName) ||
if (string.IsNullOrWhiteSpace(library.Name) ||
string.IsNullOrWhiteSpace(library.Hash) ||
string.IsNullOrWhiteSpace(library.Version))
{
Error($"Empty metadata for {library.GetType().ToString()} {library.PackageName}");
Error($"Empty metadata for {library.GetType().ToString()} {library.Name}");
}
}
}

View file

@ -9,8 +9,8 @@ namespace Microsoft.Extensions.DependencyModel
{
public class CompilationLibrary : Library
{
public CompilationLibrary(string libraryType, string packageName, string version, string hash, string[] assemblies, Dependency[] dependencies, bool serviceable)
: base(libraryType, packageName, version, hash, dependencies, serviceable)
public CompilationLibrary(string type, string name, string version, string hash, string[] assemblies, Dependency[] dependencies, bool serviceable)
: base(type, name, version, hash, dependencies, serviceable)
{
Assemblies = assemblies;
}
@ -30,7 +30,7 @@ namespace Microsoft.Extensions.DependencyModel
var assemblies = new List<string>();
if (!DefaultResolver.TryResolveAssemblyPaths(this, assemblies))
{
throw new InvalidOperationException($"Can not find compilation library location for package '{PackageName}'");
throw new InvalidOperationException($"Can not find compilation library location for package '{Name}'");
}
return assemblies;
}

View file

@ -16,7 +16,7 @@ namespace Microsoft.Extensions.DependencyModel
private static readonly Lazy<DependencyContext> _defaultContext = new Lazy<DependencyContext>(LoadDefault);
public DependencyContext(string target,
public DependencyContext(string targetFramework,
string runtime,
bool isPortable,
CompilationOptions compilationOptions,
@ -24,9 +24,9 @@ namespace Microsoft.Extensions.DependencyModel
IEnumerable<RuntimeLibrary> runtimeLibraries,
IEnumerable<KeyValuePair<string, string[]>> runtimeGraph)
{
if (target == null)
if (targetFramework == null)
{
throw new ArgumentNullException(nameof(target));
throw new ArgumentNullException(nameof(targetFramework));
}
if (runtime == null)
{
@ -49,7 +49,7 @@ namespace Microsoft.Extensions.DependencyModel
throw new ArgumentNullException(nameof(runtimeGraph));
}
Target = target;
TargetFramework = targetFramework;
Runtime = runtime;
IsPortable = isPortable;
CompilationOptions = compilationOptions;
@ -60,7 +60,7 @@ namespace Microsoft.Extensions.DependencyModel
public static DependencyContext Default => _defaultContext.Value;
public string Target { get; }
public string TargetFramework { get; }
public string Runtime { get; }

View file

@ -42,8 +42,8 @@ namespace Microsoft.Extensions.DependencyModel
{
var identity = packageGroup.Key;
runtimeLibraries.Add(new RuntimeLibrary(
libraryType: identity.Item1,
packageName: identity.Item2,
type: identity.Item1,
name: identity.Item2,
version: identity.Item3,
hash: identity.Item4,
assemblies: packageGroup.Select(l => RuntimeAssembly.Create(l.AssetPath)).ToArray(),
@ -54,7 +54,7 @@ namespace Microsoft.Extensions.DependencyModel
}
return new DependencyContext(
target: string.Empty,
targetFramework: string.Empty,
runtime: string.Empty,
isPortable: false,
compilationOptions: CompilationOptions.Default,

View file

@ -39,8 +39,8 @@ namespace Microsoft.Extensions.DependencyModel
private JObject WriteRuntimeTargetInfo(DependencyContext context)
{
var target = context.IsPortable?
context.Target :
context.Target + DependencyContextStrings.VersionSeperator + context.Runtime;
context.TargetFramework :
context.TargetFramework + DependencyContextStrings.VersionSeperator + context.Runtime;
return new JObject(
new JProperty(DependencyContextStrings.RuntimeTargetNamePropertyName, target),
@ -51,7 +51,7 @@ namespace Microsoft.Extensions.DependencyModel
private JObject WriteRuntimeGraph(DependencyContext context)
{
return new JObject(
new JProperty(context.Target,
new JProperty(context.TargetFramework,
new JObject(
context.RuntimeGraph.Select(g => new JProperty(g.Key, new JArray(g.Value)))
)
@ -76,6 +76,7 @@ namespace Microsoft.Extensions.DependencyModel
AddPropertyIfNotNull(o, DependencyContextStrings.PublicSignPropertyName, compilationOptions.PublicSign);
AddPropertyIfNotNull(o, DependencyContextStrings.EmitEntryPointPropertyName, compilationOptions.EmitEntryPoint);
AddPropertyIfNotNull(o, DependencyContextStrings.GenerateXmlDocumentationPropertyName, compilationOptions.GenerateXmlDocumentation);
AddPropertyIfNotNull(o, DependencyContextStrings.DebugTypePropertyName, compilationOptions.DebugType);
return o;
}
@ -92,13 +93,13 @@ namespace Microsoft.Extensions.DependencyModel
if (context.IsPortable)
{
return new JObject(
new JProperty(context.Target, WritePortableTarget(context.RuntimeLibraries, context.CompileLibraries))
new JProperty(context.TargetFramework, WritePortableTarget(context.RuntimeLibraries, context.CompileLibraries))
);
}
return new JObject(
new JProperty(context.Target, WriteTarget(context.CompileLibraries)),
new JProperty(context.Target + DependencyContextStrings.VersionSeperator + context.Runtime,
new JProperty(context.TargetFramework, WriteTarget(context.CompileLibraries)),
new JProperty(context.TargetFramework + DependencyContextStrings.VersionSeperator + context.Runtime,
WriteTarget(context.RuntimeLibraries))
);
}
@ -107,13 +108,13 @@ namespace Microsoft.Extensions.DependencyModel
{
return new JObject(
libraries.Select(library =>
new JProperty(library.PackageName + DependencyContextStrings.VersionSeperator + library.Version, WriteTargetLibrary(library))));
new JProperty(library.Name + DependencyContextStrings.VersionSeperator + library.Version, WriteTargetLibrary(library))));
}
private JObject WritePortableTarget(IReadOnlyList<RuntimeLibrary> runtimeLibraries, IReadOnlyList<CompilationLibrary> compilationLibraries)
{
var runtimeLookup = runtimeLibraries.ToDictionary(l => l.PackageName);
var compileLookup = compilationLibraries.ToDictionary(l => l.PackageName);
var runtimeLookup = runtimeLibraries.ToDictionary(l => l.Name);
var compileLookup = compilationLibraries.ToDictionary(l => l.Name);
var targetObject = new JObject();
@ -130,12 +131,12 @@ namespace Microsoft.Extensions.DependencyModel
Debug.Assert(compilationLibrary.Serviceable == runtimeLibrary.Serviceable);
Debug.Assert(compilationLibrary.Version == runtimeLibrary.Version);
Debug.Assert(compilationLibrary.Hash == runtimeLibrary.Hash);
Debug.Assert(compilationLibrary.LibraryType == runtimeLibrary.LibraryType);
Debug.Assert(compilationLibrary.Type == runtimeLibrary.Type);
}
var library = (Library)compilationLibrary ?? (Library)runtimeLibrary;
targetObject.Add(
new JProperty(library.PackageName + DependencyContextStrings.VersionSeperator + library.Version,
new JProperty(library.Name + DependencyContextStrings.VersionSeperator + library.Version,
WritePortableTargetLibrary(runtimeLibrary, compilationLibrary)
)
);
@ -187,11 +188,11 @@ namespace Microsoft.Extensions.DependencyModel
libraryObject.Add(new JProperty(DependencyContextStrings.RuntimeAssembliesKey,
WriteAssemblies(runtimeLibrary.Assemblies.Select(a => a.Path)))
);
if (runtimeLibrary.SubTargets.Any())
if (runtimeLibrary.RuntimeTargets.Any())
{
libraryObject.Add(new JProperty(
DependencyContextStrings.RuntimeTargetsPropertyName,
new JObject(runtimeLibrary.SubTargets.SelectMany(WriteRuntimeTarget)))
new JObject(runtimeLibrary.RuntimeTargets.SelectMany(WriteRuntimeTarget)))
);
}
@ -256,7 +257,7 @@ namespace Microsoft.Extensions.DependencyModel
{
var allLibraries =
context.RuntimeLibraries.Cast<Library>().Concat(context.CompileLibraries)
.GroupBy(library => library.PackageName + DependencyContextStrings.VersionSeperator + library.Version);
.GroupBy(library => library.Name + DependencyContextStrings.VersionSeperator + library.Version);
return new JObject(allLibraries.Select(libraries=> new JProperty(libraries.Key, WriteLibrary(libraries.First()))));
}
@ -264,7 +265,7 @@ namespace Microsoft.Extensions.DependencyModel
private JObject WriteLibrary(Library library)
{
return new JObject(
new JProperty(DependencyContextStrings.TypePropertyName, library.LibraryType),
new JProperty(DependencyContextStrings.TypePropertyName, library.Type),
new JProperty(DependencyContextStrings.ServiceablePropertyName, library.Serviceable),
new JProperty(DependencyContextStrings.Sha512PropertyName, library.Hash)
);

View file

@ -7,19 +7,19 @@ namespace Microsoft.Extensions.DependencyModel
{
public class Library
{
public Library(string libraryType, string packageName, string version, string hash, Dependency[] dependencies, bool serviceable)
public Library(string type, string name, string version, string hash, Dependency[] dependencies, bool serviceable)
{
LibraryType = libraryType;
PackageName = packageName;
Type = type;
Name = name;
Version = version;
Hash = hash;
Dependencies = dependencies;
Serviceable = serviceable;
}
public string LibraryType { get; }
public string Type { get; }
public string PackageName { get; }
public string Name { get; }
public string Version { get; }

View file

@ -37,11 +37,11 @@ namespace Microsoft.Extensions.DependencyModel.Resolution
public bool TryResolveAssemblyPaths(CompilationLibrary library, List<string> assemblies)
{
var isProject = string.Equals(library.LibraryType, "project", StringComparison.OrdinalIgnoreCase);
var isProject = string.Equals(library.Type, "project", StringComparison.OrdinalIgnoreCase);
if (!isProject &&
!string.Equals(library.LibraryType, "package", StringComparison.OrdinalIgnoreCase) &&
!string.Equals(library.LibraryType, "referenceassembly", StringComparison.OrdinalIgnoreCase))
!string.Equals(library.Type, "package", StringComparison.OrdinalIgnoreCase) &&
!string.Equals(library.Type, "referenceassembly", StringComparison.OrdinalIgnoreCase))
{
return false;
}

View file

@ -36,7 +36,7 @@ namespace Microsoft.Extensions.DependencyModel.Resolution
public bool TryResolveAssemblyPaths(CompilationLibrary library, List<string> assemblies)
{
if (!string.Equals(library.LibraryType, "package", StringComparison.OrdinalIgnoreCase))
if (!string.Equals(library.Type, "package", StringComparison.OrdinalIgnoreCase))
{
return false;
}
@ -46,14 +46,14 @@ namespace Microsoft.Extensions.DependencyModel.Resolution
var hashSplitterPos = library.Hash.IndexOf('-');
if (hashSplitterPos <= 0 || hashSplitterPos == library.Hash.Length - 1)
{
throw new InvalidOperationException($"Invalid hash entry '{library.Hash}' for package '{library.PackageName}'");
throw new InvalidOperationException($"Invalid hash entry '{library.Hash}' for package '{library.Name}'");
}
string packagePath;
if (ResolverUtils.TryResolvePackagePath(_fileSystem, library, _packageCacheDirectory, out packagePath))
{
var hashAlgorithm = library.Hash.Substring(0, hashSplitterPos);
var cacheHashPath = Path.Combine(packagePath, $"{library.PackageName}.{library.Version}.nupkg.{hashAlgorithm}");
var cacheHashPath = Path.Combine(packagePath, $"{library.Name}.{library.Version}.nupkg.{hashAlgorithm}");
if (_fileSystem.File.Exists(cacheHashPath) &&
_fileSystem.File.ReadAllText(cacheHashPath) == library.Hash.Substring(hashSplitterPos + 1))

View file

@ -65,7 +65,7 @@ namespace Microsoft.Extensions.DependencyModel.Resolution
public bool TryResolveAssemblyPaths(CompilationLibrary library, List<string> assemblies)
{
if (string.IsNullOrEmpty(_nugetPackageDirectory) ||
!string.Equals(library.LibraryType, "package", StringComparison.OrdinalIgnoreCase))
!string.Equals(library.Type, "package", StringComparison.OrdinalIgnoreCase))
{
return false;
}

View file

@ -41,7 +41,7 @@ namespace Microsoft.Extensions.DependencyModel.Resolution
public bool TryResolveAssemblyPaths(CompilationLibrary library, List<string> assemblies)
{
if (!string.Equals(library.LibraryType, "referenceassembly", StringComparison.OrdinalIgnoreCase))
if (!string.Equals(library.Type, "referenceassembly", StringComparison.OrdinalIgnoreCase))
{
return false;
}
@ -50,7 +50,7 @@ namespace Microsoft.Extensions.DependencyModel.Resolution
string fullName;
if (!TryResolveReferenceAssembly(assembly, out fullName))
{
throw new InvalidOperationException($"Can not find reference assembly '{assembly}' file for package {library.PackageName}");
throw new InvalidOperationException($"Can not find reference assembly '{assembly}' file for package {library.Name}");
}
assemblies.Add(fullName);
}

View file

@ -12,7 +12,7 @@ namespace Microsoft.Extensions.DependencyModel.Resolution
{
internal static bool TryResolvePackagePath(IFileSystem fileSystem, CompilationLibrary library, string basePath, out string packagePath)
{
packagePath = Path.Combine(basePath, library.PackageName, library.Version);
packagePath = Path.Combine(basePath, library.Name, library.Version);
if (fileSystem.Directory.Exists(packagePath))
{
return true;
@ -27,7 +27,7 @@ namespace Microsoft.Extensions.DependencyModel.Resolution
string fullName;
if (!TryResolveAssemblyFile(fileSystem, basePath, assembly, out fullName))
{
throw new InvalidOperationException($"Can not find assembly file for package {library.PackageName} at '{fullName}'");
throw new InvalidOperationException($"Can not find assembly file for package {library.Name} at '{fullName}'");
}
yield return fullName;
}

View file

@ -9,22 +9,22 @@ namespace Microsoft.Extensions.DependencyModel
public class RuntimeLibrary : Library
{
public RuntimeLibrary(
string libraryType,
string packageName,
string type,
string name,
string version,
string hash,
RuntimeAssembly[] assemblies,
RuntimeTarget[] subTargets,
Dependency[] dependencies,
bool serviceable)
: base(libraryType, packageName, version, hash, dependencies, serviceable)
: base(type, name, version, hash, dependencies, serviceable)
{
Assemblies = assemblies;
SubTargets = subTargets;
RuntimeTargets = subTargets;
}
public IReadOnlyList<RuntimeAssembly> Assemblies { get; }
public IReadOnlyList<RuntimeTarget> SubTargets { get; }
public IReadOnlyList<RuntimeTarget> RuntimeTargets { get; }
}
}

View file

@ -68,87 +68,12 @@ namespace Microsoft.Extensions.DependencyModel.Tests
context.CompilationOptions.Platform.Should().Be("Platform");
}
private LibraryExport Export(
LibraryDescription description,
IEnumerable<LibraryAsset> compilationAssemblies = null,
IEnumerable<LibraryAsset> runtimeAssemblies = null)
{
return new LibraryExport(
description,
compilationAssemblies ?? Enumerable.Empty<LibraryAsset>(),
Enumerable.Empty<LibraryAsset>(),
runtimeAssemblies ?? Enumerable.Empty<LibraryAsset>(),
Enumerable.Empty<LibraryAsset>(),
Enumerable.Empty<LibraryAsset>(),
Enumerable.Empty<LibraryAsset>(),
Enumerable.Empty<AnalyzerReference>()
);
}
private PackageDescription PackageDescription(
string name = null,
NuGetVersion version = null,
string hash = null,
IEnumerable<LibraryRange> dependencies = null,
bool? servicable = null)
{
return new PackageDescription(
"PATH",
new LockFilePackageLibrary()
{
Files = new string[] { },
IsServiceable = servicable ?? false,
Name = name ?? _defaultName,
Version = version ?? _defaultVersion,
Sha512 = hash ?? _defaultHash
},
new LockFileTargetLibrary(),
dependencies ?? Enumerable.Empty<LibraryRange>(),
true);
}
private ProjectDescription ProjectDescription(
string name = null,
NuGetVersion version = null,
IEnumerable<LibraryRange> dependencies = null)
{
return new ProjectDescription(
new LibraryRange(
name ?? _defaultName,
new VersionRange(version ?? _defaultVersion),
LibraryType.Project,
LibraryDependencyType.Default
),
new Project(),
dependencies ?? Enumerable.Empty<LibraryRange>(),
new TargetFrameworkInformation(),
true);
}
private LibraryDescription ReferenceAssemblyDescription(
string name = null,
NuGetVersion version = null)
{
return new LibraryDescription(
new LibraryIdentity(
name ?? _defaultName,
version ?? _defaultVersion,
LibraryType.ReferenceAssembly),
string.Empty, // Framework assemblies don't have hashes
"PATH",
Enumerable.Empty<LibraryRange>(),
_defaultFramework,
true,
true);
}
[Fact]
public void FillsRuntimeAndTarget()
{
var context = Build(target: new NuGetFramework("SomeFramework",new Version(1,2)), runtime: "win8-32");
context.Runtime.Should().Be("win8-32");
context.Target.Should().Be("SomeFramework,Version=v1.2");
var context = Build(target: new NuGetFramework("SomeFramework",new Version(1,2)), runtime: "win8-x86");
context.Runtime.Should().Be("win8-x86");
context.TargetFramework.Should().Be("SomeFramework,Version=v1.2");
}
[Fact]
@ -194,16 +119,16 @@ namespace Microsoft.Extensions.DependencyModel.Tests
context.RuntimeLibraries.Should().HaveCount(2);
var lib = context.RuntimeLibraries.Should().Contain(l => l.PackageName == "Pack.Age").Subject;
lib.LibraryType.Should().Be("package");
var lib = context.RuntimeLibraries.Should().Contain(l => l.Name == "Pack.Age").Subject;
lib.Type.Should().Be("package");
lib.Serviceable.Should().BeTrue();
lib.Hash.Should().Be("sha512-Hash");
lib.Version.Should().Be("1.2.3");
lib.Dependencies.Should().OnlyContain(l => l.Name == "System.Collections" && l.Version == "3.3.3");
lib.Assemblies.Should().OnlyContain(l => l.Path == "lib/Pack.Age.dll");
var asm = context.RuntimeLibraries.Should().Contain(l => l.PackageName == "System.Collections").Subject;
asm.LibraryType.Should().Be("referenceassembly");
var asm = context.RuntimeLibraries.Should().Contain(l => l.Name == "System.Collections").Subject;
asm.Type.Should().Be("referenceassembly");
asm.Version.Should().Be("3.3.3");
asm.Hash.Should().BeEmpty();
asm.Dependencies.Should().BeEmpty();
@ -242,16 +167,16 @@ namespace Microsoft.Extensions.DependencyModel.Tests
context.CompileLibraries.Should().HaveCount(2);
var lib = context.CompileLibraries.Should().Contain(l => l.PackageName == "Pack.Age").Subject;
lib.LibraryType.Should().Be("package");
var lib = context.CompileLibraries.Should().Contain(l => l.Name == "Pack.Age").Subject;
lib.Type.Should().Be("package");
lib.Serviceable.Should().BeTrue();
lib.Hash.Should().Be("sha512-Hash");
lib.Version.Should().Be("1.2.3");
lib.Dependencies.Should().OnlyContain(l => l.Name == "System.Collections" && l.Version == "3.3.3");
lib.Assemblies.Should().OnlyContain(a => a == "lib/Pack.Age.dll");
var asm = context.CompileLibraries.Should().Contain(l => l.PackageName == "System.Collections").Subject;
asm.LibraryType.Should().Be("referenceassembly");
var asm = context.CompileLibraries.Should().Contain(l => l.Name == "System.Collections").Subject;
asm.Type.Should().Be("referenceassembly");
asm.Version.Should().Be("3.3.3");
asm.Hash.Should().BeEmpty();
asm.Dependencies.Should().BeEmpty();
@ -271,7 +196,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
})
});
var asm = context.CompileLibraries.Should().Contain(l => l.PackageName == "System.Collections").Subject;
var asm = context.CompileLibraries.Should().Contain(l => l.Name == "System.Collections").Subject;
asm.Assemblies.Should().OnlyContain(a => a == Path.Combine("sub", "System.Collections.dll"));
}
@ -293,9 +218,85 @@ namespace Microsoft.Extensions.DependencyModel.Tests
version: new NuGetVersion(3, 3, 3)))
});
var lib = context.CompileLibraries.Should().Contain(l => l.PackageName == "Pack.Age").Subject;
var lib = context.CompileLibraries.Should().Contain(l => l.Name == "Pack.Age").Subject;
lib.Dependencies.Should().BeEmpty();
}
private LibraryExport Export(
LibraryDescription description,
IEnumerable<LibraryAsset> compilationAssemblies = null,
IEnumerable<LibraryAsset> runtimeAssemblies = null)
{
return new LibraryExport(
description,
compilationAssemblies ?? Enumerable.Empty<LibraryAsset>(),
Enumerable.Empty<LibraryAsset>(),
runtimeAssemblies ?? Enumerable.Empty<LibraryAsset>(),
Enumerable.Empty<LibraryAsset>(),
Enumerable.Empty<LibraryAsset>(),
Enumerable.Empty<LibraryAsset>(),
Enumerable.Empty<AnalyzerReference>()
);
}
private PackageDescription PackageDescription(
string name = null,
NuGetVersion version = null,
string hash = null,
IEnumerable<LibraryRange> dependencies = null,
bool? servicable = null)
{
return new PackageDescription(
"PATH",
new LockFilePackageLibrary()
{
Files = new string[] { },
IsServiceable = servicable ?? false,
Name = name ?? _defaultName,
Version = version ?? _defaultVersion,
Sha512 = hash ?? _defaultHash
},
new LockFileTargetLibrary(),
dependencies ?? Enumerable.Empty<LibraryRange>(),
true,
true);
}
private ProjectDescription ProjectDescription(
string name = null,
NuGetVersion version = null,
IEnumerable<LibraryRange> dependencies = null)
{
return new ProjectDescription(
new LibraryRange(
name ?? _defaultName,
new VersionRange(version ?? _defaultVersion),
LibraryType.Project,
LibraryDependencyType.Default
),
new Project(),
dependencies ?? Enumerable.Empty<LibraryRange>(),
new TargetFrameworkInformation(),
true);
}
private LibraryDescription ReferenceAssemblyDescription(
string name = null,
NuGetVersion version = null)
{
return new LibraryDescription(
new LibraryIdentity(
name ?? _defaultName,
version ?? _defaultVersion,
LibraryType.ReferenceAssembly),
string.Empty, // Framework assemblies don't have hashes
"PATH",
Enumerable.Empty<LibraryRange>(),
_defaultFramework,
true,
true);
}
}
}

View file

@ -32,8 +32,8 @@ namespace Microsoft.Extensions.DependencyModel.Tests
");
context.RuntimeLibraries.Should().HaveCount(1);
var library = context.RuntimeLibraries.Single();
library.LibraryType.Should().Be("Package");
library.PackageName.Should().Be("runtime.any.System.AppContext");
library.Type.Should().Be("Package");
library.Name.Should().Be("runtime.any.System.AppContext");
library.Version.Should().Be("4.1.0-rc2-23811");
library.Hash.Should().Be("sha512-1");
library.Assemblies.Should().HaveCount(2).And

View file

@ -34,7 +34,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
}
}");
context.IsPortable.Should().BeFalse();
context.Target.Should().Be(".NETStandardApp,Version=v1.5");
context.TargetFramework.Should().Be(".NETStandardApp,Version=v1.5");
context.Runtime.Should().Be("osx.10.10-x64");
}
@ -56,7 +56,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
"".NETStandardApp,Version=v1.5"": {}
}
}");
context.Target.Should().Be(".NETStandardApp,Version=v1.5");
context.TargetFramework.Should().Be(".NETStandardApp,Version=v1.5");
}
[Fact]
@ -119,16 +119,16 @@ namespace Microsoft.Extensions.DependencyModel.Tests
}
}");
context.CompileLibraries.Should().HaveCount(2);
var project = context.CompileLibraries.Should().Contain(l => l.PackageName == "MyApp").Subject;
var project = context.CompileLibraries.Should().Contain(l => l.Name == "MyApp").Subject;
project.Version.Should().Be("1.0.1");
project.Assemblies.Should().BeEquivalentTo("MyApp.dll");
project.LibraryType.Should().Be("project");
project.Type.Should().Be("project");
var package = context.CompileLibraries.Should().Contain(l => l.PackageName == "System.Banana").Subject;
var package = context.CompileLibraries.Should().Contain(l => l.Name == "System.Banana").Subject;
package.Version.Should().Be("1.0.0");
package.Assemblies.Should().BeEquivalentTo("ref/dotnet5.4/System.Banana.dll");
package.Hash.Should().Be("HASH-System.Banana");
package.LibraryType.Should().Be("package");
package.Type.Should().Be("package");
package.Serviceable.Should().Be(false);
}
@ -178,20 +178,20 @@ namespace Microsoft.Extensions.DependencyModel.Tests
}
}");
context.CompileLibraries.Should().HaveCount(2);
var project = context.RuntimeLibraries.Should().Contain(l => l.PackageName == "MyApp").Subject;
var project = context.RuntimeLibraries.Should().Contain(l => l.Name == "MyApp").Subject;
project.Version.Should().Be("1.0.1");
project.Assemblies.Should().Contain(a => a.Path == "MyApp.dll");
project.LibraryType.Should().Be("project");
project.Type.Should().Be("project");
var package = context.RuntimeLibraries.Should().Contain(l => l.PackageName == "System.Banana").Subject;
var package = context.RuntimeLibraries.Should().Contain(l => l.Name == "System.Banana").Subject;
package.Version.Should().Be("1.0.0");
package.Hash.Should().Be("HASH-System.Banana");
package.LibraryType.Should().Be("package");
package.Type.Should().Be("package");
package.Serviceable.Should().Be(false);
package.Assemblies.Should().Contain(a => a.Path == "lib/dotnet5.4/System.Banana.dll");
var target = package.SubTargets.Should().Contain(t => t.Runtime == "win7-x64").Subject;
var target = package.RuntimeTargets.Should().Contain(t => t.Runtime == "win7-x64").Subject;
target.Assemblies.Should().Contain(a => a.Path == "lib/win7/System.Banana.dll");
target.NativeLibraries.Should().Contain("lib/win7/Banana.dll");
}

View file

@ -169,7 +169,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
"HASH",
new [] { RuntimeAssembly.Create("Banana.dll")},
new []
{
{Lock
new RuntimeTarget("win7-x64",
new [] { RuntimeAssembly.Create("Banana.Win7-x64.dll") },
new [] { "Banana.Win7-x64.so" }
@ -334,6 +334,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
optimize: true,
keyFile: "Key.snk",
delaySign: true,
debugType: null,
publicSign: true,
emitEntryPoint: true,
generateXmlDocumentation: true)));

View file

@ -49,7 +49,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
var exception = Assert.Throws<InvalidOperationException>(() => resolver.TryResolveAssemblyPaths(library, null));
exception.Message.Should()
.Contain(library.Hash)
.And.Contain(library.PackageName);
.And.Contain(library.Name);
}
[Fact]
@ -114,7 +114,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
var exception = Assert.Throws<InvalidOperationException>(() => resolver.TryResolveAssemblyPaths(library, assemblies));
exception.Message.Should()
.Contain(F.SecondAssemblyPath)
.And.Contain(library.PackageName);
.And.Contain(library.Name);
}
private IEnvironment GetDefaultEnviroment()

View file

@ -95,7 +95,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
var exception = Assert.Throws<InvalidOperationException>(() => resolver.TryResolveAssemblyPaths(library, assemblies));
exception.Message.Should()
.Contain(F.SecondAssemblyPath)
.And.Contain(library.PackageName);
.And.Contain(library.Name);
}
}
}

View file

@ -153,7 +153,7 @@ namespace Microsoft.Extensions.DependencyModel.Tests
exception.Message.Should()
.Contain(F.SecondAssemblyPath)
.And.Contain(library.PackageName);
.And.Contain(library.Name);
}
}
}