Added method GetSemiColonEscapedArgs

This commit is contained in:
Harsh Jain 2016-12-30 15:47:15 +05:30
parent 245727183c
commit 19d919a640
2 changed files with 23 additions and 3 deletions

View file

@ -253,7 +253,6 @@ namespace Microsoft.DotNet.Tools.Test
private static string[] GetRunSettingsOptions(List<string> remainingArgs) private static string[] GetRunSettingsOptions(List<string> remainingArgs)
{ {
int counter = 0;
List<string> runsettingsArgs = new List<string>(); List<string> runsettingsArgs = new List<string>();
List<string> argsToRemove = new List<string>(); List<string> argsToRemove = new List<string>();
@ -280,5 +279,26 @@ namespace Microsoft.DotNet.Tools.Test
return string.IsNullOrEmpty(arg) ? arg : arg.Replace(";", "%3b"); return string.IsNullOrEmpty(arg) ? arg : arg.Replace(";", "%3b");
} }
private static string[] GetSemiColonEscapedArgs(List<string> args)
{
int counter = 0;
string[] array = new string[args.Count];
foreach (string arg in args)
{
if (arg.IndexOf(";") != -1)
{
array[counter] = arg.Replace(";", "%3b");
}
else
{
array[counter] = arg;
}
counter++;
}
return array;
}
} }
} }

View file

@ -101,7 +101,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests
[Fact] [Fact]
public void TestWillCreateTrxLogger() public void TestWillCreateTrxLogger()
{ {
// Copy VSTestDotNetCore project in output directory of project dotnet-vstest.Tests // Copy VSTestDotNetCore project in output directory of project dotnet-vstest.Tests
string testAppName = "VSTestDotNetCore"; string testAppName = "VSTestDotNetCore";
TestInstance testInstance = TestAssetsManager.CreateTestInstance(testAppName); TestInstance testInstance = TestAssetsManager.CreateTestInstance(testAppName);
@ -170,7 +170,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests
.ExecuteWithCapturedOutput("--logger \"trx;logfilename=custom.trx\" -- RunConfiguration.ResultsDirectory=" + trxLoggerDirectory); .ExecuteWithCapturedOutput("--logger \"trx;logfilename=custom.trx\" -- RunConfiguration.ResultsDirectory=" + trxLoggerDirectory);
// Verify // Verify
String[] trxFiles = Directory.GetFiles(trxLoggerDirectory, "*.trx"); String[] trxFiles = Directory.GetFiles(trxLoggerDirectory, "custom.trx");
Assert.Equal(1, trxFiles.Length); Assert.Equal(1, trxFiles.Length);
result.StdOut.Should().Contain(trxFiles[0]); result.StdOut.Should().Contain(trxFiles[0]);