Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions test/dotnet.Tests/CommandTests/Run/GivenDotnetRunBuildsCsProj.cs
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ public void ItUsesLaunchProfileOfTheSpecifiedName()
.WithSource();

var testProjectDirectory = testInstance.Path;
var launchSettingsPath = Path.Combine(testProjectDirectory, "Properties", "launchSettings.json");

var cmd = new DotnetCommand(Log, "run")
.WithWorkingDirectory(testProjectDirectory)
Expand All @@ -400,7 +401,7 @@ public void ItUsesLaunchProfileOfTheSpecifiedName()
cmd.Should().Pass()
.And.HaveStdOutContaining("Second");

cmd.StdErr.Should().BeEmpty();
cmd.StdErr.Should().Contain(string.Format(CliCommandStrings.UsingLaunchSettingsFromMessage, launchSettingsPath));
}

[Fact]
Expand All @@ -411,14 +412,12 @@ public void ItDefaultsToTheFirstUsableLaunchProfile()
.WithSource();

var testProjectDirectory = testInstance.Path;
var launchSettingsPath = Path.Combine(testProjectDirectory, "Properties", "launchSettings.json");

var cmd = new DotnetCommand(Log, "run", "--verbosity", "quiet")
.WithWorkingDirectory(testProjectDirectory)
.Execute();

cmd.Should().Pass()
.And.NotHaveStdOutContaining(string.Format(CliCommandStrings.UsingLaunchSettingsFromMessage, launchSettingsPath))
.And.HaveStdOutContaining("First");

cmd.StdErr.Should().BeEmpty();
Comment thread
MichaelSimons marked this conversation as resolved.
Expand All @@ -441,7 +440,7 @@ public void ItSetsTheDotnetLaunchProfileEnvironmentVariableToDefaultLaunchProfil
cmd.Should().Pass()
.And.HaveStdOutContaining("DOTNET_LAUNCH_PROFILE=<<<First>>>");

cmd.StdErr.Should().BeEmpty();
cmd.StdErr.Should().Contain(string.Format(CliCommandStrings.UsingLaunchSettingsFromMessage, launchSettingsPath));
}

[Fact]
Expand All @@ -461,7 +460,7 @@ public void ItSetsTheDotnetLaunchProfileEnvironmentVariableToSuppliedLaunchProfi
cmd.Should().Pass()
.And.HaveStdOutContaining("DOTNET_LAUNCH_PROFILE=<<<Second>>>");

cmd.StdErr.Should().BeEmpty();
cmd.StdErr.Should().Contain(string.Format(CliCommandStrings.UsingLaunchSettingsFromMessage, launchSettingsPath));
}

[Fact]
Expand Down Expand Up @@ -518,10 +517,8 @@ public void ItPrintsUsingLaunchSettingsMessageWhenNotQuiet()
.Execute("-v:m");

cmd.Should().Pass()
.And.HaveStdOutContaining(string.Format(CliCommandStrings.UsingLaunchSettingsFromMessage, launchSettingsPath))
.And.HaveStdErrContaining(string.Format(CliCommandStrings.UsingLaunchSettingsFromMessage, launchSettingsPath))
.And.HaveStdOutContaining("First");

cmd.StdErr.Should().BeEmpty();
}

[Fact]
Expand All @@ -532,6 +529,7 @@ public void ItPrefersTheValueOfAppUrlFromEnvVarOverTheProp()
.WithSource();

var testProjectDirectory = testInstance.Path;
var launchSettingsPath = Path.Combine(testProjectDirectory, "Properties", "launchSettings.json");

var cmd = new DotnetCommand(Log, "run")
.WithWorkingDirectory(testProjectDirectory)
Expand All @@ -540,7 +538,7 @@ public void ItPrefersTheValueOfAppUrlFromEnvVarOverTheProp()
cmd.Should().Pass()
.And.HaveStdOutContaining("http://localhost:12345/");

cmd.StdErr.Should().BeEmpty();
cmd.StdErr.Should().Contain(string.Format(CliCommandStrings.UsingLaunchSettingsFromMessage, launchSettingsPath));
}

[Fact]
Expand All @@ -551,6 +549,7 @@ public void ItUsesTheValueOfAppUrlIfTheEnvVarIsNotSet()
.WithSource();

var testProjectDirectory = testInstance.Path;
var launchSettingsPath = Path.Combine(testProjectDirectory, "Properties", "launchSettings.json");

var cmd = new DotnetCommand(Log, "run")
.WithWorkingDirectory(testProjectDirectory)
Expand All @@ -559,7 +558,7 @@ public void ItUsesTheValueOfAppUrlIfTheEnvVarIsNotSet()
cmd.Should().Pass()
.And.HaveStdOutContaining("http://localhost:54321/");

cmd.StdErr.Should().BeEmpty();
cmd.StdErr.Should().Contain(string.Format(CliCommandStrings.UsingLaunchSettingsFromMessage, launchSettingsPath));
}

[Fact]
Expand Down
14 changes: 6 additions & 8 deletions test/dotnet.Tests/CommandTests/Run/GivenDotnetRunBuildsVbProj.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ public void ItUsesLaunchProfileOfTheSpecifiedName(string launchProfileName)
var testInstance = TestAssetsManager.CopyTestAsset(testAppName, identifier: $"LaunchProfileSuccess-{launchProfileName}")
.WithSource();

var launchSettingsPath = Path.Combine(testInstance.Path, "My Project", "launchSettings.json");

new DotnetCommand(Log, "run")
.WithWorkingDirectory(testInstance.Path)
.Execute("--launch-profile", launchProfileName)
Expand All @@ -88,7 +90,7 @@ public void ItUsesLaunchProfileOfTheSpecifiedName(string launchProfileName)
.And
.HaveStdOutContaining("Second")
.And
.NotHaveStdErr();
.HaveStdErrContaining(string.Format(CliCommandStrings.UsingLaunchSettingsFromMessage, launchSettingsPath));
}

[Fact]
Expand All @@ -99,17 +101,15 @@ public void ItDefaultsToTheFirstUsableLaunchProfile()
.WithSource();

var testProjectDirectory = testInstance.Path;
var launchSettingsPath = Path.Combine(testProjectDirectory, "Properties", "launchSettings.json");
var launchSettingsPath = Path.Combine(testProjectDirectory, "My Project", "launchSettings.json");

var cmd = new DotnetCommand(Log, "run")
.WithWorkingDirectory(testProjectDirectory)
.Execute();

cmd.Should().Pass()
.And.NotHaveStdOutContaining(string.Format(CliCommandStrings.UsingLaunchSettingsFromMessage, launchSettingsPath))
.And.HaveStdErrContaining(string.Format(CliCommandStrings.UsingLaunchSettingsFromMessage, launchSettingsPath))
.And.HaveStdOutContaining("First");
Comment thread
MichaelSimons marked this conversation as resolved.

cmd.StdErr.Should().BeEmpty();
}

[Fact]
Expand All @@ -126,10 +126,8 @@ public void ItPrintsUsingLaunchSettingsMessageWhenNotQuiet()
.Execute("-v:m");

cmd.Should().Pass()
.And.HaveStdOutContaining(string.Format(CliCommandStrings.UsingLaunchSettingsFromMessage, launchSettingsPath))
.And.HaveStdErrContaining(string.Format(CliCommandStrings.UsingLaunchSettingsFromMessage, launchSettingsPath))
.And.HaveStdOutContaining("First");

cmd.StdErr.Should().BeEmpty();
}

[Fact]
Expand Down
3 changes: 2 additions & 1 deletion test/dotnet.Tests/CommandTests/Run/RunCommandTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.DotNet.Cli.Commands;
using Microsoft.DotNet.Cli.Commands.Run;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.ProjectTools;
Expand Down Expand Up @@ -68,7 +69,7 @@ public void EnvironmentVariableExpansion_Project()
.And.HaveStdOutContaining("TEST_VAR1=<<<VALUE1>>>")
.And.HaveStdOutContaining("ARGS=arg1,arg2,arg3");

cmd.StdErr.Should().BeEmpty();
cmd.StdErr.Should().Contain(string.Format(CliCommandStrings.UsingLaunchSettingsFromMessage, launchSettingsPath));
}

[Fact]
Expand Down
Loading