diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/AcceptanceTestBase.cs b/test/Microsoft.TestPlatform.AcceptanceTests/AcceptanceTestBase.cs index 7bacc1b8ac..d88979b837 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/AcceptanceTestBase.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/AcceptanceTestBase.cs @@ -115,7 +115,7 @@ protected string GetTargetFramworkForRunsettings() /// Empty runsettings, just with the RunSettings tag that we require. /// /// - public string GetEmptyRunsettings() + public static string GetEmptyRunsettings() { return ""; } @@ -133,7 +133,7 @@ public string GetDefaultRunSettings() /// Use the overload without any parameters to get the target framework from the currently set test environment. /// /// - public string GetRunSettingsWithTargetFramework(string targetFramework) + public static string GetRunSettingsWithTargetFramework(string targetFramework) { string runSettingsXml = $@" diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/BlameDataCollectorTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/BlameDataCollectorTests.cs index 9c3ff9b08d..b57824a342 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/BlameDataCollectorTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/BlameDataCollectorTests.cs @@ -354,7 +354,7 @@ private void VaildateOutput(TempDirectory tempDirectory, string testName, bool v Assert.IsTrue(isValid, "Sequence attachment is not valid."); } - private bool IsValidXml(string xmlFilePath) + private static bool IsValidXml(string xmlFilePath) { var file = File.OpenRead(xmlFilePath); var reader = XmlReader.Create(file); diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/CodeCoverageAcceptanceTestBase.cs b/test/Microsoft.TestPlatform.AcceptanceTests/CodeCoverageAcceptanceTestBase.cs index acae8026dc..3b2b5368c3 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/CodeCoverageAcceptanceTestBase.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/CodeCoverageAcceptanceTestBase.cs @@ -20,22 +20,22 @@ public class CodeCoverageAcceptanceTestBase : AcceptanceTestBase */ protected const double ExpectedMinimalModuleCoverage = 30.0; - protected string GetNetStandardAdapterPath() + protected static string GetNetStandardAdapterPath() { return Path.Combine(IntegrationTestEnvironment.TestPlatformRootDirectory, "artifacts", IntegrationTestEnvironment.BuildConfiguration, "Microsoft.CodeCoverage"); } - protected string GetNetFrameworkAdapterPath() + protected static string GetNetFrameworkAdapterPath() { return Path.Combine(IntegrationTestEnvironment.TestPlatformRootDirectory, "artifacts", IntegrationTestEnvironment.BuildConfiguration, "net451", "win7-x64", "Extensions"); } - protected string GetCodeCoverageExePath() + protected static string GetCodeCoverageExePath() { return Path.Combine(GetNetStandardAdapterPath(), "CodeCoverage", "CodeCoverage.exe"); } - protected XmlNode? GetModuleNode(XmlNode node, string name) + protected static XmlNode? GetModuleNode(XmlNode node, string name) { var moduleNode = GetNode(node, "module", name); @@ -52,12 +52,12 @@ protected string GetCodeCoverageExePath() return moduleNode; } - protected XmlNode? GetNode(XmlNode node, string type, string name) + protected static XmlNode? GetNode(XmlNode node, string type, string name) { return node.SelectSingleNode($"//{type}[@name='{name}']") ?? node.SelectSingleNode($"//{type}[@name='{name.ToLower()}']"); } - protected XmlDocument GetXmlCoverage(string coverageResult, TempDirectory tempDirectory) + protected static XmlDocument GetXmlCoverage(string coverageResult, TempDirectory tempDirectory) { var coverage = new XmlDocument(); @@ -94,7 +94,7 @@ protected XmlDocument GetXmlCoverage(string coverageResult, TempDirectory tempDi return coverage; } - protected void AssertCoverage(XmlNode node, double expectedCoverage) + protected static void AssertCoverage(XmlNode node, double expectedCoverage) { var coverage = node.Attributes!["block_coverage"] != null ? double.Parse(node.Attributes!["block_coverage"]!.Value) diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/CodeCoverageTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/CodeCoverageTests.cs index 19468e57ba..2c15ead6ae 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/CodeCoverageTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/CodeCoverageTests.cs @@ -301,7 +301,7 @@ private string CreateArguments( return arguments; } - private void AssertSkippedMethod(XmlDocument document) + private static void AssertSkippedMethod(XmlDocument document) { var module = GetModuleNode(document.DocumentElement!, "codecoveragetest.dll"); Assert.IsNotNull(module); @@ -321,7 +321,7 @@ private void AssertSkippedMethod(XmlDocument document) Assert.IsNotNull(testAbsFunction); } - private void ValidateCoverageData(XmlDocument document, string moduleName, bool validateSourceFileNames) + private static void ValidateCoverageData(XmlDocument document, string moduleName, bool validateSourceFileNames) { var module = GetModuleNode(document.DocumentElement!, moduleName.ToLower()); @@ -340,7 +340,7 @@ private void ValidateCoverageData(XmlDocument document, string moduleName, bool } } - private void AssertSourceFileName(XmlNode module) + private static void AssertSourceFileName(XmlNode module) { const string expectedFileName = "UnitTest1.cs"; diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/DataCollectionTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/DataCollectionTests.cs index 35e314a2b5..e97602ccb2 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/DataCollectionTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/DataCollectionTests.cs @@ -244,7 +244,7 @@ private void VaildateDataCollectorOutput(string resultsDir) Assert.AreEqual(3, diaglogsFileCount); } - private string GetRunsettingsFilePath(string resultsDir) + private static string GetRunsettingsFilePath(string resultsDir) { var runsettingsPath = Path.Combine(resultsDir, "test_" + Guid.NewGuid() + ".runsettings"); var dataCollectionAttributes = new Dictionary diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/DisableAppdomainTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/DisableAppdomainTests.cs index d2b585137f..aa66c29ee4 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/DisableAppdomainTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/DisableAppdomainTests.cs @@ -62,7 +62,7 @@ private void RunTests(RunnerInfo runnerInfo, string testAssembly, int passedTest ValidateSummaryStatus(passedTestCount, 0, 0); } - private string GetRunsettingsFilePath(TempDirectory tempDirectory, Dictionary runConfigurationDictionary) + private static string GetRunsettingsFilePath(TempDirectory tempDirectory, Dictionary runConfigurationDictionary) { var runsettingsPath = Path.Combine(tempDirectory.Path, "test_" + Guid.NewGuid() + ".runsettings"); CreateRunSettingsFile(runsettingsPath, runConfigurationDictionary); diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/DotnetArchitectureSwitchTests.Windows.cs b/test/Microsoft.TestPlatform.AcceptanceTests/DotnetArchitectureSwitchTests.Windows.cs index f07623f621..a4181d94ec 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/DotnetArchitectureSwitchTests.Windows.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/DotnetArchitectureSwitchTests.Windows.cs @@ -85,7 +85,7 @@ public void TestMethod1() Assert.AreEqual(0, exitCode, stdOut); } - private string GetLatestSdkVersion(string dotnetPath) + private static string GetLatestSdkVersion(string dotnetPath) => Path.GetFileName(Directory.GetDirectories(Path.Combine(Path.GetDirectoryName(dotnetPath)!, @"shared/Microsoft.NETCore.App")).OrderByDescending(x => x).First()); } diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/EventLogCollectorTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/EventLogCollectorTests.cs index 5f3e4313ad..60fcaebcf2 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/EventLogCollectorTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/EventLogCollectorTests.cs @@ -59,7 +59,7 @@ public void EventLogDataCollectorShoudCreateLogFileWithoutEventsIfEventsAreNotLo StdErrorDoesNotContains("Unable to read event log"); } - private string GetRunsettingsFilePath(TempDirectory tempDirectory) + private static string GetRunsettingsFilePath(TempDirectory tempDirectory) { var runsettingsPath = Path.Combine(tempDirectory.Path, "test_" + Guid.NewGuid() + ".runsettings"); @@ -115,7 +115,7 @@ private void VaildateDataCollectorOutput(TempDirectory tempDirectory) Assert.IsTrue(VerifyOrder(fileContent4, new[] { "110", "111", "112", "220", "221", "222", "223", "330", "331", "332" }), string.Format("Event log file content: {0}", fileContent4)); } - private bool VerifyOrder2(string content, Dictionary eventIdsDics) + private static bool VerifyOrder2(string content, Dictionary eventIdsDics) { foreach (var eventIds in eventIdsDics) { @@ -131,7 +131,7 @@ private bool VerifyOrder2(string content, Dictionary eventIdsDic return false; } - private bool VerifyOrder(string content, string[] eventIds) + private static bool VerifyOrder(string content, string[] eventIds) { for (int i = 0; i < eventIds.Length; i++) { diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/Extension/CompatibilityRowsBuilder.cs b/test/Microsoft.TestPlatform.AcceptanceTests/Extension/CompatibilityRowsBuilder.cs index 7c4f36888c..02fd84ff9f 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/Extension/CompatibilityRowsBuilder.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/Extension/CompatibilityRowsBuilder.cs @@ -310,7 +310,7 @@ private DebugInfo GetDebugInfo() }; } - private RunnerInfo GetRunnerInfo(string batch, string runnerFramework, string hostFramework, bool inIsolation) + private static RunnerInfo GetRunnerInfo(string batch, string runnerFramework, string hostFramework, bool inIsolation) { return new RunnerInfo { @@ -321,7 +321,7 @@ private RunnerInfo GetRunnerInfo(string batch, string runnerFramework, string ho }; } - private DllInfo GetMSTestInfo(string msTestVersion) + private static DllInfo GetMSTestInfo(string msTestVersion) { var depsXml = GetDependenciesXml(); diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/LoggerTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/LoggerTests.cs index 02d4d89780..c54c4e325c 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/LoggerTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/LoggerTests.cs @@ -163,7 +163,7 @@ public void TrxLoggerResultSummaryOutcomeValueShouldNotChangeIfNoTestsExecutedAn Assert.AreEqual("Completed", outcomeValue); } - private bool IsValidXml(string xmlFilePath) + private static bool IsValidXml(string xmlFilePath) { try { diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/TelemetryTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/TelemetryTests.cs index e6d8a0a17b..f95f694349 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/TelemetryTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/TelemetryTests.cs @@ -81,7 +81,7 @@ private void DiscoverTests(RunnerInfo runnerInfo) ValidateOutput("Discovery", TempDirectory); } - private void ValidateOutput(string command, TempDirectory tempDirectory) + private static void ValidateOutput(string command, TempDirectory tempDirectory) { if (!Directory.Exists(tempDirectory.Path)) { diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/CodeCoverageTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/CodeCoverageTests.cs index e3a2a80a3f..5f2a28d2be 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/CodeCoverageTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/CodeCoverageTests.cs @@ -441,7 +441,7 @@ private IList GetTestAssemblies() return GetProjects().Select(p => GetAssetFullPath(p)).ToList(); } - private IList GetProjects() + private static IList GetProjects() { return new List { "SimpleTestProject.dll", "SimpleTestProject2.dll" }; } diff --git a/test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/TestIdProvider/CompatibilityTests.cs b/test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/TestIdProvider/CompatibilityTests.cs index 1737604357..18232380ee 100644 --- a/test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/TestIdProvider/CompatibilityTests.cs +++ b/test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/TestIdProvider/CompatibilityTests.cs @@ -104,7 +104,7 @@ public void IdGeneration_ExtremelyLarge_TestVectors_10M_abc() ); } - private void IdGeneration_TestVector(string testName, string expected) + private static void IdGeneration_TestVector(string testName, string expected) { // Arrange expected = expected.Replace(" ", "").ToLowerInvariant(); @@ -118,7 +118,7 @@ private void IdGeneration_TestVector(string testName, string expected) Assert.AreEqual(expected, actual, $"Test Id for '{testName}' is invalid!"); } - private void IdGeneration_TestRepetitionVector(string input, int repetition, string expected) + private static void IdGeneration_TestRepetitionVector(string input, int repetition, string expected) { // Arrange var idProvider = new AdapterUtilities.TestIdProvider(); diff --git a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/Serialization/TestCaseSerializationTests.cs b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/Serialization/TestCaseSerializationTests.cs index 97fd73d599..79cc3b7716 100644 --- a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/Serialization/TestCaseSerializationTests.cs +++ b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/Serialization/TestCaseSerializationTests.cs @@ -263,7 +263,7 @@ private static T Deserialize(string json, int version = 1) return JsonDataSerializer.Instance.Deserialize(json, version); } - private void VerifyDummyPropertyIsRegistered() + private static void VerifyDummyPropertyIsRegistered() { var dummyProperty = TestProperty.Find("DummyProperty"); Assert.IsNotNull(dummyProperty); diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerTests.cs index 27f56d9d5f..3774208315 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerTests.cs @@ -784,7 +784,7 @@ public void StartTestRunShouldAttemptToTakeProxyFromPoolIfProxyIsNull() } } - private void SignalEvent(ManualResetEvent manualResetEvent) + private static void SignalEvent(ManualResetEvent manualResetEvent) { // Wait for the 100 ms. Task.Delay(200).Wait(); diff --git a/test/Microsoft.TestPlatform.PerformanceTests/TranslationLayer/TelemetryPerfTestBase.cs b/test/Microsoft.TestPlatform.PerformanceTests/TranslationLayer/TelemetryPerfTestBase.cs index aaae4f9e65..77b6fd9cdc 100644 --- a/test/Microsoft.TestPlatform.PerformanceTests/TranslationLayer/TelemetryPerfTestBase.cs +++ b/test/Microsoft.TestPlatform.PerformanceTests/TranslationLayer/TelemetryPerfTestBase.cs @@ -130,5 +130,5 @@ public string[] GetPerfAssetFullPath(string name, string framework = "net6.0") /// // DONT make this just it makes Translation layer hang... https://github.com/microsoft/vstest/issues/3519 - public string GetDefaultRunSettings() => ""; + public static string GetDefaultRunSettings() => ""; } diff --git a/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs b/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs index d3d5d5d0c1..dc1df35ae8 100644 --- a/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs +++ b/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs @@ -279,7 +279,7 @@ public void InvokeVsTestForDiscovery(string testAssembly, string testAdapterPath /// Runner Framework /// Framework for which Tests are not supported /// Message to be shown - public void ExecuteNotSupportedRunnerFrameworkTests(string runnerFramework, string framework, string message) + public static void ExecuteNotSupportedRunnerFrameworkTests(string runnerFramework, string framework, string message) { if (runnerFramework.StartsWith(framework)) { @@ -578,19 +578,19 @@ protected string GetTestAdapterPath(UnitTestFramework testFramework = UnitTestFr if (testFramework == UnitTestFramework.MSTest) { - adapterRelativePath = string.Format(_testAdapterRelativePath, _testEnvironment.DependencyVersions["MSTestAdapterVersion"]); + adapterRelativePath = string.Format(_testAdapterRelativePath, IntegrationTestEnvironment.DependencyVersions["MSTestAdapterVersion"]); } else if (testFramework == UnitTestFramework.NUnit) { - adapterRelativePath = string.Format(_nUnitTestAdapterRelativePath, _testEnvironment.DependencyVersions["NUnit3AdapterVersion"]); + adapterRelativePath = string.Format(_nUnitTestAdapterRelativePath, IntegrationTestEnvironment.DependencyVersions["NUnit3AdapterVersion"]); } else if (testFramework == UnitTestFramework.XUnit) { - adapterRelativePath = string.Format(_xUnitTestAdapterRelativePath, _testEnvironment.DependencyVersions["XUnitAdapterVersion"]); + adapterRelativePath = string.Format(_xUnitTestAdapterRelativePath, IntegrationTestEnvironment.DependencyVersions["XUnitAdapterVersion"]); } else if (testFramework == UnitTestFramework.Chutzpah) { - adapterRelativePath = string.Format(_chutzpahTestAdapterRelativePath, _testEnvironment.DependencyVersions["ChutzpahAdapterVersion"]); + adapterRelativePath = string.Format(_chutzpahTestAdapterRelativePath, IntegrationTestEnvironment.DependencyVersions["ChutzpahAdapterVersion"]); } return _testEnvironment.GetNugetPackage(adapterRelativePath); diff --git a/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestEnvironment.cs b/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestEnvironment.cs index 9980c90951..deaf25ecde 100644 --- a/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestEnvironment.cs +++ b/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestEnvironment.cs @@ -68,7 +68,7 @@ public static string BuildConfiguration } } - public Dictionary DependencyVersions + public static Dictionary DependencyVersions => s_dependencyVersions ??= GetDependencies(TestPlatformRootDirectory); /// diff --git a/test/Microsoft.TestPlatform.Utilities.UnitTests/XmlUtilitiesTests.cs b/test/Microsoft.TestPlatform.Utilities.UnitTests/XmlUtilitiesTests.cs index 905b9137c3..41c4f3c481 100644 --- a/test/Microsoft.TestPlatform.Utilities.UnitTests/XmlUtilitiesTests.cs +++ b/test/Microsoft.TestPlatform.Utilities.UnitTests/XmlUtilitiesTests.cs @@ -202,7 +202,7 @@ public void RemoveChildNodeShouldRemoveXmlIfExist() #region Private Methods - private XmlDocument GetXmlDocument(string settingsXml) + private static XmlDocument GetXmlDocument(string settingsXml) { var doc = new XmlDocument(); doc.LoadXml(settingsXml); diff --git a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs index 1757bb95a0..de45b60581 100644 --- a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs +++ b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs @@ -1232,12 +1232,12 @@ public void ResultsInHeirarchichalOrderShouldReportCorrectCount() _mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.TestRunSummaryTotalTests, 2), OutputLevel.Information), Times.Once()); } - private TestCase CreateTestCase(string testCaseName) + private static TestCase CreateTestCase(string testCaseName) { return new TestCase(testCaseName, new Uri("some://uri"), "DummySourceFileName"); } - private List GetTestResultsObject() + private static List GetTestResultsObject() { var testcase = new TestCase("DymmyNamespace.DummyClass.TestName", new Uri("some://uri"), "TestSource") { @@ -1282,7 +1282,7 @@ private TestCase CreateTestCase(string testCaseName) return testresultList; } - private List GetPassedTestResultsObject() + private static List GetPassedTestResultsObject() { var testcase = new TestCase("DymmyNamespace.DummyClass.TestName", new Uri("some://uri"), "TestSourcePassed") { @@ -1309,7 +1309,7 @@ private TestCase CreateTestCase(string testCaseName) } - private List GetTestResultObject(TestOutcome outcome) + private static List GetTestResultObject(TestOutcome outcome) { var testcase = new TestCase("TestName", new Uri("some://uri"), "TestSource"); var testresult = new ObjectModel.TestResult(testcase) diff --git a/test/vstest.console.UnitTests/Internal/FilePatternParserTests.cs b/test/vstest.console.UnitTests/Internal/FilePatternParserTests.cs index 55527158aa..571936d859 100644 --- a/test/vstest.console.UnitTests/Internal/FilePatternParserTests.cs +++ b/test/vstest.console.UnitTests/Internal/FilePatternParserTests.cs @@ -36,11 +36,11 @@ public void FilePatternParserShouldCorrectlySplitPatternAndDirectory() { var patternMatchingResult = new PatternMatchingResult(new List()); _mockMatcherHelper.Setup(x => x.Execute(It.IsAny())).Returns(patternMatchingResult); - _filePatternParser.GetMatchingFiles(FilePatternParserTests.TranslatePath(@"C:\Users\vanidhi\Desktop\a\c\*bc.dll")); + _filePatternParser.GetMatchingFiles(TranslatePath(@"C:\Users\vanidhi\Desktop\a\c\*bc.dll")); // Assert - _mockMatcherHelper.Verify(x => x.AddInclude(FilePatternParserTests.TranslatePath(@"*bc.dll"))); - _mockMatcherHelper.Verify(x => x.Execute(It.Is(y => y.FullName.Equals(FilePatternParserTests.TranslatePath(@"C:\Users\vanidhi\Desktop\a\c"))))); + _mockMatcherHelper.Verify(x => x.AddInclude(TranslatePath(@"*bc.dll"))); + _mockMatcherHelper.Verify(x => x.Execute(It.Is(y => y.FullName.Equals(TranslatePath(@"C:\Users\vanidhi\Desktop\a\c"))))); } [TestMethod] @@ -48,11 +48,11 @@ public void FilePatternParserShouldCorrectlySplitWithArbitraryDirectoryDepth() { var patternMatchingResult = new PatternMatchingResult(new List()); _mockMatcherHelper.Setup(x => x.Execute(It.IsAny())).Returns(patternMatchingResult); - _filePatternParser.GetMatchingFiles(FilePatternParserTests.TranslatePath(@"C:\Users\vanidhi\**\c\*bc.txt")); + _filePatternParser.GetMatchingFiles(TranslatePath(@"C:\Users\vanidhi\**\c\*bc.txt")); // Assert - _mockMatcherHelper.Verify(x => x.AddInclude(FilePatternParserTests.TranslatePath(@"**\c\*bc.txt"))); - _mockMatcherHelper.Verify(x => x.Execute(It.Is(y => y.FullName.Equals(FilePatternParserTests.TranslatePath(@"C:\Users\vanidhi"))))); + _mockMatcherHelper.Verify(x => x.AddInclude(TranslatePath(@"**\c\*bc.txt"))); + _mockMatcherHelper.Verify(x => x.Execute(It.Is(y => y.FullName.Equals(TranslatePath(@"C:\Users\vanidhi"))))); } [TestMethod] @@ -60,11 +60,11 @@ public void FilePatternParserShouldCorrectlySplitWithWildCardInMultipleDirectory { var patternMatchingResult = new PatternMatchingResult(new List()); _mockMatcherHelper.Setup(x => x.Execute(It.IsAny())).Returns(patternMatchingResult); - _filePatternParser.GetMatchingFiles(FilePatternParserTests.TranslatePath(@"E:\path\to\project\tests\**.Tests\**\*.Tests.dll")); + _filePatternParser.GetMatchingFiles(TranslatePath(@"E:\path\to\project\tests\**.Tests\**\*.Tests.dll")); // Assert - _mockMatcherHelper.Verify(x => x.AddInclude(FilePatternParserTests.TranslatePath(@"**.Tests\**\*.Tests.dll"))); - _mockMatcherHelper.Verify(x => x.Execute(It.Is(y => y.FullName.Equals(FilePatternParserTests.TranslatePath(@"E:\path\to\project\tests"))))); + _mockMatcherHelper.Verify(x => x.AddInclude(TranslatePath(@"**.Tests\**\*.Tests.dll"))); + _mockMatcherHelper.Verify(x => x.Execute(It.Is(y => y.FullName.Equals(TranslatePath(@"E:\path\to\project\tests"))))); } [TestMethod] @@ -72,11 +72,11 @@ public void FilePatternParserShouldCorrectlySplitWithMultipleWildCardInPattern() { var patternMatchingResult = new PatternMatchingResult(new List()); _mockMatcherHelper.Setup(x => x.Execute(It.IsAny())).Returns(patternMatchingResult); - _filePatternParser.GetMatchingFiles(FilePatternParserTests.TranslatePath(@"E:\path\to\project\tests\Tests*.Blame*.dll")); + _filePatternParser.GetMatchingFiles(TranslatePath(@"E:\path\to\project\tests\Tests*.Blame*.dll")); // Assert - _mockMatcherHelper.Verify(x => x.AddInclude(FilePatternParserTests.TranslatePath(@"Tests*.Blame*.dll"))); - _mockMatcherHelper.Verify(x => x.Execute(It.Is(y => y.FullName.Equals(FilePatternParserTests.TranslatePath(@"E:\path\to\project\tests"))))); + _mockMatcherHelper.Verify(x => x.AddInclude(TranslatePath(@"Tests*.Blame*.dll"))); + _mockMatcherHelper.Verify(x => x.Execute(It.Is(y => y.FullName.Equals(TranslatePath(@"E:\path\to\project\tests"))))); } [TestMethod] @@ -84,34 +84,34 @@ public void FilePatternParserShouldCorrectlySplitWithMultipleWildCardInMultipleD { var patternMatchingResult = new PatternMatchingResult(new List()); _mockMatcherHelper.Setup(x => x.Execute(It.IsAny())).Returns(patternMatchingResult); - _filePatternParser.GetMatchingFiles(FilePatternParserTests.TranslatePath(@"E:\path\to\project\*tests\Tests*.Blame*.dll")); + _filePatternParser.GetMatchingFiles(TranslatePath(@"E:\path\to\project\*tests\Tests*.Blame*.dll")); // Assert - _mockMatcherHelper.Verify(x => x.AddInclude(FilePatternParserTests.TranslatePath(@"*tests\Tests*.Blame*.dll"))); - _mockMatcherHelper.Verify(x => x.Execute(It.Is(y => y.FullName.Equals(FilePatternParserTests.TranslatePath(@"E:\path\to\project"))))); + _mockMatcherHelper.Verify(x => x.AddInclude(TranslatePath(@"*tests\Tests*.Blame*.dll"))); + _mockMatcherHelper.Verify(x => x.Execute(It.Is(y => y.FullName.Equals(TranslatePath(@"E:\path\to\project"))))); } [TestMethod] public void FilePatternParserShouldCheckIfFileExistsIfFullPathGiven() { var patternMatchingResult = new PatternMatchingResult(new List()); - _mockFileHelper.Setup(x => x.Exists(FilePatternParserTests.TranslatePath(@"E:\path\to\project\tests\Blame.Tests\\abc.Tests.dll"))).Returns(true); + _mockFileHelper.Setup(x => x.Exists(TranslatePath(@"E:\path\to\project\tests\Blame.Tests\\abc.Tests.dll"))).Returns(true); _mockMatcherHelper.Setup(x => x.Execute(It.IsAny())).Returns(patternMatchingResult); - var matchingFiles = _filePatternParser.GetMatchingFiles(FilePatternParserTests.TranslatePath(@"E:\path\to\project\tests\Blame.Tests\\abc.Tests.dll")); + var matchingFiles = _filePatternParser.GetMatchingFiles(TranslatePath(@"E:\path\to\project\tests\Blame.Tests\\abc.Tests.dll")); // Assert - _mockFileHelper.Verify(x => x.Exists(FilePatternParserTests.TranslatePath(@"E:\path\to\project\tests\Blame.Tests\\abc.Tests.dll"))); - Assert.IsTrue(matchingFiles.Contains(FilePatternParserTests.TranslatePath(@"E:\path\to\project\tests\Blame.Tests\\abc.Tests.dll"))); + _mockFileHelper.Verify(x => x.Exists(TranslatePath(@"E:\path\to\project\tests\Blame.Tests\\abc.Tests.dll"))); + Assert.IsTrue(matchingFiles.Contains(TranslatePath(@"E:\path\to\project\tests\Blame.Tests\\abc.Tests.dll"))); } [TestMethod] public void FilePatternParserShouldThrowCommandLineExceptionIfFileDoesNotExist() { var patternMatchingResult = new PatternMatchingResult(new List()); - _mockFileHelper.Setup(x => x.Exists(FilePatternParserTests.TranslatePath(@"E:\path\to\project\tests\Blame.Tests\\abc.Tests.dll"))).Returns(false); + _mockFileHelper.Setup(x => x.Exists(TranslatePath(@"E:\path\to\project\tests\Blame.Tests\\abc.Tests.dll"))).Returns(false); _mockMatcherHelper.Setup(x => x.Execute(It.IsAny())).Returns(patternMatchingResult); - Assert.ThrowsException(() => _filePatternParser.GetMatchingFiles(FilePatternParserTests.TranslatePath(@"E:\path\to\project\tests\Blame.Tests\\abc.Tests.dll"))); + Assert.ThrowsException(() => _filePatternParser.GetMatchingFiles(TranslatePath(@"E:\path\to\project\tests\Blame.Tests\\abc.Tests.dll"))); } private static string TranslatePath(string path) diff --git a/test/vstest.console.UnitTests/Processors/EnvironmentArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/EnvironmentArgumentProcessorTests.cs index bad4d57a37..97afb9b54f 100644 --- a/test/vstest.console.UnitTests/Processors/EnvironmentArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/EnvironmentArgumentProcessorTests.cs @@ -169,7 +169,7 @@ public void ShoudWarnWhenAValueIsOverriden() _mockOutput.VerifyAll(); } - private XmlParseResult ParseSettingsXml(IRunSettingsProvider provider) + private static XmlParseResult ParseSettingsXml(IRunSettingsProvider provider) { var document = XDocument.Parse(provider.ActiveRunSettings!.SettingsXml!); diff --git a/test/vstest.console.UnitTests/Processors/ResultsDirectoryArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/ResultsDirectoryArgumentProcessorTests.cs index bf82e579b8..77318f0e33 100644 --- a/test/vstest.console.UnitTests/Processors/ResultsDirectoryArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/ResultsDirectoryArgumentProcessorTests.cs @@ -155,7 +155,7 @@ public void ExecuteShouldReturnSuccess() #endregion - private string TranslatePath(string path) + private static string TranslatePath(string path) { // RuntimeInformation has conflict when used if (Environment.OSVersion.Platform.ToString().StartsWith("Win"))