public partial class ComponentActivation : IClassFixture<ComponentActivation.SharedTestState>
{
private const string ComponentActivationArg = "load_assembly_and_get_function_pointer";
-
+
private readonly SharedTestState sharedState;
public ComponentActivation(SharedTestState sharedTestState)
sharedState = sharedTestState;
}
- //[Theory]
- //[InlineData(true, true, true)]
- //[InlineData(false, true, true)]
- //[InlineData(true, false, true)]
- //[InlineData(true, true, false)]
+ [Theory]
+ [InlineData(true, true, true)]
+ [InlineData(false, true, true)]
+ [InlineData(true, false, true)]
+ [InlineData(true, true, false)]
public void CallDelegate(bool validPath, bool validType, bool validMethod)
{
var componentProject = sharedState.ComponentWithNoDependenciesFixture.TestProject;
{
ComponentActivationArg,
sharedState.HostFxrPath,
- sharedState.RuntimeConfigPath,
+ componentProject.RuntimeConfigJson,
validPath ? componentProject.AppDll : "BadPath...",
validType ? sharedState.ComponentTypeName : $"Component.BadType, {componentProject.AssemblyName}",
validMethod ? sharedState.ComponentEntryPoint1 : "BadMethod",
.Execute();
result.Should()
- .InitializeContextForConfig(sharedState.RuntimeConfigPath);
+ .InitializeContextForConfig(componentProject.RuntimeConfigJson);
if (validPath && validType && validMethod)
{
}
}
- //[Theory]
- //[InlineData(1)]
- //[InlineData(10)]
+ [Theory]
+ [InlineData(1)]
+ [InlineData(10)]
public void CallDelegate_MultipleEntryPoints(int callCount)
{
var componentProject = sharedState.ComponentWithNoDependenciesFixture.TestProject;
{
ComponentActivationArg,
sharedState.HostFxrPath,
- sharedState.RuntimeConfigPath,
+ componentProject.RuntimeConfigJson,
};
string[] componentInfo =
- {
+ {
// ComponentEntryPoint1
componentProject.AppDll,
sharedState.ComponentTypeName,
.Execute();
result.Should().Pass()
- .And.InitializeContextForConfig(sharedState.RuntimeConfigPath);
+ .And.InitializeContextForConfig(componentProject.RuntimeConfigJson);
for (int i = 1; i <= callCount; ++i)
{
}
}
- //[Theory]
- //[InlineData(1)]
- //[InlineData(10)]
+ [Theory]
+ [InlineData(1)]
+ [InlineData(10)]
public void CallDelegate_MultipleComponents(int callCount)
{
var componentProject = sharedState.ComponentWithNoDependenciesFixture.TestProject;
{
ComponentActivationArg,
sharedState.HostFxrPath,
- sharedState.RuntimeConfigPath,
+ componentProject.RuntimeConfigJson,
};
string[] componentInfo =
- {
+ {
// Component
componentProject.AppDll,
sharedState.ComponentTypeName,
.Execute();
result.Should().Pass()
- .And.InitializeContextForConfig(sharedState.RuntimeConfigPath);
+ .And.InitializeContextForConfig(componentProject.RuntimeConfigJson);
for (int i = 1; i <= callCount; ++i)
{
public string HostFxrPath { get; }
public string DotNetRoot { get; }
- public string RuntimeConfigPath { get; }
-
public TestProjectFixture ComponentWithNoDependenciesFixture { get; }
public string ComponentTypeName { get; }
public string ComponentEntryPoint1 => "ComponentEntryPoint1";
.EnsureRestored(RepoDirectories.CorehostPackages)
.PublishProject();
ComponentTypeName = $"Component.Component, {ComponentWithNoDependenciesFixture.TestProject.AssemblyName}";
-
- string configDir = Path.Combine(BaseDirectory, "config");
- Directory.CreateDirectory(configDir);
- RuntimeConfigPath = Path.Combine(configDir, "Component.runtimeconfig.json");
- RuntimeConfig.FromFile(RuntimeConfigPath)
- .WithFramework(new RuntimeConfig.Framework(Constants.MicrosoftNETCoreApp, RepoDirectories.MicrosoftNETCoreAppVersion))
- .Save();
}
protected override void Dispose(bool disposing)