Skip to content

Commit

Permalink
Fixing the tests for string comparison issue. (microsoft#1462)
Browse files Browse the repository at this point in the history
  • Loading branch information
singhsarab committed Mar 6, 2018
1 parent 325c955 commit 1dcdba7
Show file tree
Hide file tree
Showing 17 changed files with 26 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public void GetTestPlatformExtensionsShouldIncludeOutputDirectoryExtensionsIfTes
// Verify
List<string> expectedList = new List<string> { @"C:\Source2\ext1.TestAdapter.dll", @"C:\Source1\ext2.TestAdapter.dll" };
CollectionAssert.AreEqual(expectedList, resultExtensions);
this.mockMessageLogger.Verify(ml => ml.SendMessage(TestMessageLevel.Warning, "Multiple versions of same extension found. Selecting the highest version.\n ext1.TestAdapter : 2.2\n ext2.TestAdapter : 5.5"), Times.Once);
this.mockMessageLogger.Verify(ml => ml.SendMessage(TestMessageLevel.Warning, "Multiple versions of same extension found. Selecting the highest version." + Environment.NewLine + " ext1.TestAdapter : 2.2\n ext2.TestAdapter : 5.5"), Times.Once);
}

[TestMethod]
Expand All @@ -279,7 +279,7 @@ public void GetTestPlatformExtensionsShouldReturnPathTheHigherVersionedFileExten

// Verify
CollectionAssert.AreEqual(extensionsList2, resultExtensions);
this.mockMessageLogger.Verify(ml => ml.SendMessage(TestMessageLevel.Warning, "Multiple versions of same extension found. Selecting the highest version.\n ext1.TestAdapter : 2.2"), Times.Once);
this.mockMessageLogger.Verify(ml => ml.SendMessage(TestMessageLevel.Warning, "Multiple versions of same extension found. Selecting the highest version." + Environment.NewLine + " ext1.TestAdapter : 2.2"), Times.Once);
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void CapabilitiesShouldReturnAppropriateProperties()
var capabilities = new CLIRunSettingsArgumentProcessorCapabilities();

Assert.AreEqual("--", capabilities.CommandName);
Assert.AreEqual("RunSettings arguments:\n Arguments to pass runsettings configurations through commandline. Arguments may be specified as name-value pair of the form [name]=[value] after \"-- \". Note the space after --. \n Use a space to separate multiple [name]=[value].\n More info on RunSettings arguments support: https://aka.ms/vstest-runsettings-arguments", capabilities.HelpContentResourceName);
Assert.AreEqual("RunSettings arguments:" + Environment.NewLine + " Arguments to pass runsettings configurations through commandline. Arguments may be specified as name-value pair of the form [name]=[value] after \"-- \". Note the space after --. " + Environment.NewLine + " Use a space to separate multiple [name]=[value]." + Environment.NewLine + " More info on RunSettings arguments support: https://aka.ms/vstest-runsettings-arguments", capabilities.HelpContentResourceName);

