diff --git a/src/Microsoft.TestPlatform.Common/ExtensionFramework/VSExtensionManager.cs b/src/Microsoft.TestPlatform.Common/ExtensionFramework/VSExtensionManager.cs index 1d0c10ec4b..f798ae9350 100644 --- a/src/Microsoft.TestPlatform.Common/ExtensionFramework/VSExtensionManager.cs +++ b/src/Microsoft.TestPlatform.Common/ExtensionFramework/VSExtensionManager.cs @@ -90,7 +90,7 @@ private IEnumerable GetTestExtensionsInternal(string extensionType) object extensionManager; object settingsManager; - settingsManager = SettingsManagerType.GetMethod("CreateForApplication", new Type[] { typeof(String) }).Invoke(null, new object[] { installContext.GetVisualStudioPath(vsInstallPath) }); + settingsManager = SettingsManagerType.GetMethod("CreateForApplication", new Type[] { typeof(string) }).Invoke(null, new object[] { installContext.GetVisualStudioPath(vsInstallPath) }); if (settingsManager != null) { try @@ -100,7 +100,7 @@ private IEnumerable GetTestExtensionsInternal(string extensionType) if (extensionManager != null) { - installedExtensions = ExtensionManagerServiceType.GetMethod("GetEnabledExtensionContentLocations", new Type[] { typeof(String) }).Invoke( + installedExtensions = ExtensionManagerServiceType.GetMethod("GetEnabledExtensionContentLocations", new Type[] { typeof(string) }).Invoke( extensionManager, new object[] { extensionType }) as IEnumerable; } else diff --git a/src/Microsoft.TestPlatform.Common/Filtering/FilterExpressionWrapper.cs b/src/Microsoft.TestPlatform.Common/Filtering/FilterExpressionWrapper.cs index 8438523f8f..f187ff0816 100644 --- a/src/Microsoft.TestPlatform.Common/Filtering/FilterExpressionWrapper.cs +++ b/src/Microsoft.TestPlatform.Common/Filtering/FilterExpressionWrapper.cs @@ -112,7 +112,7 @@ public string ParseError /// /// Validate if underlying filter expression is valid for given set of supported properties. /// - public string[] ValidForProperties(IEnumerable supportedProperties, Func propertyProvider) + public string[] ValidForProperties(IEnumerable supportedProperties, Func propertyProvider) { return UseFastFilter ? FastFilter.ValidForProperties(supportedProperties) : _filterExpression?.ValidForProperties(supportedProperties, propertyProvider); } diff --git a/src/Microsoft.TestPlatform.Common/Filtering/TestCaseFilterExpression.cs b/src/Microsoft.TestPlatform.Common/Filtering/TestCaseFilterExpression.cs index 04bedf0e2d..86e0acc374 100644 --- a/src/Microsoft.TestPlatform.Common/Filtering/TestCaseFilterExpression.cs +++ b/src/Microsoft.TestPlatform.Common/Filtering/TestCaseFilterExpression.cs @@ -49,7 +49,7 @@ public string TestCaseFilterValue /// /// Validate if underlying filter expression is valid for given set of supported properties. /// - public string[] ValidForProperties(IEnumerable supportedProperties, Func propertyProvider) + public string[] ValidForProperties(IEnumerable supportedProperties, Func propertyProvider) { string[] invalidProperties = null; if (null != _filterWrapper && _validForMatch) diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestCategoryItems.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestCategoryItems.cs index 2fd869fe22..39cb8914c8 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestCategoryItems.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestCategoryItems.cs @@ -31,7 +31,7 @@ public TestCategoryItem(string category) // Treat null as empty. if (category == null) { - category = String.Empty; + category = string.Empty; } @@ -52,10 +52,10 @@ public string TestCategory private string StripIllegalChars(string category) { string ret = category.Trim(); - ret = ret.Replace("&", String.Empty); - ret = ret.Replace("|", String.Empty); - ret = ret.Replace("!", String.Empty); - ret = ret.Replace(",", String.Empty); + ret = ret.Replace("&", string.Empty); + ret = ret.Replace("|", string.Empty); + ret = ret.Replace("!", string.Empty); + ret = ret.Replace(",", string.Empty); return ret; } @@ -71,7 +71,7 @@ public override bool Equals(object other) return false; } Debug.Assert(_category != null, "category is null"); - return String.Equals(_category, otherItem._category, StringComparison.OrdinalIgnoreCase); + return string.Equals(_category, otherItem._category, StringComparison.OrdinalIgnoreCase); } /// @@ -154,7 +154,7 @@ public override void Add(TestCategoryItem item) EqtAssert.ParameterNotNull(item, nameof(item)); // Don't add empty items. - if (!String.IsNullOrEmpty(item.TestCategory)) + if (!string.IsNullOrEmpty(item.TestCategory)) { base.Add(item); } diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestRun.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestRun.cs index 9760b7aef1..27478ed43c 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestRun.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestRun.cs @@ -163,13 +163,13 @@ internal string GetResultsDirectory() if (RunConfiguration == null) { Debug.Fail("'RunConfiguration' is null"); - throw new Exception(String.Format(CultureInfo.CurrentCulture, TrxLoggerResources.Common_MissingRunConfigInRun)); + throw new Exception(string.Format(CultureInfo.CurrentCulture, TrxLoggerResources.Common_MissingRunConfigInRun)); } if (string.IsNullOrEmpty(RunConfiguration.RunDeploymentRootDirectory)) { Debug.Fail("'RunConfiguration.RunDeploymentRootDirectory' is null or empty"); - throw new Exception(String.Format(CultureInfo.CurrentCulture, TrxLoggerResources.Common_MissingRunDeploymentRootInRunConfig)); + throw new Exception(string.Format(CultureInfo.CurrentCulture, TrxLoggerResources.Common_MissingRunDeploymentRootInRunConfig)); } return RunConfiguration.RunDeploymentInDirectory; @@ -185,7 +185,7 @@ private static string FormatDateTimeForRunName(DateTime timeStamp) private void Initialize() { _id = Guid.NewGuid(); - _name = String.Format(CultureInfo.CurrentCulture, TrxLoggerResources.Common_TestRunName, Environment.GetEnvironmentVariable("UserName"), Environment.MachineName, FormatDateTimeForRunName(DateTime.Now)); + _name = string.Format(CultureInfo.CurrentCulture, TrxLoggerResources.Common_TestRunName, Environment.GetEnvironmentVariable("UserName"), Environment.MachineName, FormatDateTimeForRunName(DateTime.Now)); // Fix for issue (https://github.com/Microsoft/vstest/issues/213). Since there is no way to find current user in linux machine. // We are catching PlatformNotSupportedException for non windows machine. diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestRunSummary.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestRunSummary.cs index e22ecd967b..50f5e475d2 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestRunSummary.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestRunSummary.cs @@ -57,7 +57,7 @@ internal class TestRunSummary : IXmlTestStore private readonly List _collectorDataEntries; - private readonly IList _resultFiles; + private readonly IList _resultFiles; /// /// Initializes a new instance of the class. @@ -97,7 +97,7 @@ public TestRunSummary( TestOutcome outcome, List runMessages, string stdOut, - IList resultFiles, + IList resultFiles, List dataCollectors) { _totalTests = total; diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Converter.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Converter.cs index a9582c5fcb..5864340468 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Converter.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Converter.cs @@ -191,10 +191,10 @@ public List ToCollectionEntries(IEnumerable a return collectorEntries; } - public IList ToResultFiles(IEnumerable attachmentSets, TestRun testRun, string trxFileDirectory, + public IList ToResultFiles(IEnumerable attachmentSets, TestRun testRun, string trxFileDirectory, List errorMessages) { - List resultFiles = new(); + List resultFiles = new(); if (attachmentSets == null) { return resultFiles; diff --git a/src/Microsoft.TestPlatform.ObjectModel/Adapter/Interfaces/IRunContext.cs b/src/Microsoft.TestPlatform.ObjectModel/Adapter/Interfaces/IRunContext.cs index dd25a41287..465e88cb64 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Adapter/Interfaces/IRunContext.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Adapter/Interfaces/IRunContext.cs @@ -38,7 +38,7 @@ public interface IRunContext : IDiscoveryContext /// It is used only with sources. With specific test cases it will always be null. /// If there is a parsing error or filter expression has unsupported properties, TestPlatformFormatException() is thrown. /// - ITestCaseFilterExpression GetTestCaseFilter(IEnumerable supportedProperties, Func propertyProvider); + ITestCaseFilterExpression GetTestCaseFilter(IEnumerable supportedProperties, Func propertyProvider); /// /// Directory which should be used for storing result files/deployment files etc. diff --git a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/Common/FileHelper.cs b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/Common/FileHelper.cs index ae7cb9b3ab..6bc6749df5 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/Common/FileHelper.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/Common/FileHelper.cs @@ -47,7 +47,7 @@ public static bool IsValidFileName(string fileName, out string invalidCharacters { if (InvalidFileNameChars.ContainsKey(fileName[i])) { - invalidCharacters = String.Concat(invalidCharacters, fileName[i]); + invalidCharacters = string.Concat(invalidCharacters, fileName[i]); result = false; } } diff --git a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/DataCollectorSettings.cs b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/DataCollectorSettings.cs index 53ff47643b..de9d139dc5 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/DataCollectorSettings.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/DataCollectorSettings.cs @@ -161,7 +161,7 @@ internal static DataCollectorSettings FromXml(XmlReader reader) } catch (UriFormatException) { - throw new SettingsException(String.Format(CultureInfo.CurrentCulture, Resources.Resources.InvalidDataCollectorUriInSettings, reader.Value)); + throw new SettingsException(string.Format(CultureInfo.CurrentCulture, Resources.Resources.InvalidDataCollectorUriInSettings, reader.Value)); } break; @@ -186,7 +186,7 @@ internal static DataCollectorSettings FromXml(XmlReader reader) default: throw new SettingsException( - String.Format( + string.Format( CultureInfo.CurrentCulture, Resources.Resources.InvalidSettingsXmlAttribute, Constants.DataCollectionRunSettingsName, @@ -212,7 +212,7 @@ internal static DataCollectorSettings FromXml(XmlReader reader) default: throw new SettingsException( - String.Format( + string.Format( CultureInfo.CurrentCulture, Resources.Resources.InvalidSettingsXmlElement, Constants.DataCollectionRunSettingsName, diff --git a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/InProcDataCollector/TestSessionStartArgs.cs b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/InProcDataCollector/TestSessionStartArgs.cs index bac4c2a782..d7163efdf5 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/InProcDataCollector/TestSessionStartArgs.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/InProcDataCollector/TestSessionStartArgs.cs @@ -20,7 +20,7 @@ public class TestSessionStartArgs : InProcDataCollectionArgs /// public TestSessionStartArgs() { - Configuration = String.Empty; + Configuration = string.Empty; } /// @@ -31,7 +31,7 @@ public TestSessionStartArgs() /// public TestSessionStartArgs(IDictionary properties) { - Configuration = String.Empty; + Configuration = string.Empty; _properties = properties; } diff --git a/src/Microsoft.TestPlatform.ObjectModel/ExceptionConverter.cs b/src/Microsoft.TestPlatform.ObjectModel/ExceptionConverter.cs index 37490a0676..52fd61e7aa 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/ExceptionConverter.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/ExceptionConverter.cs @@ -15,7 +15,7 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel; #endif public class TestPlatformException : Exception { - public TestPlatformException(String message) + public TestPlatformException(string message) : base(message) { } @@ -57,7 +57,7 @@ public static Exception ConvertException(FaultException faultEx) /// actual exception that is to be wrapped /// actual exception that is represented by the exception name [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Instantiating an instance of Exception class")] - private static Exception ConvertException(String exceptionType, String message, Exception innerException) + private static Exception ConvertException(string exceptionType, string message, Exception innerException) { try { diff --git a/src/Microsoft.TestPlatform.ObjectModel/RunSettings/RunConfiguration.cs b/src/Microsoft.TestPlatform.ObjectModel/RunSettings/RunConfiguration.cs index 6be597bd72..cb19f73275 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/RunSettings/RunConfiguration.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/RunSettings/RunConfiguration.cs @@ -599,7 +599,7 @@ public static RunConfiguration FromXml(XmlReader reader) bool bCollectSourceInformation = true; if (!bool.TryParse(collectSourceInformationStr, out bCollectSourceInformation)) { - throw new SettingsException(String.Format(CultureInfo.CurrentCulture, + throw new SettingsException(string.Format(CultureInfo.CurrentCulture, Resources.Resources.InvalidSettingsIncorrectValue, Constants.RunConfigurationSettingsName, bCollectSourceInformation, elementName)); } @@ -666,7 +666,7 @@ public static RunConfiguration FromXml(XmlReader reader) string designModeValueString = reader.ReadElementContentAsString(); if (!bool.TryParse(designModeValueString, out bool designMode)) { - throw new SettingsException(String.Format(CultureInfo.CurrentCulture, + throw new SettingsException(string.Format(CultureInfo.CurrentCulture, Resources.Resources.InvalidSettingsIncorrectValue, Constants.RunConfigurationSettingsName, designModeValueString, elementName)); } runConfiguration.DesignMode = designMode; @@ -678,7 +678,7 @@ public static RunConfiguration FromXml(XmlReader reader) string inIsolationValueString = reader.ReadElementContentAsString(); if (!bool.TryParse(inIsolationValueString, out bool inIsolation)) { - throw new SettingsException(String.Format(CultureInfo.CurrentCulture, + throw new SettingsException(string.Format(CultureInfo.CurrentCulture, Resources.Resources.InvalidSettingsIncorrectValue, Constants.RunConfigurationSettingsName, inIsolationValueString, elementName)); } runConfiguration.InIsolation = inIsolation; @@ -690,7 +690,7 @@ public static RunConfiguration FromXml(XmlReader reader) string disableAppDomainValueString = reader.ReadElementContentAsString(); if (!bool.TryParse(disableAppDomainValueString, out bool disableAppDomainCheck)) { - throw new SettingsException(String.Format(CultureInfo.CurrentCulture, + throw new SettingsException(string.Format(CultureInfo.CurrentCulture, Resources.Resources.InvalidSettingsIncorrectValue, Constants.RunConfigurationSettingsName, disableAppDomainValueString, elementName)); } runConfiguration.DisableAppDomain = disableAppDomainCheck; diff --git a/src/Microsoft.TestPlatform.ObjectModel/Utilities/AssemblyLoadWorker.cs b/src/Microsoft.TestPlatform.ObjectModel/Utilities/AssemblyLoadWorker.cs index 576a7df7ab..da632f942d 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Utilities/AssemblyLoadWorker.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Utilities/AssemblyLoadWorker.cs @@ -165,7 +165,7 @@ public string[] GetReferencedAssemblies(string path) public void GetPlatformAndFrameworkSettings(string path, out string procArchType, out string frameworkVersion) { procArchType = nameof(Architecture.Default); - frameworkVersion = String.Empty; + frameworkVersion = string.Empty; try { diff --git a/src/Microsoft.TestPlatform.ObjectModel/Utilities/XmlRunSettingsUtilities.cs b/src/Microsoft.TestPlatform.ObjectModel/Utilities/XmlRunSettingsUtilities.cs index d1a6dc9260..899d637af5 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Utilities/XmlRunSettingsUtilities.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Utilities/XmlRunSettingsUtilities.cs @@ -307,7 +307,7 @@ public static DataCollectionRunSettings GetInProcDataCollectionRunSettings(strin /// /// The run Settings Xml. /// The . - public static LoggerRunSettings GetLoggerRunSettings(String runSettings) + public static LoggerRunSettings GetLoggerRunSettings(string runSettings) { return GetNodeValue( runSettings, diff --git a/src/Microsoft.TestPlatform.Utilities/InferRunSettingsHelper.cs b/src/Microsoft.TestPlatform.Utilities/InferRunSettingsHelper.cs index 4e7e37a311..5c5be172b1 100644 --- a/src/Microsoft.TestPlatform.Utilities/InferRunSettingsHelper.cs +++ b/src/Microsoft.TestPlatform.Utilities/InferRunSettingsHelper.cs @@ -437,7 +437,7 @@ public static void UpdateTargetPlatform(XmlDocument runSettingsDocument, string AddNodeIfNotPresent(runSettingsDocument, TargetPlatformNodePath, TargetPlatformNodeName, platform, overwrite); } - public static bool TryGetDeviceXml(XPathNavigator runSettingsNavigator, out String deviceXml) + public static bool TryGetDeviceXml(XPathNavigator runSettingsNavigator, out string deviceXml) { ValidateArg.NotNull(runSettingsNavigator, nameof(runSettingsNavigator)); @@ -630,10 +630,10 @@ public static bool TryGetFrameworkXml(XPathNavigator runSettingsNavigator, out s /// Returns the sources matching the specified platform and framework settings. /// For incompatible sources, warning is added to incompatibleSettingWarning. /// - public static IEnumerable FilterCompatibleSources(Architecture chosenPlatform, Architecture defaultArchitecture, Framework chosenFramework, IDictionary sourcePlatforms, IDictionary sourceFrameworks, out String incompatibleSettingWarning) + public static IEnumerable FilterCompatibleSources(Architecture chosenPlatform, Architecture defaultArchitecture, Framework chosenFramework, IDictionary sourcePlatforms, IDictionary sourceFrameworks, out string incompatibleSettingWarning) { incompatibleSettingWarning = string.Empty; - List compatibleSources = new(); + List compatibleSources = new(); StringBuilder warnings = new(); warnings.AppendLine(); bool incompatiblityFound = false; diff --git a/src/vstest.console/CommandLine/CommandArgumentPair.cs b/src/vstest.console/CommandLine/CommandArgumentPair.cs index dce53f1593..a88f6270be 100644 --- a/src/vstest.console/CommandLine/CommandArgumentPair.cs +++ b/src/vstest.console/CommandLine/CommandArgumentPair.cs @@ -37,11 +37,11 @@ internal class CommandArgumentPair /// Input to break up. public CommandArgumentPair(string input) { - if (String.IsNullOrWhiteSpace(input)) + if (string.IsNullOrWhiteSpace(input)) { throw new ArgumentException(CommandLineResources.CannotBeNullOrEmpty, nameof(input)); } - Contract.Ensures(!String.IsNullOrWhiteSpace(Command)); + Contract.Ensures(!string.IsNullOrWhiteSpace(Command)); Parse(input); } @@ -53,7 +53,7 @@ public CommandArgumentPair(string input) /// The argument portion of the input. public CommandArgumentPair(string command, string argument) { - if (String.IsNullOrWhiteSpace(command)) + if (string.IsNullOrWhiteSpace(command)) { throw new ArgumentException(CommandLineResources.CannotBeNullOrEmpty, nameof(command)); } @@ -71,8 +71,8 @@ public CommandArgumentPair(string command, string argument) /// Input string to parse. private void Parse(string input) { - Contract.Requires(!String.IsNullOrWhiteSpace(input)); - Contract.Ensures(!String.IsNullOrWhiteSpace(Command)); + Contract.Requires(!string.IsNullOrWhiteSpace(input)); + Contract.Ensures(!string.IsNullOrWhiteSpace(Command)); Contract.Ensures(Argument != null); // Find the index of the separator (":") @@ -82,7 +82,7 @@ private void Parse(string input) { // No separator was found, so use the input as the command. Command = input; - Argument = String.Empty; + Argument = string.Empty; } else { diff --git a/src/vstest.console/CommandLine/CommandLineOptions.cs b/src/vstest.console/CommandLine/CommandLineOptions.cs index 9609885629..e2a86d2a22 100644 --- a/src/vstest.console/CommandLine/CommandLineOptions.cs +++ b/src/vstest.console/CommandLine/CommandLineOptions.cs @@ -268,7 +268,7 @@ internal Framework TargetFrameworkVersion /// Path to source file to look for tests in. public void AddSource(string source) { - if (String.IsNullOrWhiteSpace(source)) + if (string.IsNullOrWhiteSpace(source)) { throw new TestSourceException(CommandLineResources.CannotBeNullOrEmpty); } diff --git a/src/vstest.console/Internal/ConsoleLogger.cs b/src/vstest.console/Internal/ConsoleLogger.cs index 9690ffc630..2b826a3019 100644 --- a/src/vstest.console/Internal/ConsoleLogger.cs +++ b/src/vstest.console/Internal/ConsoleLogger.cs @@ -220,7 +220,7 @@ public void Initialize(TestLoggerEvents events, Dictionary param parameters.TryGetValue(DefaultLoggerParameterNames.TargetFramework, out _targetFramework); _targetFramework = !string.IsNullOrEmpty(_targetFramework) ? NuGetFramework.Parse(_targetFramework).GetShortFolderName() : _targetFramework; - Initialize(events, String.Empty); + Initialize(events, string.Empty); } #endregion @@ -257,7 +257,7 @@ private static string GetFormattedOutput(Collection testMessa var sb = new StringBuilder(); foreach (var message in testMessageCollection) { - var prefix = String.Format(CultureInfo.CurrentCulture, "{0}{1}", Environment.NewLine, TestMessageFormattingPrefix); + var prefix = string.Format(CultureInfo.CurrentCulture, "{0}{1}", Environment.NewLine, TestMessageFormattingPrefix); var messageText = message.Text?.Replace(Environment.NewLine, prefix).TrimEnd(TestMessageFormattingPrefix.ToCharArray()); if (!string.IsNullOrWhiteSpace(messageText)) @@ -267,7 +267,7 @@ private static string GetFormattedOutput(Collection testMessa } return sb.ToString(); } - return String.Empty; + return string.Empty; } /// @@ -290,19 +290,19 @@ private static void DisplayFullInformation(TestResult result) var addAdditionalNewLine = false; Debug.Assert(result != null, "a null result can not be displayed"); - if (!String.IsNullOrEmpty(result.ErrorMessage)) + if (!string.IsNullOrEmpty(result.ErrorMessage)) { addAdditionalNewLine = true; Output.Information(false, ConsoleColor.Red, string.Format("{0}{1}", TestResultPrefix, CommandLineResources.ErrorMessageBanner)); - var errorMessage = String.Format(CultureInfo.CurrentCulture, "{0}{1}{2}", TestResultPrefix, TestMessageFormattingPrefix, result.ErrorMessage); + var errorMessage = string.Format(CultureInfo.CurrentCulture, "{0}{1}{2}", TestResultPrefix, TestMessageFormattingPrefix, result.ErrorMessage); Output.Information(false, ConsoleColor.Red, errorMessage); } - if (!String.IsNullOrEmpty(result.ErrorStackTrace)) + if (!string.IsNullOrEmpty(result.ErrorStackTrace)) { addAdditionalNewLine = false; Output.Information(false, ConsoleColor.Red, string.Format("{0}{1}", TestResultPrefix, CommandLineResources.StacktraceBanner)); - var stackTrace = String.Format(CultureInfo.CurrentCulture, "{0}{1}", TestResultPrefix, result.ErrorStackTrace); + var stackTrace = string.Format(CultureInfo.CurrentCulture, "{0}{1}", TestResultPrefix, result.ErrorStackTrace); Output.Information(false, ConsoleColor.Red, stackTrace); } @@ -360,7 +360,7 @@ private static void DisplayFullInformation(TestResult result) if (addAdditionalNewLine) { - Output.WriteLine(String.Empty, OutputLevel.Information); + Output.WriteLine(string.Empty, OutputLevel.Information); } } diff --git a/src/vstest.console/Processors/ListFullyQualifiedTestsArgumentProcessor.cs b/src/vstest.console/Processors/ListFullyQualifiedTestsArgumentProcessor.cs index ab14170be9..49e6a7b6d2 100644 --- a/src/vstest.console/Processors/ListFullyQualifiedTestsArgumentProcessor.cs +++ b/src/vstest.console/Processors/ListFullyQualifiedTestsArgumentProcessor.cs @@ -301,7 +301,7 @@ private static void ValidateFilter(string filterString) if (filterWrapper.ParseError != null) { - var fe = new FormatException(String.Format("Invalid Test Case Filter: {0}", filterString)); + var fe = new FormatException(string.Format("Invalid Test Case Filter: {0}", filterString)); EqtTrace.Error("TestCaseFilter.ValidateFilter : Filtering failed with exception : " + fe.Message); throw fe; } diff --git a/src/vstest.console/Processors/ListTestsArgumentProcessor.cs b/src/vstest.console/Processors/ListTestsArgumentProcessor.cs index b6d2925d69..9ad0e95bc4 100644 --- a/src/vstest.console/Processors/ListTestsArgumentProcessor.cs +++ b/src/vstest.console/Processors/ListTestsArgumentProcessor.cs @@ -220,7 +220,7 @@ private void DiscoveryRequest_OnDiscoveredTests(Object sender, DiscoveredTestsEv // List out each of the tests. foreach (var test in args.DiscoveredTestCases) { - _output.WriteLine(String.Format(CultureInfo.CurrentUICulture, + _output.WriteLine(string.Format(CultureInfo.CurrentUICulture, CommandLineResources.AvailableTestsFormat, test.DisplayName), OutputLevel.Information); diff --git a/src/vstest.console/Processors/Utilities/ArgumentProcessorFactory.cs b/src/vstest.console/Processors/Utilities/ArgumentProcessorFactory.cs index 085645445a..4fc3a38eee 100644 --- a/src/vstest.console/Processors/Utilities/ArgumentProcessorFactory.cs +++ b/src/vstest.console/Processors/Utilities/ArgumentProcessorFactory.cs @@ -121,7 +121,7 @@ internal Dictionary SpecialCommandToProcessorMap /// The argument processor or null if one was not found. public IArgumentProcessor CreateArgumentProcessor(string argument) { - if (String.IsNullOrWhiteSpace(argument)) + if (string.IsNullOrWhiteSpace(argument)) { throw new ArgumentException("Cannot be null or empty", nameof(argument)); } diff --git a/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs b/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs index f08fbf603b..c4f476de65 100644 --- a/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs +++ b/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs @@ -1205,7 +1205,7 @@ private IRequestData GetRequestData(ProtocolConfig protocolConfig) }; } - private List GetSources(TestRunRequestPayload testRunRequestPayload) + private List GetSources(TestRunRequestPayload testRunRequestPayload) { List sources = new(); if (testRunRequestPayload.Sources != null diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/RunsettingsTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/RunsettingsTests.cs index 57900e0bf3..d19f50f515 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/RunsettingsTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/RunsettingsTests.cs @@ -42,7 +42,7 @@ public void CommandLineRunSettingsShouldWinAmongAllOptions(RunnerInfo runnerInfo // passing different platform var additionalArgs = "/Platform:x64"; - var runSettingsArgs = String.Join( + var runSettingsArgs = string.Join( " ", new string[] { @@ -73,7 +73,7 @@ public void CLIRunsettingsShouldWinBetweenCLISwitchesAndCLIRunsettings(RunnerInf var additionalArgs = "/Parallel"; // Pass non parallel - var runSettingsArgs = String.Join( + var runSettingsArgs = string.Join( " ", new string[] { @@ -149,7 +149,7 @@ public void RunSettingsParamsAsArguments(RunnerInfo runnerInfo) var testhostProcessName = new[] { "testhost.x86" }; var expectedNumOfProcessCreated = 1; - var runSettingsArgs = String.Join( + var runSettingsArgs = string.Join( " ", new string[] { @@ -180,7 +180,7 @@ public void RunSettingsAndRunSettingsParamsAsArguments(RunnerInfo runnerInfo) { "TestAdaptersPaths", GetTestAdapterPath() } }; - var runSettingsArgs = String.Join( + var runSettingsArgs = string.Join( " ", new string[] { diff --git a/test/Microsoft.TestPlatform.CoreUtilities.UnitTests/Utilities/JobQueueTests.cs b/test/Microsoft.TestPlatform.CoreUtilities.UnitTests/Utilities/JobQueueTests.cs index d78fcb878f..edd278ea6a 100644 --- a/test/Microsoft.TestPlatform.CoreUtilities.UnitTests/Utilities/JobQueueTests.cs +++ b/test/Microsoft.TestPlatform.CoreUtilities.UnitTests/Utilities/JobQueueTests.cs @@ -404,9 +404,9 @@ public void TestDisposeUnblocksBlockedThreads() /// a class that inherits from job queue and over rides the WaitForQueueToEmpty to allow for checking that blocking and /// unblocking work as expected. /// - internal class JobQueueWrapper : JobQueue + internal class JobQueueWrapper : JobQueue { - public JobQueueWrapper(Action processJob, + public JobQueueWrapper(Action processJob, int maxNoOfStringsQueueCanHold, int maxNoOfBytesQueueCanHold, bool isBoundsEnabled, @@ -440,9 +440,9 @@ public bool IsEnqueueBlocked /// a class that inherits from job queue and over rides the WaitForQueueToEmpty to simply setting a boolean to tell /// whether or not the queue entered the blocking method during the enqueue process. /// - internal class JobQueueNonBlocking : JobQueue + internal class JobQueueNonBlocking : JobQueue { - public JobQueueNonBlocking(Action processHandler) + public JobQueueNonBlocking(Action processHandler) : base(processHandler, "foo", 1, 5, true, (message) => { }) { EnteredBlockingMethod = false; diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithSourcesTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithSourcesTests.cs index 956dbc1cf1..cda0123955 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithSourcesTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithSourcesTests.cs @@ -285,7 +285,7 @@ public void SendSessionStartShouldCallSessionStartWithCorrectTestSources() _runTestsInstance.CallSendSessionStart(); - mockTestCaseEventsHandler.Verify(x => x.SendSessionStart(It.Is>( + mockTestCaseEventsHandler.Verify(x => x.SendSessionStart(It.Is>( y => y.ContainsKey("TestSources") && ((IEnumerable)y["TestSources"]).Contains("1.dll") && ((IEnumerable)y["TestSources"]).Contains("2.dll") diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithTestsTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithTestsTests.cs index feac386fd9..fa828d91d8 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithTestsTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithTestsTests.cs @@ -167,7 +167,7 @@ public void SendSessionStartShouldCallSessionStartWithCorrectTestSources() _runTestsInstance.CallSendSessionStart(); - mockTestCaseEventsHandler.Verify(x => x.SendSessionStart(It.Is>( + mockTestCaseEventsHandler.Verify(x => x.SendSessionStart(It.Is>( y => y.ContainsKey("TestSources") && ((IEnumerable)y["TestSources"]).Contains("s.dll") ))); diff --git a/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/TrxLoggerTests.cs b/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/TrxLoggerTests.cs index 7dbe5ab596..ea11b8df0e 100644 --- a/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/TrxLoggerTests.cs +++ b/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/TrxLoggerTests.cs @@ -236,7 +236,7 @@ public void TestResultHandlerLockingAMessageForSkipTest() _testableTrxLogger.TestResultHandler(new object(), skip1.Object); - string expectedMessage = String.Format(CultureInfo.CurrentCulture, TrxLoggerResources.MessageForSkippedTests, "Skip1"); + string expectedMessage = string.Format(CultureInfo.CurrentCulture, TrxLoggerResources.MessageForSkippedTests, "Skip1"); Assert.AreEqual(expectedMessage + Environment.NewLine, _testableTrxLogger.GetRunLevelInformationalMessage()); } @@ -745,9 +745,9 @@ public void GetCustomPropertyValueFromTestCaseShouldReadCategoryAttributesFromTe testCase1.SetPropertyValue(testProperty, new[] { "ClassLevel", "AsmLevel" }); var converter = new Converter(new Mock().Object, new TrxFileHelper()); - List listCategoriesActual = converter.GetCustomPropertyValueFromTestCase(testCase1, "MSTestDiscoverer.TestCategory"); + List listCategoriesActual = converter.GetCustomPropertyValueFromTestCase(testCase1, "MSTestDiscoverer.TestCategory"); - List listCategoriesExpected = new() + List listCategoriesExpected = new() { "ClassLevel", "AsmLevel" diff --git a/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Client/TestRunCriteriaTests.cs b/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Client/TestRunCriteriaTests.cs index 78cead76da..aa41e8bd2d 100644 --- a/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Client/TestRunCriteriaTests.cs +++ b/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Client/TestRunCriteriaTests.cs @@ -34,7 +34,7 @@ public void ConstructorForSourcesShouldInitializeAdapterSourceMap() public void ConstructorForSourcesWithBaseTestRunCriteriaShouldInitializeAdapterSourceMap() { var sources = new List { "s1.dll", "s2.dll" }; - var testRunCriteria = new TestRunCriteria(sources, new TestRunCriteria(new List { "temp.dll" }, 10)); + var testRunCriteria = new TestRunCriteria(sources, new TestRunCriteria(new List { "temp.dll" }, 10)); Assert.IsNotNull(testRunCriteria.AdapterSourceMap); CollectionAssert.AreEqual(new List { "_none_" }, testRunCriteria.AdapterSourceMap.Keys); @@ -150,5 +150,5 @@ public void TestCaseFilterSetterShouldSetFilterCriteriaForSources() Assert.AreEqual("foo", testRunCriteria.TestCaseFilter); } - #endregion + #endregion } diff --git a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs index 68eb09ffcb..55e0cc8a96 100644 --- a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs +++ b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs @@ -1116,7 +1116,7 @@ public void DisplayFullInformationShouldWriteStdMessageWithNewLine() _mockOutput.Verify(o => o.Write(PassedTestIndicator, OutputLevel.Information), Times.Once()); _mockOutput.Verify(o => o.WriteLine("TestName", OutputLevel.Information), Times.Once()); _mockOutput.Verify(o => o.WriteLine(" Hello", OutputLevel.Information), Times.Once()); - _mockOutput.Verify(o => o.WriteLine(String.Empty, OutputLevel.Information), Times.AtLeastOnce); + _mockOutput.Verify(o => o.WriteLine(string.Empty, OutputLevel.Information), Times.AtLeastOnce); } [TestMethod] diff --git a/test/vstest.console.UnitTests/Processors/CollectArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/CollectArgumentProcessorTests.cs index fe9242251c..0137c2c96d 100644 --- a/test/vstest.console.UnitTests/Processors/CollectArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/CollectArgumentProcessorTests.cs @@ -93,7 +93,7 @@ public void InitializeShouldThrowIfArguemntIsNull() [TestMethod] public void InitializeShouldNotThrowIfArgumentIsEmpty() { - Assert.ThrowsException(() => _executor.Initialize(String.Empty)); + Assert.ThrowsException(() => _executor.Initialize(string.Empty)); } [TestMethod] diff --git a/test/vstest.console.UnitTests/Processors/EnvironmentArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/EnvironmentArgumentProcessorTests.cs index 0cb3ee8fde..e797fe7ce5 100644 --- a/test/vstest.console.UnitTests/Processors/EnvironmentArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/EnvironmentArgumentProcessorTests.cs @@ -155,8 +155,8 @@ public void ShoudWarnWhenAValueIsOverriden() // Arrange _settingsProvider.UpdateRunSettingsNode("RunConfiguration.EnvironmentVariables.VARIABLE", "Initial value"); - var warningMessage = String.Format(CommandLineResources.CommandLineWarning, - String.Format(CommandLineResources.EnvironmentVariableXIsOverriden, "VARIABLE") + var warningMessage = string.Format(CommandLineResources.CommandLineWarning, + string.Format(CommandLineResources.EnvironmentVariableXIsOverriden, "VARIABLE") ); _mockOutput.Setup(mock => mock.WriteLine( diff --git a/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs index bfa9894723..3c69ba4558 100644 --- a/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs @@ -136,7 +136,7 @@ public void InitializeShouldThrowIfArgumentIsEmpty() var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, TestPlatformFactory.GetTestPlatform(), TestRunResultAggregator.Instance, _mockTestPlatformEventSource.Object, _inferHelper, _mockMetricsPublisherTask, _mockProcessHelper.Object, _mockAttachmentsProcessingManager.Object); var executor = GetExecutor(testRequestManager); - Assert.ThrowsException(() => executor.Initialize(String.Empty)); + Assert.ThrowsException(() => executor.Initialize(string.Empty)); } [TestMethod]