* fix #3469 by correcting overflow and enabling tests * pr feedback
This commit is contained in:
parent
ec02de828e
commit
762a259e9f
3 changed files with 10 additions and 8 deletions
|
@ -39,6 +39,7 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
"Microsoft.DotNet.Cli.Utils.Tests",
|
||||
"Microsoft.DotNet.Compiler.Common.Tests",
|
||||
"Microsoft.DotNet.ProjectModel.Tests",
|
||||
"Microsoft.DotNet.ProjectModel.Loader.Tests",
|
||||
"Microsoft.Extensions.DependencyModel.Tests",
|
||||
"Performance"
|
||||
};
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace Microsoft.DotNet.ProjectModel.Loader
|
|||
public static AssemblyLoadContext CreateLoadContext(
|
||||
this ProjectContext context,
|
||||
string runtimeIdentifier,
|
||||
string configuration) => CreateLoadContext(context, runtimeIdentifier, configuration);
|
||||
string configuration) => CreateLoadContext(context, runtimeIdentifier, configuration, outputPath: null);
|
||||
|
||||
public static AssemblyLoadContext CreateLoadContext(
|
||||
this ProjectContext context,
|
||||
|
|
|
@ -13,20 +13,21 @@ namespace Microsoft.DotNet.ProjectModel.Loader.Tests
|
|||
[Fact]
|
||||
public void LoadContextCanLoadProjectOutput()
|
||||
{
|
||||
var testInstance = TestAssetsManager.CreateTestInstance("TestProjectWithResource")
|
||||
var testInstance = TestAssetsManager.CreateTestInstance("TestProjectWithCultureSpecificResource")
|
||||
.WithLockFiles()
|
||||
.WithBuildArtifacts();
|
||||
|
||||
var rid = DependencyContext.Default.Target.Runtime;
|
||||
var runtimeIdentifier = DependencyContext.Default.Target.Runtime;
|
||||
|
||||
var context = ProjectContext.Create(testInstance.TestRoot, NuGetFramework.Parse("netcoreapp1.0"), new[] { rid });
|
||||
var loadContext = context.CreateLoadContext(rid, Constants.DefaultConfiguration);
|
||||
var context = ProjectContext.Create(testInstance.TestRoot, NuGetFramework.Parse("netcoreapp1.0"), new[] { runtimeIdentifier });
|
||||
var loadContext = context.CreateLoadContext(runtimeIdentifier, Constants.DefaultConfiguration);
|
||||
|
||||
// Load the project assembly
|
||||
var asm = loadContext.LoadFromAssemblyName(new AssemblyName("TestProjectWithResource"));
|
||||
var assembly = loadContext.LoadFromAssemblyName(new AssemblyName("TestProjectWithCultureSpecificResource"));
|
||||
|
||||
// Call Program.GetMessage() and assert the output
|
||||
var message = (string)asm.GetType("TestProjectWithCultureSpecificResource").GetRuntimeMethod("GetMessage", Type.EmptyTypes).Invoke(null, new object[0]);
|
||||
var type = assembly.GetType("TestProjectWithCultureSpecificResource.Program");
|
||||
var message = (string)type.GetRuntimeMethod("GetMessage", Type.EmptyTypes).Invoke(null, new object[0]);
|
||||
Assert.Equal("Hello World!" + Environment.NewLine + "Bonjour!", message);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue