From 5992474275ec8424d1095da3b268dac7c9c192ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Tue, 26 Apr 2022 13:48:04 +0200 Subject: [PATCH 1/2] Run dotnet format whitespace --- .../Data/CsvDataConnection.cs | 2 +- .../Services/DesktopTestSourceHost.cs | 96 +++++++++---------- .../Data/CsvDataConnection.cs | 2 +- .../Services/DesktopTestSourceHost.cs | 96 +++++++++---------- .../NetCoreTestContextImplementation.cs | 2 +- .../Services/ns10FileOperations.cs | 8 +- .../netstandard1.0/Utilities/ns10Validate.cs | 2 +- .../Services/ns13ThreadSafeStringWriter.cs | 2 +- .../DataSourceElementCollection.cs | 2 +- .../UnitTest1.cs | 2 +- .../DiscoveryAndExecutionTests/OutputTests.cs | 4 +- .../DiscoverInternalsProject/UnitTest1.cs | 2 +- .../TestAssets/OutputTestProject/Assembly.cs | 2 +- .../TestAssets/ParallelTestClass/UnitTest1.cs | 2 +- .../TestAssets/ParallelTestClass/UnitTest3.cs | 2 +- .../ParallelTestMethods/UnitTest1.cs | 2 +- .../Execution/TestExecutionManagerTests.cs | 2 +- .../Execution/ThreadSafeStringWriterTests.cs | 6 +- .../Execution/UnitTestResultTest.cs | 8 +- .../Helpers/UnitTestOutcomeHelperTests.cs | 2 +- .../ObjectModel/UnitTestResultTests.cs | 8 +- .../ns10MSTestAdapterSettingsTests.cs | 20 ++-- .../Utilities/ns10DeploymentUtilityTests.cs | 4 +- .../Utilities/ns10FileUtilityTests.cs | 4 +- .../Services/ns13TestDeploymentTests.cs | 30 +++--- .../ns13DeploymentItemUtilityTests.cs | 20 ++-- 26 files changed, 166 insertions(+), 166 deletions(-) diff --git a/src/Adapter/PlatformServices.Desktop.Legacy/Data/CsvDataConnection.cs b/src/Adapter/PlatformServices.Desktop.Legacy/Data/CsvDataConnection.cs index 9972c24dbe..94dea21f57 100644 --- a/src/Adapter/PlatformServices.Desktop.Legacy/Data/CsvDataConnection.cs +++ b/src/Adapter/PlatformServices.Desktop.Legacy/Data/CsvDataConnection.cs @@ -70,7 +70,7 @@ public override List GetColumns(string tableName) } catch (Exception exception) { - EqtTrace.ErrorIf(EqtTrace.IsErrorEnabled, exception.Message + " for CSV data source " + this.fileName); + EqtTrace.ErrorIf(EqtTrace.IsErrorEnabled, exception.Message + " for CSV data source " + this.fileName); } return null; diff --git a/src/Adapter/PlatformServices.Desktop.Legacy/Services/DesktopTestSourceHost.cs b/src/Adapter/PlatformServices.Desktop.Legacy/Services/DesktopTestSourceHost.cs index 227d338194..c6c6ef0dcb 100644 --- a/src/Adapter/PlatformServices.Desktop.Legacy/Services/DesktopTestSourceHost.cs +++ b/src/Adapter/PlatformServices.Desktop.Legacy/Services/DesktopTestSourceHost.cs @@ -283,65 +283,65 @@ internal virtual List GetResolutionPaths(string sourceFileName, bool isP return resolutionPaths; } - internal virtual string GetTargetFrameworkVersionString(string sourceFileName) - { - return AppDomainUtilities.GetTargetFrameworkVersionString(sourceFileName); - } - - private string GetConfigFileForTestSource(string sourceFileName) - { - return new DeploymentUtility().GetConfigFile(sourceFileName); - } - - /// - /// Sets context required for running tests. - /// - /// - /// source parameter used for setting context - /// - private void SetContext(string source) - { - if (string.IsNullOrEmpty(source)) + internal virtual string GetTargetFrameworkVersionString(string sourceFileName) { - return; + return AppDomainUtilities.GetTargetFrameworkVersionString(sourceFileName); } - Exception setWorkingDirectoryException = null; - this.currentDirectory = Environment.CurrentDirectory; - - try - { - Environment.CurrentDirectory = Path.GetDirectoryName(source); - EqtTrace.Info("MSTestExecutor: Changed the working directory to {0}", Environment.CurrentDirectory); - } - catch (IOException ex) - { - setWorkingDirectoryException = ex; - } - catch (System.Security.SecurityException ex) + private string GetConfigFileForTestSource(string sourceFileName) { - setWorkingDirectoryException = ex; + return new DeploymentUtility().GetConfigFile(sourceFileName); } - if (setWorkingDirectoryException != null) + /// + /// Sets context required for running tests. + /// + /// + /// source parameter used for setting context + /// + private void SetContext(string source) { - EqtTrace.Error("MSTestExecutor.SetWorkingDirectory: Failed to set the working directory to '{0}'. {1}", Path.GetDirectoryName(source), setWorkingDirectoryException); + if (string.IsNullOrEmpty(source)) + { + return; + } + + Exception setWorkingDirectoryException = null; + this.currentDirectory = Environment.CurrentDirectory; + + try + { + Environment.CurrentDirectory = Path.GetDirectoryName(source); + EqtTrace.Info("MSTestExecutor: Changed the working directory to {0}", Environment.CurrentDirectory); + } + catch (IOException ex) + { + setWorkingDirectoryException = ex; + } + catch (System.Security.SecurityException ex) + { + setWorkingDirectoryException = ex; + } + + if (setWorkingDirectoryException != null) + { + EqtTrace.Error("MSTestExecutor.SetWorkingDirectory: Failed to set the working directory to '{0}'. {1}", Path.GetDirectoryName(source), setWorkingDirectoryException); + } } - } - /// - /// Resets the context as it was before calling SetContext() - /// - private void ResetContext() - { - if (!string.IsNullOrEmpty(this.currentDirectory)) + /// + /// Resets the context as it was before calling SetContext() + /// + private void ResetContext() { - Environment.CurrentDirectory = this.currentDirectory; + if (!string.IsNullOrEmpty(this.currentDirectory)) + { + Environment.CurrentDirectory = this.currentDirectory; + } } - } - private void AddSearchDirectoriesSpecifiedInRunSettingsToAssemblyResolver(AssemblyResolver assemblyResolver, string baseDirectory) - { + private void AddSearchDirectoriesSpecifiedInRunSettingsToAssemblyResolver(AssemblyResolver assemblyResolver, string baseDirectory) + { // Check if user specified any adapter settings MSTestAdapterSettings adapterSettings = MSTestSettingsProvider.Settings; @@ -364,7 +364,7 @@ private void AddSearchDirectoriesSpecifiedInRunSettingsToAssemblyResolver(Assemb } } } -} + } #pragma warning restore SA1649 // SA1649FileNameMustMatchTypeName } diff --git a/src/Adapter/PlatformServices.Desktop/Data/CsvDataConnection.cs b/src/Adapter/PlatformServices.Desktop/Data/CsvDataConnection.cs index 9972c24dbe..94dea21f57 100644 --- a/src/Adapter/PlatformServices.Desktop/Data/CsvDataConnection.cs +++ b/src/Adapter/PlatformServices.Desktop/Data/CsvDataConnection.cs @@ -70,7 +70,7 @@ public override List GetColumns(string tableName) } catch (Exception exception) { - EqtTrace.ErrorIf(EqtTrace.IsErrorEnabled, exception.Message + " for CSV data source " + this.fileName); + EqtTrace.ErrorIf(EqtTrace.IsErrorEnabled, exception.Message + " for CSV data source " + this.fileName); } return null; diff --git a/src/Adapter/PlatformServices.Desktop/Services/DesktopTestSourceHost.cs b/src/Adapter/PlatformServices.Desktop/Services/DesktopTestSourceHost.cs index 227d338194..c6c6ef0dcb 100644 --- a/src/Adapter/PlatformServices.Desktop/Services/DesktopTestSourceHost.cs +++ b/src/Adapter/PlatformServices.Desktop/Services/DesktopTestSourceHost.cs @@ -283,65 +283,65 @@ internal virtual List GetResolutionPaths(string sourceFileName, bool isP return resolutionPaths; } - internal virtual string GetTargetFrameworkVersionString(string sourceFileName) - { - return AppDomainUtilities.GetTargetFrameworkVersionString(sourceFileName); - } - - private string GetConfigFileForTestSource(string sourceFileName) - { - return new DeploymentUtility().GetConfigFile(sourceFileName); - } - - /// - /// Sets context required for running tests. - /// - /// - /// source parameter used for setting context - /// - private void SetContext(string source) - { - if (string.IsNullOrEmpty(source)) + internal virtual string GetTargetFrameworkVersionString(string sourceFileName) { - return; + return AppDomainUtilities.GetTargetFrameworkVersionString(sourceFileName); } - Exception setWorkingDirectoryException = null; - this.currentDirectory = Environment.CurrentDirectory; - - try - { - Environment.CurrentDirectory = Path.GetDirectoryName(source); - EqtTrace.Info("MSTestExecutor: Changed the working directory to {0}", Environment.CurrentDirectory); - } - catch (IOException ex) - { - setWorkingDirectoryException = ex; - } - catch (System.Security.SecurityException ex) + private string GetConfigFileForTestSource(string sourceFileName) { - setWorkingDirectoryException = ex; + return new DeploymentUtility().GetConfigFile(sourceFileName); } - if (setWorkingDirectoryException != null) + /// + /// Sets context required for running tests. + /// + /// + /// source parameter used for setting context + /// + private void SetContext(string source) { - EqtTrace.Error("MSTestExecutor.SetWorkingDirectory: Failed to set the working directory to '{0}'. {1}", Path.GetDirectoryName(source), setWorkingDirectoryException); + if (string.IsNullOrEmpty(source)) + { + return; + } + + Exception setWorkingDirectoryException = null; + this.currentDirectory = Environment.CurrentDirectory; + + try + { + Environment.CurrentDirectory = Path.GetDirectoryName(source); + EqtTrace.Info("MSTestExecutor: Changed the working directory to {0}", Environment.CurrentDirectory); + } + catch (IOException ex) + { + setWorkingDirectoryException = ex; + } + catch (System.Security.SecurityException ex) + { + setWorkingDirectoryException = ex; + } + + if (setWorkingDirectoryException != null) + { + EqtTrace.Error("MSTestExecutor.SetWorkingDirectory: Failed to set the working directory to '{0}'. {1}", Path.GetDirectoryName(source), setWorkingDirectoryException); + } } - } - /// - /// Resets the context as it was before calling SetContext() - /// - private void ResetContext() - { - if (!string.IsNullOrEmpty(this.currentDirectory)) + /// + /// Resets the context as it was before calling SetContext() + /// + private void ResetContext() { - Environment.CurrentDirectory = this.currentDirectory; + if (!string.IsNullOrEmpty(this.currentDirectory)) + { + Environment.CurrentDirectory = this.currentDirectory; + } } - } - private void AddSearchDirectoriesSpecifiedInRunSettingsToAssemblyResolver(AssemblyResolver assemblyResolver, string baseDirectory) - { + private void AddSearchDirectoriesSpecifiedInRunSettingsToAssemblyResolver(AssemblyResolver assemblyResolver, string baseDirectory) + { // Check if user specified any adapter settings MSTestAdapterSettings adapterSettings = MSTestSettingsProvider.Settings; @@ -364,7 +364,7 @@ private void AddSearchDirectoriesSpecifiedInRunSettingsToAssemblyResolver(Assemb } } } -} + } #pragma warning restore SA1649 // SA1649FileNameMustMatchTypeName } diff --git a/src/Adapter/PlatformServices.NetCore/Services/NetCoreTestContextImplementation.cs b/src/Adapter/PlatformServices.NetCore/Services/NetCoreTestContextImplementation.cs index f5ff4eced0..f9d6f62cdb 100644 --- a/src/Adapter/PlatformServices.NetCore/Services/NetCoreTestContextImplementation.cs +++ b/src/Adapter/PlatformServices.NetCore/Services/NetCoreTestContextImplementation.cs @@ -402,7 +402,7 @@ public string GetDiagnosticMessages() /// public void ClearDiagnosticMessages() { - this.threadSafeStringWriter.ToStringAndClear(); + this.threadSafeStringWriter.ToStringAndClear(); } public void SetDataRow(object dataRow) diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10FileOperations.cs b/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10FileOperations.cs index d561e0b84a..4d94e6b872 100644 --- a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10FileOperations.cs +++ b/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10FileOperations.cs @@ -36,11 +36,11 @@ public Assembly LoadAssembly(string assemblyName, bool isReflectionOnly) /// Path to the .DLL of the assembly. public string GetAssemblyPath(Assembly assembly) { - #if NETSTANDARD1_5 - return assembly.Location; - #else +#if NETSTANDARD1_5 + return assembly.Location; +#else return null; - #endif +#endif } /// diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.0/Utilities/ns10Validate.cs b/src/Adapter/PlatformServices.Shared/netstandard1.0/Utilities/ns10Validate.cs index b6d29d2749..cc5f5a8ec7 100644 --- a/src/Adapter/PlatformServices.Shared/netstandard1.0/Utilities/ns10Validate.cs +++ b/src/Adapter/PlatformServices.Shared/netstandard1.0/Utilities/ns10Validate.cs @@ -5,7 +5,7 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Uti { using System; - #pragma warning disable SA1649 // File name must match first type name +#pragma warning disable SA1649 // File name must match first type name internal class Validate { diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.3/Services/ns13ThreadSafeStringWriter.cs b/src/Adapter/PlatformServices.Shared/netstandard1.3/Services/ns13ThreadSafeStringWriter.cs index b53b56f96e..d08868a9b4 100644 --- a/src/Adapter/PlatformServices.Shared/netstandard1.3/Services/ns13ThreadSafeStringWriter.cs +++ b/src/Adapter/PlatformServices.Shared/netstandard1.3/Services/ns13ThreadSafeStringWriter.cs @@ -120,7 +120,7 @@ protected override void Dispose(bool disposing) ThreadSafeStringWriter.State?.Value?.Remove(this.outputType); try { - base.Dispose(disposing); + base.Dispose(disposing); } catch (ObjectDisposedException) { diff --git a/src/TestFramework/Extension.Desktop/ConfigurationSettings/DataSourceElementCollection.cs b/src/TestFramework/Extension.Desktop/ConfigurationSettings/DataSourceElementCollection.cs index b0f074c993..295c9435fa 100644 --- a/src/TestFramework/Extension.Desktop/ConfigurationSettings/DataSourceElementCollection.cs +++ b/src/TestFramework/Extension.Desktop/ConfigurationSettings/DataSourceElementCollection.cs @@ -10,7 +10,7 @@ namespace Microsoft.VisualStudio.TestTools.UnitTesting /// /// The Data source element collection. /// - [SuppressMessage("Microsoft.Design", "CA1010:CollectionsShouldImplementGenericInterface", Justification ="Compat")] + [SuppressMessage("Microsoft.Design", "CA1010:CollectionsShouldImplementGenericInterface", Justification = "Compat")] public sealed class DataSourceElementCollection : ConfigurationElementCollection { /// diff --git a/test/ComponentTests/TestAssets/TestProjectForAssemblyResolution/UnitTest1.cs b/test/ComponentTests/TestAssets/TestProjectForAssemblyResolution/UnitTest1.cs index 6741422a2a..05482640b4 100644 --- a/test/ComponentTests/TestAssets/TestProjectForAssemblyResolution/UnitTest1.cs +++ b/test/ComponentTests/TestAssets/TestProjectForAssemblyResolution/UnitTest1.cs @@ -6,7 +6,7 @@ namespace PlatformServices.Desktop.ComponentTests [TestClass] [Serializable] public class TestProjectForAssemblyResolution : MarshalByRefObject - { + { [TestMethod] public void TestMethod1() { diff --git a/test/E2ETests/DiscoveryAndExecutionTests/OutputTests.cs b/test/E2ETests/DiscoveryAndExecutionTests/OutputTests.cs index f811300b24..47b77b8e9b 100644 --- a/test/E2ETests/DiscoveryAndExecutionTests/OutputTests.cs +++ b/test/E2ETests/DiscoveryAndExecutionTests/OutputTests.cs @@ -83,7 +83,7 @@ private static void ValidateOutputIsNotMixed(ReadOnlyCollection t var testMethod = testResults.Single(t => t.DisplayName == methodName); Assert.IsNotNull(testMethod, $"Test method {methodName} was not found."); var message = testMethod.Messages.SingleOrDefault(messageFilter); - Assert.IsNotNull(message, $"Message for {testMethod.DisplayName} was not found. All messages: { string.Join(Environment.NewLine, testMethod.Messages.Select(m=> $"{m.Category} - {m.Text}")) }"); + Assert.IsNotNull(message, $"Message for {testMethod.DisplayName} was not found. All messages: { string.Join(Environment.NewLine, testMethod.Messages.Select(m => $"{m.Category} - {m.Text}")) }"); StringAssert.Matches(message.Text, new Regex(methodName), testMethod.DisplayName); StringAssert.Matches(message.Text, new Regex("TestInitialize"), testMethod.DisplayName); StringAssert.Matches(message.Text, new Regex("TestCleanup"), testMethod.DisplayName); @@ -93,7 +93,7 @@ private static void ValidateOutputIsNotMixed(ReadOnlyCollection t private static void ValidateInitializeAndCleanup(ReadOnlyCollection testResults, Func messageFilter) { // It is not deterministic where the class initialize and class cleanup will run, so we look at all tests, to make sure it is includes somewhere. - var output = string.Join(Environment.NewLine, testResults.SelectMany(r=>r.Messages).Where(messageFilter).Select(m=>m.Text)); + var output = string.Join(Environment.NewLine, testResults.SelectMany(r => r.Messages).Where(messageFilter).Select(m => m.Text)); Assert.IsNotNull(output); StringAssert.Matches(output, new Regex("ClassInitialize")); StringAssert.Matches(output, new Regex("ClassCleanup")); diff --git a/test/E2ETests/TestAssets/DiscoverInternalsProject/UnitTest1.cs b/test/E2ETests/TestAssets/DiscoverInternalsProject/UnitTest1.cs index db5866f5b5..ca1b3e5263 100644 --- a/test/E2ETests/TestAssets/DiscoverInternalsProject/UnitTest1.cs +++ b/test/E2ETests/TestAssets/DiscoverInternalsProject/UnitTest1.cs @@ -68,7 +68,7 @@ internal void DynamicDataTestMethod(SerializableInternalType serializableInterna } - public static IEnumerable DynamicData => new [] + public static IEnumerable DynamicData => new[] { new object[] { new SerializableInternalType() } }; diff --git a/test/E2ETests/TestAssets/OutputTestProject/Assembly.cs b/test/E2ETests/TestAssets/OutputTestProject/Assembly.cs index 8578dee8d4..627b4f3b46 100644 --- a/test/E2ETests/TestAssets/OutputTestProject/Assembly.cs +++ b/test/E2ETests/TestAssets/OutputTestProject/Assembly.cs @@ -1,4 +1,4 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; [assembly: Parallelize(Scope = ExecutionScope.MethodLevel, Workers = 0)] -[assembly: ClassCleanupExecution(ClassCleanupBehavior.EndOfClass)] \ No newline at end of file +[assembly: ClassCleanupExecution(ClassCleanupBehavior.EndOfClass)] \ No newline at end of file diff --git a/test/E2ETests/TestAssets/ParallelTestClass/UnitTest1.cs b/test/E2ETests/TestAssets/ParallelTestClass/UnitTest1.cs index 72ec6e8cfc..faccd83f37 100644 --- a/test/E2ETests/TestAssets/ParallelTestClass/UnitTest1.cs +++ b/test/E2ETests/TestAssets/ParallelTestClass/UnitTest1.cs @@ -5,7 +5,7 @@ namespace ParallelClassesTestProject { using System.Threading; using Microsoft.VisualStudio.TestTools.UnitTesting; - + [TestClass] public class UnitTest1 { diff --git a/test/E2ETests/TestAssets/ParallelTestClass/UnitTest3.cs b/test/E2ETests/TestAssets/ParallelTestClass/UnitTest3.cs index a095fbfcd9..293426e819 100644 --- a/test/E2ETests/TestAssets/ParallelTestClass/UnitTest3.cs +++ b/test/E2ETests/TestAssets/ParallelTestClass/UnitTest3.cs @@ -5,7 +5,7 @@ namespace ParallelClassesTestProject { using System.Threading; using Microsoft.VisualStudio.TestTools.UnitTesting; - + [TestClass] public class UnitTest3 { diff --git a/test/E2ETests/TestAssets/ParallelTestMethods/UnitTest1.cs b/test/E2ETests/TestAssets/ParallelTestMethods/UnitTest1.cs index 190c817a41..cb93477f8c 100644 --- a/test/E2ETests/TestAssets/ParallelTestMethods/UnitTest1.cs +++ b/test/E2ETests/TestAssets/ParallelTestMethods/UnitTest1.cs @@ -5,7 +5,7 @@ namespace ParallelMethodsTestProject { using System.Threading; using Microsoft.VisualStudio.TestTools.UnitTesting; - + [TestClass] public class UnitTest1 { diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/Execution/TestExecutionManagerTests.cs b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/Execution/TestExecutionManagerTests.cs index a459654573..f074c81eae 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/Execution/TestExecutionManagerTests.cs +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/Execution/TestExecutionManagerTests.cs @@ -607,7 +607,7 @@ public void RunTestsForTestShouldNotRunTestsInParallelWhenDisabledFromRunsetting return new object[] { new UTF.ParallelizeAttribute { Workers = 10, Scope = UTF.ExecutionScope.MethodLevel } }; } - return originalReflectionOperation.GetCustomAttributes(asm, type); + return originalReflectionOperation.GetCustomAttributes(asm, type); }); testablePlatformService.MockReflectionOperations.Setup( diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/Execution/ThreadSafeStringWriterTests.cs b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/Execution/ThreadSafeStringWriterTests.cs index 07dda8a4b5..8edbee03c0 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/Execution/ThreadSafeStringWriterTests.cs +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/Execution/ThreadSafeStringWriterTests.cs @@ -33,9 +33,9 @@ public void ThreadSafeStringWriterWriteLineHasContentFromMultipleThreads() var count = 10; for (var i = 0; i < count; i++) { - // Choose WriteLine since it calls the entire sequence: - // Write(string) -> Write(char[]) -> Write(char) - stringWriter.WriteLine(x); + // Choose WriteLine since it calls the entire sequence: + // Write(string) -> Write(char[]) -> Write(char) + stringWriter.WriteLine(x); } }; diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/Execution/UnitTestResultTest.cs b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/Execution/UnitTestResultTest.cs index a2453eb42a..d04da0effd 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/Execution/UnitTestResultTest.cs +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/Execution/UnitTestResultTest.cs @@ -55,10 +55,10 @@ public void ToTestResultShouldReturnConvertedTestResultWithFieldsSet() TestFailedException ex = new TestFailedException(UnitTestOutcome.Error, "DummyMessage", stackTrace); var dummyTimeSpan = new TimeSpan(20); UnitTestResult result = new UnitTestResult(ex) - { - DisplayName = "DummyDisplayName", - Duration = dummyTimeSpan - }; + { + DisplayName = "DummyDisplayName", + Duration = dummyTimeSpan + }; TestCase testCase = new TestCase("Foo", new Uri("Uri", UriKind.Relative), Assembly.GetExecutingAssembly().FullName); var startTime = DateTimeOffset.Now; diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/Helpers/UnitTestOutcomeHelperTests.cs b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/Helpers/UnitTestOutcomeHelperTests.cs index fa67711828..4627ce33cb 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/Helpers/UnitTestOutcomeHelperTests.cs +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/Helpers/UnitTestOutcomeHelperTests.cs @@ -29,7 +29,7 @@ public void TestInit() "; - this.adapterSettings = MSTestSettings.GetSettings(runSettingxml, MSTestSettings.SettingsNameAlias); + this.adapterSettings = MSTestSettings.GetSettings(runSettingxml, MSTestSettings.SettingsNameAlias); } [TestMethod] diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/ObjectModel/UnitTestResultTests.cs b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/ObjectModel/UnitTestResultTests.cs index 2704f2155d..d1a1424879 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/ObjectModel/UnitTestResultTests.cs +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/ObjectModel/UnitTestResultTests.cs @@ -55,10 +55,10 @@ public void ToTestResultShouldReturnConvertedTestResultWithFieldsSet() TestFailedException ex = new TestFailedException(UnitTestOutcome.Error, "DummyMessage", stackTrace); var dummyTimeSpan = new TimeSpan(20); UnitTestResult result = new UnitTestResult(ex) - { - DisplayName = "DummyDisplayName", - Duration = dummyTimeSpan - }; + { + DisplayName = "DummyDisplayName", + Duration = dummyTimeSpan + }; TestCase testCase = new TestCase("Foo", new Uri("Uri", UriKind.Relative), Assembly.GetExecutingAssembly().FullName); var startTime = DateTimeOffset.Now; diff --git a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Services/ns10MSTestAdapterSettingsTests.cs b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Services/ns10MSTestAdapterSettingsTests.cs index f897f83f98..92802b52ab 100644 --- a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Services/ns10MSTestAdapterSettingsTests.cs +++ b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Services/ns10MSTestAdapterSettingsTests.cs @@ -38,7 +38,7 @@ public void Cleanup() MSTestSettingsProvider.Reset(); } -#region ResolveEnvironmentVariableAndReturnFullPathIfExist tests. + #region ResolveEnvironmentVariableAndReturnFullPathIfExist tests. [TestMethod] public void ResolveEnvironmentVariableShouldResolvePathWhenPassedAbsolutePath() @@ -155,9 +155,9 @@ public void ResolveEnvironmentVariableShouldReturnFalseForInvalidPath() Assert.IsNull(result); } -#endregion + #endregion -#region GetDirectoryListWithRecursiveProperty tests. + #region GetDirectoryListWithRecursiveProperty tests. [TestMethod] public void GetDirectoryListWithRecursivePropertyShouldReadRunSettingCorrectly() @@ -183,9 +183,9 @@ public void GetDirectoryListWithRecursivePropertyShouldReadRunSettingCorrectly() } } -#endregion + #endregion -#region ToSettings tests. + #region ToSettings tests. [TestMethod] public void ToSettingsShouldNotThrowExceptionWhenRunSettingsXmlUnderTagMSTestv2IsWrong() @@ -230,9 +230,9 @@ public void ToSettingsShouldThrowExceptionWhenRunSettingsXmlIsWrong() ActionUtility.ActionShouldThrowExceptionOfType(shouldThrowException, typeof(SettingsException)); } -#endregion + #endregion -#region DeploymentEnabled tests. + #region DeploymentEnabled tests. [TestMethod] public void DeploymentEnabledIsByDefaultTrueWhenNotSpecified() @@ -261,9 +261,9 @@ public void DeploymentEnabledShouldBeConsumedFromRunSettingsWhenSpecified() Assert.IsFalse(adapterSettings.DeploymentEnabled); } -#endregion + #endregion -#region DeployTestSourceDependencies tests + #region DeployTestSourceDependencies tests [TestMethod] public void DeployTestSourceDependenciesIsEnabledByDefault() @@ -306,7 +306,7 @@ public void DeployTestSourceDependenciesWhenTrue() Assert.IsTrue(adapterSettings.DeployTestSourceDependencies); } -#endregion + #endregion } public class TestableMSTestAdapterSettings : MSTestAdapterSettings diff --git a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Utilities/ns10DeploymentUtilityTests.cs b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Utilities/ns10DeploymentUtilityTests.cs index c2250c70da..072c4bf1c1 100644 --- a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Utilities/ns10DeploymentUtilityTests.cs +++ b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Utilities/ns10DeploymentUtilityTests.cs @@ -62,7 +62,7 @@ public void TestInit() this.mocktestExecutionRecorder = new Mock(); } -#region CreateDeploymentDirectories tests + #region CreateDeploymentDirectories tests [TestMethod] public void CreateDeploymentDirectoriesShouldCreateDeploymentDirectoryFromRunContext() @@ -117,6 +117,6 @@ public void CreateDeploymentDirectoriesShouldCreateDefaultDeploymentDirectoryIfR this.mockFileUtility.Verify(fu => fu.CreateDirectoryIfNotExists(Path.Combine(Path.Combine(RootDeploymentDirectory, TestRunDirectories.DeploymentInDirectorySuffix), Environment.MachineName)), Times.Once); } -#endregion + #endregion } } diff --git a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Utilities/ns10FileUtilityTests.cs b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Utilities/ns10FileUtilityTests.cs index 8f26814d47..2ff0cb4ec1 100644 --- a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Utilities/ns10FileUtilityTests.cs +++ b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Utilities/ns10FileUtilityTests.cs @@ -47,7 +47,7 @@ public void ReplaceInvalidFileNameCharactersShouldReplaceInvalidChars() Assert.AreEqual("galaxy__far_far_away", this.fileUtility.Object.ReplaceInvalidFileNameCharacters(fileName)); } -#region AddFilesFromDirectory tests + #region AddFilesFromDirectory tests [TestMethod] public void AddFilesInADirectoryShouldReturnAllTopLevelFilesInADirectory() @@ -206,6 +206,6 @@ private void SetupMockFileAPIs(string[] files) }); } -#endregion + #endregion } } diff --git a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/Services/ns13TestDeploymentTests.cs b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/Services/ns13TestDeploymentTests.cs index 042d8b6fe4..245e3ebaa8 100644 --- a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/Services/ns13TestDeploymentTests.cs +++ b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/Services/ns13TestDeploymentTests.cs @@ -57,7 +57,7 @@ public void TestInit() MSTestSettingsProvider.Reset(); } -#region GetDeploymentItems tests. + #region GetDeploymentItems tests. [TestMethod] public void GetDeploymentItemsReturnsNullWhenNoDeploymentItems() @@ -110,9 +110,9 @@ public void GetDeploymentItemsReturnsDeploymentItems() CollectionAssert.AreEqual(expectedDeploymentItems, deploymentItems.ToArray()); } -#endregion + #endregion -#region Cleanup tests + #region Cleanup tests [TestMethod] public void CleanupShouldNotDeleteDirectoriesIfRunDirectoiresIsNull() @@ -168,9 +168,9 @@ public void CleanupShouldDeleteRootDeploymentDirectory() this.mockFileUtility.Verify(fu => fu.DeleteDirectories(testRunDirectories.RootDeploymentDirectory), Times.Once); } -#endregion + #endregion -#region GetDeploymentDirectory tests + #region GetDeploymentDirectory tests [TestMethod] public void GetDeploymentDirectoryShouldReturnNullIfDeploymentDirectoryIsNull() @@ -195,9 +195,9 @@ public void GetDeploymentDirectoryShouldReturnDeploymentOutputDirectory() Assert.AreEqual(testRunDirectories.OutDirectory, testDeployment.GetDeploymentDirectory()); } -#endregion + #endregion -#region Deploy tests + #region Deploy tests [TestMethod] public void DeployShouldReturnFalseWhenDeploymentEnabledSetToFalseButHasDeploymentItems() @@ -310,9 +310,9 @@ public void DeployShouldReturnTrueWhenDeploymentEnabledSetToTrueAndHasDeployment Assert.IsNotNull(testDeployment.GetDeploymentDirectory()); } -#endregion + #endregion -#region GetDeploymentInformation tests + #region GetDeploymentInformation tests [TestMethod] public void GetDeploymentInformationShouldReturnAppBaseDirectoryIfRunDirectoryIsNull() @@ -482,9 +482,9 @@ public void GetDeploymentInformationShouldReturnRunDirectoryInformationIfSourceI CollectionAssert.AreEqual(expectedProperties.ToList(), properties.ToList()); } -#endregion + #endregion -#region private methods + #region private methods private void SetupDeploymentItems(MemberInfo memberInfo, KeyValuePair[] deploymentItems) { @@ -526,9 +526,9 @@ private TestDeployment CreateAndSetupDeploymentRelatedUtilities(out TestRunDirec this.mockFileUtility.Setup(fu => fu.DoesFileExist(It.IsAny())).Returns(true); var mockAssemblyUtility = new Mock(); #if !NETCOREAPP - mockAssemblyUtility.Setup( - au => au.GetFullPathToDependentAssemblies(It.IsAny(), It.IsAny(), out this.warnings)) - .Returns(new string[] { }); + mockAssemblyUtility.Setup( + au => au.GetFullPathToDependentAssemblies(It.IsAny(), It.IsAny(), out this.warnings)) + .Returns(new string[] { }); mockAssemblyUtility.Setup( au => au.GetSatelliteAssemblies(It.IsAny())) .Returns(new List { }); @@ -543,6 +543,6 @@ private TestDeployment CreateAndSetupDeploymentRelatedUtilities(out TestRunDirec new DeploymentUtility(deploymentItemUtility, mockAssemblyUtility.Object, this.mockFileUtility.Object), this.mockFileUtility.Object); } -#endregion + #endregion } } diff --git a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/Utilities/ns13DeploymentItemUtilityTests.cs b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/Utilities/ns13DeploymentItemUtilityTests.cs index adfd360c85..78206f5ac2 100644 --- a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/Utilities/ns13DeploymentItemUtilityTests.cs +++ b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/Utilities/ns13DeploymentItemUtilityTests.cs @@ -60,7 +60,7 @@ public void TestInit() this.warnings = new List(); } -#region GetClassLevelDeploymentItems tests + #region GetClassLevelDeploymentItems tests [TestMethod] public void GetClassLevelDeploymentItemsShouldReturnEmptyListWhenNoDeploymentItems() @@ -181,9 +181,9 @@ public void GetClassLevelDeploymentItemsShouldReportWarningsForInvalidDeployment StringAssert.Contains(this.warnings.ToArray()[0], Resource.DeploymentItemPathCannotBeNullOrEmpty); } -#endregion + #endregion -#region GetDeploymentItems tests + #region GetDeploymentItems tests [TestMethod] public void GetDeploymentItemsShouldReturnNullOnNoDeploymentItems() @@ -347,9 +347,9 @@ public void GetDeploymentItemsShouldReturnClassAndMethodLevelDeploymentItemsWith CollectionAssert.AreEqual(expectedDeploymentItems, deploymentItems.ToArray()); } -#endregion + #endregion -#region IsValidDeploymentItem tests + #region IsValidDeploymentItem tests [TestMethod] public void IsValidDeploymentItemShouldReportWarningIfSourcePathIsNull() @@ -420,9 +420,9 @@ public void IsValidDeploymentItemShouldReturnTrueForAValidDeploymentItem() Assert.IsTrue(string.Empty.Equals(warning)); } -#endregion + #endregion -#region HasDeployItems tests + #region HasDeployItems tests [TestMethod] public void HasDeployItemsShouldReturnFalseForNoDeploymentItems() @@ -448,9 +448,9 @@ public void HasDeployItemsShouldReturnTrueWhenDeploymentItemsArePresent() Assert.IsTrue(this.deploymentItemUtility.HasDeploymentItems(testCase)); } -#endregion + #endregion -#region private methods + #region private methods private void SetupDeploymentItems(MemberInfo memberInfo, KeyValuePair[] deploymentItems) { @@ -468,6 +468,6 @@ private void SetupDeploymentItems(MemberInfo memberInfo, KeyValuePair Date: Tue, 26 Apr 2022 15:07:16 +0200 Subject: [PATCH 2/2] Re-applied dotnet format --- .../TestDataSourceExtensibilityTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/E2ETests/DiscoveryAndExecutionTests/TestDataSourceExtensibilityTests.cs b/test/E2ETests/DiscoveryAndExecutionTests/TestDataSourceExtensibilityTests.cs index cbfd21a23b..2c595716b1 100644 --- a/test/E2ETests/DiscoveryAndExecutionTests/TestDataSourceExtensibilityTests.cs +++ b/test/E2ETests/DiscoveryAndExecutionTests/TestDataSourceExtensibilityTests.cs @@ -106,7 +106,7 @@ public void ExecuteCustomTestExtensibilityWithTestDataTests() } [TestMethod] - public void BailOutWhenDuplicateTestDisplayName() + public void BailOutWhenDuplicateTestDisplayName() { // Arrange var assemblyPath = Path.IsPathRooted(TestAssembly) ? TestAssembly : this.GetAssetFullPath(TestAssembly);