You've already forked linux-packaging-mono
Imported Upstream version 5.12.0.220
Former-commit-id: c477e03582759447177c6d4bf412cd2355aad476
This commit is contained in:
parent
8bd104cef2
commit
8fc30896db
@ -8,11 +8,21 @@ namespace ILLink.Tests
|
||||
{
|
||||
public class WebApiTest : IntegrationTestBase
|
||||
{
|
||||
public WebApiTest(ITestOutputHelper output) : base(output) {}
|
||||
private string csproj;
|
||||
|
||||
public WebApiTest(ITestOutputHelper output) : base(output) {
|
||||
csproj = SetupProject();
|
||||
}
|
||||
|
||||
public string SetupProject()
|
||||
{
|
||||
string projectRoot = "webapi";
|
||||
string csproj = Path.Combine(projectRoot, $"{projectRoot}.csproj");
|
||||
|
||||
if (File.Exists(csproj)) {
|
||||
output.WriteLine($"using existing project {csproj}");
|
||||
return csproj;
|
||||
}
|
||||
|
||||
if (Directory.Exists(projectRoot)) {
|
||||
Directory.Delete(projectRoot, true);
|
||||
@ -25,7 +35,10 @@ namespace ILLink.Tests
|
||||
Assert.True(false);
|
||||
}
|
||||
|
||||
string csproj = Path.Combine(projectRoot, $"{projectRoot}.csproj");
|
||||
PreventPublishFiltering(csproj);
|
||||
|
||||
AddLinkerReference(csproj);
|
||||
|
||||
return csproj;
|
||||
}
|
||||
|
||||
@ -49,19 +62,25 @@ namespace ILLink.Tests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RunWebApi()
|
||||
public void RunWebApiStandalone()
|
||||
{
|
||||
string csproj = SetupProject();
|
||||
string executablePath = BuildAndLink(csproj, selfContained: true);
|
||||
CheckOutput(executablePath, selfContained: true);
|
||||
}
|
||||
|
||||
PreventPublishFiltering(csproj);
|
||||
[Fact]
|
||||
public void RunWebApiPortable()
|
||||
{
|
||||
string target = BuildAndLink(csproj, selfContained: false);
|
||||
CheckOutput(target, selfContained: false);
|
||||
}
|
||||
|
||||
AddLinkerReference(csproj);
|
||||
|
||||
BuildAndLink(csproj);
|
||||
|
||||
int ret = RunApp(csproj, out string commandOutput, 10000);
|
||||
void CheckOutput(string target, bool selfContained = false)
|
||||
{
|
||||
string terminatingOutput = "Now listening on: http://localhost:5000";
|
||||
int ret = RunApp(target, out string commandOutput, 60000, terminatingOutput, selfContained: selfContained);
|
||||
Assert.True(commandOutput.Contains("Application started. Press Ctrl+C to shut down."));
|
||||
Assert.True(commandOutput.Contains("Now listening on: http://localhost:5000"));
|
||||
Assert.True(commandOutput.Contains(terminatingOutput));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user