Skip to content

Commit

Permalink
Fixing the tests for string comparison issue. (#1462)
Browse files Browse the repository at this point in the history
  • Loading branch information
singhsarab authored Mar 6, 2018
1 parent ce63e28 commit 5ea993a
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 Expand Up @@ -251,7 +251,7 @@ public void InitializeShouldNotUpdateCommandLineOptionsArchitectureAndFxIfNotPro
runSettings.LoadSettingsXml(DefaultRunSettings);
settingsProvider.SetActiveRunSettings(runSettings);

var args = new string[] {};
var args = new string[] { };
this.executor.Initialize(args);

Assert.IsFalse(this.commandLineOptions.ArchitectureSpecified);
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 @@ -11,6 +11,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine.UnitTests.Processors
using System.Linq;
using Microsoft.VisualStudio.TestPlatform.Common;
using Moq;
using System;

[TestClass]
public class EnableLoggersArgumentProcessorTests
Expand Down Expand Up @@ -41,9 +42,9 @@ public void CapabilitiesShouldAppropriateProperties()
EnableLoggerArgumentProcessorCapabilities capabilities = new EnableLoggerArgumentProcessorCapabilities();
Assert.AreEqual("/Logger", capabilities.CommandName);
#if NET451
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 \"normal\">\n Allowed values for verbosity: quiet, minimal, normal and detailed.\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", 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 \"normal\">" + Environment.NewLine + " Allowed values for verbosity: quiet, minimal, normal and detailed." + 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", capabilities.HelpContentResourceName);
#else
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, normal and detailed.\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", 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, normal and detailed." + 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", capabilities.HelpContentResourceName);
#endif

Assert.AreEqual(HelpContentPriority.EnableLoggerArgumentProcessorHelpPriority, capabilities.HelpPriority);
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 @@ -102,7 +102,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 @@ -9,6 +9,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine.UnitTests.Processors
using Microsoft.VisualStudio.TestPlatform.Common.Utilities;

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

[TestClass]
public class ParallelArgumentProcessorTests
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 @@ -8,6 +8,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine.UnitTests.Processors
using vstest.console.UnitTests.Processors;
using Microsoft.VisualStudio.TestPlatform.Common.Utilities;
using ExceptionUtilities = Microsoft.VisualStudio.TestPlatform.CommandLine.UnitTests.ExceptionUtilities;
using System;

[TestClass]
public class PlatformArgumentProcessorTests
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 @@ -85,7 +85,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
Loading

0 comments on commit 5ea993a

Please sign in to comment.