Update launch settings for ApplicationUrl handling
This commit is contained in:
parent
56a56aa085
commit
c1fff9649a
5 changed files with 117 additions and 5 deletions
|
@ -364,6 +364,66 @@ namespace Microsoft.DotNet.Cli.Run.Tests
|
|||
cmd.StdErr.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ItPrefersTheValueOfApplicationUrlFromEnvironmentVariablesOverTheProperty()
|
||||
{
|
||||
var testAppName = "AppWithApplicationUrlInLaunchSettings";
|
||||
var testInstance = TestAssets.Get(testAppName)
|
||||
.CreateInstance()
|
||||
.WithSourceFiles();
|
||||
|
||||
var testProjectDirectory = testInstance.Root.FullName;
|
||||
|
||||
new RestoreCommand()
|
||||
.WithWorkingDirectory(testProjectDirectory)
|
||||
.Execute("/p:SkipInvalidConfigurations=true")
|
||||
.Should().Pass();
|
||||
|
||||
new BuildCommand()
|
||||
.WithWorkingDirectory(testProjectDirectory)
|
||||
.Execute()
|
||||
.Should().Pass();
|
||||
|
||||
var cmd = new RunCommand()
|
||||
.WithWorkingDirectory(testProjectDirectory)
|
||||
.ExecuteWithCapturedOutput("--launch-profile First");
|
||||
|
||||
cmd.Should().Pass()
|
||||
.And.HaveStdOutContaining("http://localhost:12345/");
|
||||
|
||||
cmd.StdErr.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ItUsesTheValueOfApplicationUrlIfTheEnvironmentVariableIsNotSet()
|
||||
{
|
||||
var testAppName = "AppWithApplicationUrlInLaunchSettings";
|
||||
var testInstance = TestAssets.Get(testAppName)
|
||||
.CreateInstance()
|
||||
.WithSourceFiles();
|
||||
|
||||
var testProjectDirectory = testInstance.Root.FullName;
|
||||
|
||||
new RestoreCommand()
|
||||
.WithWorkingDirectory(testProjectDirectory)
|
||||
.Execute("/p:SkipInvalidConfigurations=true")
|
||||
.Should().Pass();
|
||||
|
||||
new BuildCommand()
|
||||
.WithWorkingDirectory(testProjectDirectory)
|
||||
.Execute()
|
||||
.Should().Pass();
|
||||
|
||||
var cmd = new RunCommand()
|
||||
.WithWorkingDirectory(testProjectDirectory)
|
||||
.ExecuteWithCapturedOutput("--launch-profile Second");
|
||||
|
||||
cmd.Should().Pass()
|
||||
.And.HaveStdOutContaining("http://localhost:54321/");
|
||||
|
||||
cmd.StdErr.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ItGivesAnErrorWhenTheLaunchProfileNotFound()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue