Fixup test
This commit is contained in:
parent
ad8a927e85
commit
57db5937f8
|
|
@ -42,6 +42,7 @@ namespace Templates.Test.Helpers
|
||||||
IDictionary<string, string> environmentVariables,
|
IDictionary<string, string> environmentVariables,
|
||||||
bool published,
|
bool published,
|
||||||
bool hasListeningUri = true,
|
bool hasListeningUri = true,
|
||||||
|
bool usePublishedAppHost = false,
|
||||||
ILogger logger = null)
|
ILogger logger = null)
|
||||||
{
|
{
|
||||||
_developmentCertificate = DevelopmentCertificate.Create(workingDirectory);
|
_developmentCertificate = DevelopmentCertificate.Create(workingDirectory);
|
||||||
|
|
@ -64,9 +65,17 @@ namespace Templates.Test.Helpers
|
||||||
string arguments;
|
string arguments;
|
||||||
if (published)
|
if (published)
|
||||||
{
|
{
|
||||||
// When publishingu used the app host to run the app. This makes it easy to consistently run for regular and single-file publish
|
if (usePublishedAppHost)
|
||||||
process = OperatingSystem.IsWindows() ? dllPath + ".exe" : dllPath;
|
{
|
||||||
arguments = null;
|
// When publishingu used the app host to run the app. This makes it easy to consistently run for regular and single-file publish
|
||||||
|
process = Path.ChangeExtension(dllPath, OperatingSystem.IsWindows() ? ".exe" : null);
|
||||||
|
arguments = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
process = DotNetMuxer.MuxerPathOrDefault();
|
||||||
|
arguments = $"exec {dllPath}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,7 @@ namespace Templates.Test.Helpers
|
||||||
return new AspNetProcess(Output, TemplateOutputDir, projectDll, environment, published: false, hasListeningUri: hasListeningUri, logger: logger);
|
return new AspNetProcess(Output, TemplateOutputDir, projectDll, environment, published: false, hasListeningUri: hasListeningUri, logger: logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal AspNetProcess StartPublishedProjectAsync(bool hasListeningUri = true)
|
internal AspNetProcess StartPublishedProjectAsync(bool hasListeningUri = true, bool usePublishedAppHost = false)
|
||||||
{
|
{
|
||||||
var environment = new Dictionary<string, string>
|
var environment = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
|
|
@ -190,8 +190,8 @@ namespace Templates.Test.Helpers
|
||||||
["ASPNETCORE_Logging__Console__FormatterOptions__IncludeScopes"] = "true",
|
["ASPNETCORE_Logging__Console__FormatterOptions__IncludeScopes"] = "true",
|
||||||
};
|
};
|
||||||
|
|
||||||
var projectDll = Path.Combine(TemplatePublishDir, ProjectName);
|
var projectDll = Path.Combine(TemplatePublishDir, $"{ProjectName}.dll");
|
||||||
return new AspNetProcess(Output, TemplatePublishDir, projectDll, environment, published: true, hasListeningUri: hasListeningUri);
|
return new AspNetProcess(Output, TemplatePublishDir, projectDll, environment, published: true, hasListeningUri: hasListeningUri, usePublishedAppHost: usePublishedAppHost);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal async Task<ProcessResult> RunDotNetEfCreateMigrationAsync(string migrationName)
|
internal async Task<ProcessResult> RunDotNetEfCreateMigrationAsync(string migrationName)
|
||||||
|
|
|
||||||
|
|
@ -243,7 +243,7 @@ namespace Templates.Test
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Project = await ProjectFactory.GetOrCreateProject("mvcindividualuld", Output);
|
Project = await ProjectFactory.GetOrCreateProject("mvcsinglefileexe", Output);
|
||||||
Project.RuntimeIdentifier = runtimeIdentifer;
|
Project.RuntimeIdentifier = runtimeIdentifer;
|
||||||
|
|
||||||
var createResult = await Project.RunDotNetNewAsync("mvc", auth: "Individual", useLocalDB: true);
|
var createResult = await Project.RunDotNetNewAsync("mvc", auth: "Individual", useLocalDB: true);
|
||||||
|
|
@ -286,7 +286,7 @@ namespace Templates.Test
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
using var aspNetProcess = Project.StartPublishedProjectAsync();
|
using var aspNetProcess = Project.StartPublishedProjectAsync(usePublishedAppHost: true);
|
||||||
Assert.False(
|
Assert.False(
|
||||||
aspNetProcess.Process.HasExited,
|
aspNetProcess.Process.HasExited,
|
||||||
ErrorMessages.GetFailedProcessMessageOrEmpty("Run published project", Project, aspNetProcess.Process));
|
ErrorMessages.GetFailedProcessMessageOrEmpty("Run published project", Project, aspNetProcess.Process));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue