Merge pull request #9306 from dotnet/merges/release/2.1.4xx-to-master

Merge release/2.1.4xx to master
This commit is contained in:
Livar 2018-05-17 13:41:23 -07:00 committed by GitHub
commit e338e46e10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 117 additions and 19 deletions

View file

@ -9,6 +9,7 @@ using System;
using System.IO;
using System.Linq;
using Xunit;
using CommandLocalizableStrings = Microsoft.DotNet.Tools.Sln.LocalizableStrings;
namespace Microsoft.DotNet.Cli.Sln.List.Tests
{
@ -160,7 +161,7 @@ Commands:
}
[Fact]
public void WhenNoProjectReferencesArePresentInTheSolutionItPrintsANoProjectMessage()
public void WhenNoProjectsArePresentInTheSolutionItPrintsANoProjectMessage()
{
var projectDirectory = TestAssets
.Get("TestAppWithEmptySln")
@ -177,11 +178,10 @@ Commands:
}
[Fact]
public void WhenProjectReferencesArePresentInTheSolutionItListsThem()
public void WhenProjectsPresentInTheSolutionItListsThem()
{
string OutputText = CommonLocalizableStrings.ProjectReferenceOneOrMore;
OutputText += $@"
{new string('-', OutputText.Length)}
var expectedOutput = $@"{CommandLocalizableStrings.ProjectsHeader}
{new string('-', CommandLocalizableStrings.ProjectsHeader.Length)}
{Path.Combine("App", "App.csproj")}
{Path.Combine("Lib", "Lib.csproj")}";
@ -196,7 +196,7 @@ Commands:
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput("sln list");
cmd.Should().Pass();
cmd.StdOut.Should().BeVisuallyEquivalentTo(OutputText);
cmd.StdOut.Should().BeVisuallyEquivalentTo(expectedOutput);
}
}
}

View file

@ -131,6 +131,39 @@ namespace Microsoft.DotNet.Cli.Test.Tests
}
}
[Fact]
public void ItAcceptsMultipleLoggersAsCliArguments()
{
// Copy and restore VSTestCore project in output directory of project dotnet-vstest.Tests
var testProjectDirectory = this.CopyAndRestoreVSTestDotNetCoreTestApp("10");
string trxLoggerDirectory = Path.Combine(testProjectDirectory, "RD");
// Delete trxLoggerDirectory if it exist
if (Directory.Exists(trxLoggerDirectory))
{
Directory.Delete(trxLoggerDirectory, true);
}
// Call test with logger enable
CommandResult result = new DotnetTestCommand()
.WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput("--logger \"trx;logfilename=custom.trx\" --logger console;verbosity=normal -- RunConfiguration.ResultsDirectory=" + trxLoggerDirectory);
// Verify
var trxFilePath = Path.Combine(trxLoggerDirectory, "custom.trx");
Assert.True(File.Exists(trxFilePath));
result.StdOut.Should().Contain(trxFilePath);
result.StdOut.Should().Contain("Passed VSTestPassTest");
result.StdOut.Should().Contain("Failed VSTestFailTest");
// Cleanup trxLoggerDirectory if it exist
if (Directory.Exists(trxLoggerDirectory))
{
Directory.Delete(trxLoggerDirectory, true);
}
}
[Fact]
public void TestWillNotBuildTheProjectIfNoBuildArgsIsGiven()
{