Assert.AreEqual(HelpContentPriority.CLIRunSettingsArgumentProcessorHelpPriority, capabilities.HelpPriority);
Assert.AreEqual(false, capabilities.IsAction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void CapabilitiesShouldReturnAppropriateProperties()
var capabilities = new CollectArgumentProcessorCapabilities();

Assert.AreEqual("/Collect", capabilities.CommandName);
Assert.AreEqual("--Collect|/Collect:<DataCollector FriendlyName>\n Enables data collector for the test run. More info here : https://aka.ms/vstest-collect", capabilities.HelpContentResourceName);
Assert.AreEqual("--Collect|/Collect:<DataCollector FriendlyName>" + Environment.NewLine + " Enables data collector for the test run. More info here : https://aka.ms/vstest-collect", capabilities.HelpContentResourceName);

Assert.AreEqual(HelpContentPriority.CollectArgumentProcessorHelpPriority, capabilities.HelpPriority);
Assert.AreEqual(false, capabilities.IsAction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine.UnitTests.Processors
using Microsoft.VisualStudio.TestTools.UnitTesting;
using vstest.console.UnitTests.TestDoubles;

using System;
using System.Linq;

[TestClass]
public class EnableLoggersArgumentProcessorTests
{
Expand Down Expand Up @@ -39,7 +40,7 @@ public void CapabilitiesShouldAppropriateProperties()
{
EnableLoggerArgumentProcessorCapabilities capabilities = new EnableLoggerArgumentProcessorCapabilities();
Assert.AreEqual("/Logger", capabilities.CommandName);
Assert.AreEqual("--logger|/logger:<Logger Uri/FriendlyName>\n Specify a logger for test results. For example, to log results into a \n Visual Studio Test Results File (TRX) use /logger:trx[;LogFileName=<Defaults to unique file name>]\n Creates file in TestResults directory with given LogFileName.\n\n Change the verbosity level in log messages for console logger as shown below\n Example: /logger:console;verbosity=<Defaults to \"minimal\">\n Allowed values for verbosity: quiet, minimal and normal.\n\n Change the diagnostic level prefix for console logger as shown below\n Example: /logger:console;prefix=<Defaults to \"false\">\n More info on Console Logger here : https://aka.ms/console-logger\n\n To publish test results to Team Foundation Server, use TfsPublisher as shown below\n Example: /logger:TfsPublisher;\n Collection=<team project collection url>;\n BuildName=<build name>;\n TeamProject=<team project name>\n [;Platform=<Defaults to \"Any CPU\">]\n [;Flavor=<Defaults to \"Debug\">]\n [;RunTitle=<title>]", capabilities.HelpContentResourceName);
Assert.AreEqual("--logger|/logger:<Logger Uri/FriendlyName>" + Environment.NewLine + " Specify a logger for test results. For example, to log results into a " + Environment.NewLine + " Visual Studio Test Results File (TRX) use /logger:trx[;LogFileName=<Defaults to unique file name>]" + Environment.NewLine + " Creates file in TestResults directory with given LogFileName." + Environment.NewLine + Environment.NewLine + " Change the verbosity level in log messages for console logger as shown below" + Environment.NewLine + " Example: /logger:console;verbosity=<Defaults to \"minimal\">" + Environment.NewLine + " Allowed values for verbosity: quiet, minimal and normal." + Environment.NewLine + Environment.NewLine + " Change the diagnostic level prefix for console logger as shown below" + Environment.NewLine + " Example: /logger:console;prefix=<Defaults to \"false\">" + Environment.NewLine + " More info on Console Logger here : https://aka.ms/console-logger" + Environment.NewLine + Environment.NewLine + " To publish test results to Team Foundation Server, use TfsPublisher as shown below" + Environment.NewLine + " Example: /logger:TfsPublisher;" + Environment.NewLine + " Collection=<team project collection url>;" + Environment.NewLine + " BuildName=<build name>;" + Environment.NewLine + " TeamProject=<team project name>" + Environment.NewLine + " [;Platform=<Defaults to \"Any CPU\">]" + Environment.NewLine + " [;Flavor=<Defaults to \"Debug\">]" + Environment.NewLine + " [;RunTitle=<title>]", capabilities.HelpContentResourceName);

Assert.AreEqual(HelpContentPriority.EnableLoggerArgumentProcessorHelpPriority, capabilities.HelpPriority);
Assert.AreEqual(false, capabilities.IsAction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Microsoft.VisualStudio.TestPlatform.CommandLine.UnitTests.Processors
{
using System;
using System.Collections.Generic;

using Microsoft.VisualStudio.TestPlatform.CommandLine.Processors;
Expand Down Expand Up @@ -39,7 +40,7 @@ public void CapabilitiesShouldAppropriateProperties()
{
HelpArgumentProcessorCapabilities capabilities = new HelpArgumentProcessorCapabilities();
Assert.AreEqual("/Help", capabilities.CommandName);
Assert.AreEqual("-?|--Help|/?|/Help\n Display this usage message.", capabilities.HelpContentResourceName);
Assert.AreEqual("-?|--Help|/?|/Help" + Environment.NewLine + " Display this usage message.", capabilities.HelpContentResourceName);

Assert.AreEqual(HelpContentPriority.HelpArgumentProcessorHelpPriority, capabilities.HelpPriority);
Assert.AreEqual(false, capabilities.IsAction);
Expand Down Expand Up @@ -71,7 +72,7 @@ public void ExecuterExecuteWritesAppropriateDataToConsole()
Assert.IsTrue(output.Lines.Contains("Arguments:"));
Assert.IsTrue(output.Lines.Contains("Options:"));
Assert.IsTrue(output.Lines.Contains("Description: Runs tests from the specified files."));
Assert.IsTrue(output.Lines.Contains(" To run tests:\n >vstest.console.exe tests.dll \n To run tests with additional settings such as data collectors:\n >vstest.console.exe tests.dll /Settings:Local.RunSettings"));
Assert.IsTrue(output.Lines.Contains(" To run tests:" + Environment.NewLine + " >vstest.console.exe tests.dll " + Environment.NewLine + " To run tests with additional settings such as data collectors:" + Environment.NewLine + " >vstest.console.exe tests.dll /Settings:Local.RunSettings"));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine.UnitTests.Processors
using Microsoft.VisualStudio.TestPlatform.CommandLine.Processors;
using Microsoft.VisualStudio.TestPlatform.Common.Utilities;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using vstest.console.UnitTests.Processors;

using ExceptionUtilities = Microsoft.VisualStudio.TestPlatform.CommandLine.UnitTests.ExceptionUtilities;
Expand Down Expand Up @@ -55,7 +56,7 @@ public void InIsolationArgumentProcessorMetadataShouldProvideAppropriateCapabili
Assert.AreEqual(null, isolationProcessor.Metadata.Value.ShortCommandName);
Assert.AreEqual(ArgumentProcessorPriority.AutoUpdateRunSettings, isolationProcessor.Metadata.Value.Priority);
Assert.AreEqual(HelpContentPriority.InIsolationArgumentProcessorHelpPriority, isolationProcessor.Metadata.Value.HelpPriority);
Assert.AreEqual("--InIsolation|/InIsolation\n Runs the tests in an isolated process. This makes vstest.console.exe \n process less likely to be stopped on an error in the tests, but tests \n may run slower.", isolationProcessor.Metadata.Value.HelpContentResourceName);
Assert.AreEqual("--InIsolation|/InIsolation" + Environment.NewLine + " Runs the tests in an isolated process. This makes vstest.console.exe " + Environment.NewLine + " process less likely to be stopped on an error in the tests, but tests " + Environment.NewLine + " may run slower.", isolationProcessor.Metadata.Value.HelpContentResourceName);
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void CapabilitiesShouldReturnAppropriateProperties()
var capabilities = new ListTestsArgumentProcessorCapabilities();
Assert.AreEqual("/ListTests", capabilities.CommandName);
Assert.AreEqual("/lt", capabilities.ShortCommandName);
Assert.AreEqual("-lt|--ListTests|/lt|/ListTests:<File Name>\n Lists all discovered tests from the given test container.", capabilities.HelpContentResourceName);
Assert.AreEqual("-lt|--ListTests|/lt|/ListTests:<File Name>" + Environment.NewLine + " Lists all discovered tests from the given test container.", capabilities.HelpContentResourceName);

Assert.AreEqual(HelpContentPriority.ListTestsArgumentProcessorHelpPriority, capabilities.HelpPriority);
Assert.AreEqual(true, capabilities.IsAction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@

namespace Microsoft.VisualStudio.TestPlatform.CommandLine.UnitTests.Processors
{
using System;
using Microsoft.VisualStudio.TestPlatform.Common.Utilities;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TestPlatform.CommandLine.Processors;
using vstest.console.UnitTests.Processors;
using Microsoft.VisualStudio.TestPlatform.Common.Utilities;

using ExceptionUtilities = Microsoft.VisualStudio.TestPlatform.CommandLine.UnitTests.ExceptionUtilities;

Expand Down Expand Up @@ -49,7 +50,7 @@ public void CapabilitiesShouldReturnAppropriateProperties()
{
var capabilities = new ParallelArgumentProcessorCapabilities();
Assert.AreEqual("/Parallel", capabilities.CommandName);
Assert.AreEqual("--Parallel|/Parallel\n Specifies that the tests be executed in parallel. By default up\n to all available cores on the machine may be used.\n The number of cores to use may be configured using a settings file.", capabilities.HelpContentResourceName);
Assert.AreEqual("--Parallel|/Parallel" + Environment.NewLine + " Specifies that the tests be executed in parallel. By default up" + Environment.NewLine + " to all available cores on the machine may be used." + Environment.NewLine + " The number of cores to use may be configured using a settings file.", capabilities.HelpContentResourceName);

Assert.AreEqual(HelpContentPriority.ParallelArgumentProcessorHelpPriority, capabilities.HelpPriority);
Assert.AreEqual(false, capabilities.IsAction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void CapabilitiesShouldReturnAppropriateProperties()
{
var capabilities = new ParentProcessIdArgumentProcessorCapabilities();
Assert.AreEqual("/ParentProcessId", capabilities.CommandName);
Assert.AreEqual("--ParentProcessId|/ParentProcessId:<ParentProcessId>\n Process Id of the Parent Process responsible for launching current process.", capabilities.HelpContentResourceName);
Assert.AreEqual("--ParentProcessId|/ParentProcessId:<ParentProcessId>" + Environment.NewLine + " Process Id of the Parent Process responsible for launching current process.", capabilities.HelpContentResourceName);

Assert.AreEqual(HelpContentPriority.ParentProcessIdArgumentProcessorHelpPriority, capabilities.HelpPriority);
Assert.AreEqual(false, capabilities.IsAction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Microsoft.VisualStudio.TestPlatform.CommandLine.UnitTests.Processors
{
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TestPlatform.CommandLine.Processors;
using vstest.console.UnitTests.Processors;
Expand Down Expand Up @@ -49,7 +50,7 @@ public void CapabilitiesShouldReturnAppropriateProperties()
{
var capabilities = new PlatformArgumentProcessorCapabilities();
Assert.AreEqual("/Platform", capabilities.CommandName);
Assert.AreEqual("--Platform|/Platform:<Platform type>\n Target platform architecture to be used for test execution. \n Valid values are x86, x64 and ARM.", capabilities.HelpContentResourceName);
Assert.AreEqual("--Platform|/Platform:<Platform type>" + Environment.NewLine + " Target platform architecture to be used for test execution. " + Environment.NewLine + " Valid values are x86, x64 and ARM.", capabilities.HelpContentResourceName);

Assert.AreEqual(HelpContentPriority.PlatformArgumentProcessorHelpPriority, capabilities.HelpPriority);
Assert.AreEqual(false, capabilities.IsAction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void CapabilitiesShouldAppropriateProperties()
{
var capabilities = new PortArgumentProcessorCapabilities();
Assert.AreEqual("/Port", capabilities.CommandName);
Assert.AreEqual("--Port|/Port:<Port>\n The Port for socket connection and receiving the event messages.", capabilities.HelpContentResourceName);
Assert.AreEqual("--Port|/Port:<Port>" + Environment.NewLine + " The Port for socket connection and receiving the event messages.", capabilities.HelpContentResourceName);

Assert.AreEqual(HelpContentPriority.PortArgumentProcessorHelpPriority, capabilities.HelpPriority);
Assert.AreEqual(false, capabilities.IsAction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void CapabilitiesShouldReturnAppropriateProperties()
{
var capabilities = new ResultsDirectoryArgumentProcessorCapabilities();
Assert.AreEqual("/ResultsDirectory", capabilities.CommandName);
Assert.AreEqual("--ResultsDirectory|/ResultsDirectory\n Test results directory will be created in specified path if not exists.\n Example /ResultsDirectory:<pathToResultsDirectory>", capabilities.HelpContentResourceName);
Assert.AreEqual("--ResultsDirectory|/ResultsDirectory" + Environment.NewLine + " Test results directory will be created in specified path if not exists." + Environment.NewLine + " Example /ResultsDirectory:<pathToResultsDirectory>", capabilities.HelpContentResourceName);

Assert.AreEqual(HelpContentPriority.ResultsDirectoryArgumentProcessorHelpPriority, capabilities.HelpPriority);
Assert.AreEqual(false, capabilities.IsAction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void CapabilitiesShouldReturnAppropriateProperties()
{
var capabilities = new RunSettingsArgumentProcessorCapabilities();
Assert.AreEqual("/Settings", capabilities.CommandName);
Assert.AreEqual("--Settings|/Settings:<Settings File>\n Settings to use when running tests.", capabilities.HelpContentResourceName);
Assert.AreEqual("--Settings|/Settings:<Settings File>" + Environment.NewLine + " Settings to use when running tests.", capabilities.HelpContentResourceName);

Assert.AreEqual(HelpContentPriority.RunSettingsArgumentProcessorHelpPriority, capabilities.HelpPriority);
Assert.AreEqual(false, capabilities.IsAction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void CapabilitiesShouldReturnAppropriateProperties()
{
RunSpecificTestsArgumentProcessorCapabilities capabilities = new RunSpecificTestsArgumentProcessorCapabilities();
Assert.AreEqual("/Tests", capabilities.CommandName);
StringAssert.Contains(capabilities.HelpContentResourceName, "/Tests:<Test Names>\n Run tests with names that match the provided values.");
StringAssert.Contains(capabilities.HelpContentResourceName, "/Tests:<Test Names>" + Environment.NewLine + " Run tests with names that match the provided values.");

Assert.AreEqual(HelpContentPriority.RunSpecificTestsArgumentProcessorHelpPriority, capabilities.HelpPriority);
Assert.AreEqual(true, capabilities.IsAction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void CapabilitiesShouldReturnAppropriateProperties()
{
RunTestsArgumentProcessorCapabilities capabilities = new RunTestsArgumentProcessorCapabilities();
Assert.AreEqual("/RunTests", capabilities.CommandName);
Assert.AreEqual("[TestFileNames]\n Run tests from the specified files. Separate multiple test file names\n by spaces.\n Examples: mytestproject.dll\n mytestproject.dll myothertestproject.exe", capabilities.HelpContentResourceName);
Assert.AreEqual("[TestFileNames]" + Environment.NewLine + " Run tests from the specified files. Separate multiple test file names" + Environment.NewLine + " by spaces." + Environment.NewLine + " Examples: mytestproject.dll" + Environment.NewLine + " mytestproject.dll myothertestproject.exe", capabilities.HelpContentResourceName);

Assert.AreEqual(HelpContentPriority.RunTestsArgumentProcessorHelpPriority, capabilities.HelpPriority);
Assert.AreEqual(true, capabilities.IsAction);
Expand Down
Loading

0 comments on commit 1dcdba7

Please sign in to comment.