From 0d845ba6798471d28062d404e10bf9f5ff6e516b Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 6 Jun 2023 14:15:54 +1000 Subject: [PATCH 01/11] remove redundant GetTypeInfo --- .../ManagedNameHelper.Reflection.cs | 2 +- .../TestPlatform.cs | 2 +- .../DataCollection/DataCollectorConfig.cs | 2 +- .../ExtensionFramework/TestPluginCache.cs | 4 +- .../TestPluginDiscoverer.cs | 6 +- .../TestDiscovererPluginInformation.cs | 8 +-- .../TestExtensionPluginInformation.cs | 4 +- .../Utilities/TestExtensions.cs | 2 +- .../Utilities/TestLoggerPluginInformation.cs | 2 +- .../Utilities/TestRunTimePluginInformation.cs | 2 +- .../TestSettingsProviderPluginInformation.cs | 2 +- .../Utilities/InstallationContext.cs | 2 +- .../DefaultDataCollectionLauncher.cs | 2 +- .../DotnetDataCollectionLauncher.cs | 2 +- .../InProcDataCollectionExtensionManager.cs | 6 +- .../DataCollection/InProcDataCollector.cs | 10 +-- .../ProxyDataCollectionManager.cs | 2 +- .../Discovery/DiscovererEnumerator.cs | 2 +- .../Execution/BaseRunTests.cs | 8 +-- .../XML/XmlPersistence.cs | 4 +- .../TestObject.cs | 4 +- .../TestProperty/TestProperty.cs | 2 +- .../common/System/ProcessHelper.cs | 2 +- .../Hosting/DefaultTestHostManager.cs | 2 +- .../CodeCoverageDataAttachmentsHandler.cs | 2 +- src/datacollector/DataCollectorMain.cs | 1 - src/testhost.x86/DefaultEngineInvoker.cs | 1 - src/vstest.console/Internal/Product.cs | 1 - .../TestPlatformHelpers/TestRequestManager.cs | 4 +- .../TranslationLayer/TelemetryPerfTestBase.cs | 2 +- .../TestDiscoveryExtensionManagerTests.cs | 2 +- .../TestExecutorExtensionManagerTests.cs | 2 +- .../TestPluginCacheTests.cs | 26 ++++---- .../TestPluginDiscovererTests.cs | 14 ++--- .../TestPluginManagerTests.cs | 2 +- .../Utilities/TestExtensionsTests.cs | 12 ++-- .../DotnetDataCollectionLauncherTests.cs | 2 +- .../InProcDataCollectorTests.cs | 24 +++---- .../ProxyDataCollectionManagerTests.cs | 2 +- .../Discovery/DiscovererEnumeratorTests.cs | 62 +++++++++---------- .../Discovery/DiscoveryManagerTests.cs | 26 ++++---- .../Execution/BaseRunTestsTests.cs | 28 ++++----- .../Execution/ExecutionManagerTests.cs | 8 +-- .../Execution/RunTestsWithSourcesTests.cs | 10 +-- .../TestEngineTests.cs | 2 +- .../TestExtensionManagerTests.cs | 2 +- .../TestLoggerManagerTests.cs | 62 +++++++------------ .../Hosting/DefaultTestHostManagerTests.cs | 4 +- .../TestPluginCacheHelper.cs | 4 +- .../ClientUtilitiesTests.cs | 16 ++--- .../CodeCoverageRunSettingsProcessorTests.cs | 2 +- .../CommunicationLayerIntegrationTests.cs | 2 +- .../DataCollectionManagerTests.cs | 28 ++++----- .../ExecutorUnitTests.cs | 6 +- .../RunTestsArgumentProcessorTests.cs | 2 +- .../TestAdapterPathArgumentProcessorTests.cs | 2 +- .../ArgumentProcessorFactoryTests.cs | 4 +- 57 files changed, 214 insertions(+), 237 deletions(-) diff --git a/src/Microsoft.TestPlatform.AdapterUtilities/ManagedNameUtilities/ManagedNameHelper.Reflection.cs b/src/Microsoft.TestPlatform.AdapterUtilities/ManagedNameUtilities/ManagedNameHelper.Reflection.cs index 0f5848d568..ccff458549 100644 --- a/src/Microsoft.TestPlatform.AdapterUtilities/ManagedNameUtilities/ManagedNameHelper.Reflection.cs +++ b/src/Microsoft.TestPlatform.AdapterUtilities/ManagedNameUtilities/ManagedNameHelper.Reflection.cs @@ -201,7 +201,7 @@ private static void GetManagedNameAndHierarchy(MethodBase method, bool useClosed hierarchyValues[HierarchyConstants.Levels.ClassIndex] = managedTypeName.Substring(hierarchyPos[1] + 1, hierarchyPos[2] - hierarchyPos[1] - 1); hierarchyValues[HierarchyConstants.Levels.NamespaceIndex] = managedTypeName.Substring(hierarchyPos[0], hierarchyPos[1] - hierarchyPos[0]); } - hierarchyValues[HierarchyConstants.Levels.ContainerIndex] = method.DeclaringType?.GetTypeInfo()?.Assembly?.GetName()?.Name ?? string.Empty; + hierarchyValues[HierarchyConstants.Levels.ContainerIndex] = method.DeclaringType?.Assembly?.GetName()?.Name ?? string.Empty; } /// diff --git a/src/Microsoft.TestPlatform.Client/TestPlatform.cs b/src/Microsoft.TestPlatform.Client/TestPlatform.cs index 17da54ad1b..581c629ff9 100644 --- a/src/Microsoft.TestPlatform.Client/TestPlatform.cs +++ b/src/Microsoft.TestPlatform.Client/TestPlatform.cs @@ -292,7 +292,7 @@ private static void AddExtensionAssembliesFromExtensionDirectory() } string extensionsFolder = Path.Combine( - Path.GetDirectoryName(typeof(TestPlatform).GetTypeInfo().Assembly.GetAssemblyLocation())!, + Path.GetDirectoryName(typeof(TestPlatform).Assembly.GetAssemblyLocation())!, "Extensions"); if (!fileHelper.DirectoryExists(extensionsFolder)) { diff --git a/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectorConfig.cs b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectorConfig.cs index c0a46e7423..615425a784 100644 --- a/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectorConfig.cs +++ b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectorConfig.cs @@ -155,6 +155,6 @@ private static object[] GetAttributes(Type dataCollectorType, Type attributeType // If any attribute constructor on the type throws, the exception will bubble up through // the "GetCustomAttributes" method. - return dataCollectorType.GetTypeInfo().GetCustomAttributes(attributeType, true).ToArray(); + return dataCollectorType.GetCustomAttributes(attributeType, true).ToArray(); } } diff --git a/src/Microsoft.TestPlatform.Common/ExtensionFramework/TestPluginCache.cs b/src/Microsoft.TestPlatform.Common/ExtensionFramework/TestPluginCache.cs index a62f6c3af4..3350a61f17 100644 --- a/src/Microsoft.TestPlatform.Common/ExtensionFramework/TestPluginCache.cs +++ b/src/Microsoft.TestPlatform.Common/ExtensionFramework/TestPluginCache.cs @@ -349,7 +349,7 @@ internal static IList GetResolutionPaths(string extensionAssembly) var extensionDirectory = Path.GetDirectoryName(Path.GetFullPath(extensionAssembly))!; resolutionPaths.Add(extensionDirectory); - var currentDirectory = Path.GetDirectoryName(typeof(TestPluginCache).GetTypeInfo().Assembly.GetAssemblyLocation())!; + var currentDirectory = Path.GetDirectoryName(typeof(TestPluginCache).Assembly.GetAssemblyLocation())!; if (!resolutionPaths.Contains(currentDirectory)) { resolutionPaths.Add(currentDirectory); @@ -374,7 +374,7 @@ internal IList GetDefaultResolutionPaths() } // Keep current directory for resolution - var currentDirectory = Path.GetDirectoryName(typeof(TestPluginCache).GetTypeInfo().Assembly.GetAssemblyLocation())!; + var currentDirectory = Path.GetDirectoryName(typeof(TestPluginCache).Assembly.GetAssemblyLocation())!; if (!resolutionPaths.Contains(currentDirectory)) { resolutionPaths.Add(currentDirectory); diff --git a/src/Microsoft.TestPlatform.Common/ExtensionFramework/TestPluginDiscoverer.cs b/src/Microsoft.TestPlatform.Common/ExtensionFramework/TestPluginDiscoverer.cs index 3bbef8f8cf..ca80aa7a2c 100644 --- a/src/Microsoft.TestPlatform.Common/ExtensionFramework/TestPluginDiscoverer.cs +++ b/src/Microsoft.TestPlatform.Common/ExtensionFramework/TestPluginDiscoverer.cs @@ -156,7 +156,7 @@ private static void GetTestExtensionsFromAssembly(Assem if (types.Count == 0) { - types.AddRange(assembly.GetTypes().Where(type => type.GetTypeInfo() is { } typeInfo && typeInfo.IsClass && !typeInfo.IsAbstract)); + types.AddRange(assembly.GetTypes().Where(type => type.IsClass && !type.IsAbstract)); } } catch (ReflectionTypeLoadException e) @@ -166,7 +166,7 @@ private static void GetTestExtensionsFromAssembly(Assem if (e.Types?.Length > 0) { // Unloaded types on e.Types are null, make sure we skip them. - types.AddRange(e.Types.Where(type => type != null && type.GetTypeInfo().IsClass && !type.GetTypeInfo().IsAbstract)!); + types.AddRange(e.Types.Where(type => type != null && type.IsClass && !type.IsAbstract)!); } if (e.LoaderExceptions != null) @@ -209,7 +209,7 @@ private static void GetTestExtensionFromType( string filePath) where TPluginInfo : TestPluginInformation { - if (!extensionType.GetTypeInfo().IsAssignableFrom(type.GetTypeInfo())) + if (!extensionType.IsAssignableFrom(type)) { return; } diff --git a/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestDiscovererPluginInformation.cs b/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestDiscovererPluginInformation.cs index 54eed86b92..8b947cd8e2 100644 --- a/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestDiscovererPluginInformation.cs +++ b/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestDiscovererPluginInformation.cs @@ -90,7 +90,7 @@ private static List GetFileExtensions(Type testDiscovererType) { var fileExtensions = new List(); - var attributes = testDiscovererType.GetTypeInfo().GetCustomAttributes(typeof(FileExtensionAttribute), inherit: false).ToArray(); + var attributes = testDiscovererType.GetCustomAttributes(typeof(FileExtensionAttribute), inherit: false).ToArray(); if (attributes != null && attributes.Length > 0) { foreach (var attribute in attributes) @@ -115,7 +115,7 @@ private static string GetDefaultExecutorUri(Type testDiscovererType) { var result = string.Empty; - var attributes = testDiscovererType.GetTypeInfo().GetCustomAttributes(typeof(DefaultExecutorUriAttribute), inherit: false).ToArray(); + var attributes = testDiscovererType.GetCustomAttributes(typeof(DefaultExecutorUriAttribute), inherit: false).ToArray(); if (attributes != null && attributes.Length > 0) { DefaultExecutorUriAttribute executorUriAttribute = (DefaultExecutorUriAttribute)attributes[0]; @@ -138,7 +138,7 @@ private static AssemblyType GetAssemblyType(Type testDiscovererType) { // Get Category - var attribute = testDiscovererType.GetTypeInfo().GetCustomAttribute(typeof(CategoryAttribute)); + var attribute = testDiscovererType.GetCustomAttribute(typeof(CategoryAttribute)); var category = (attribute as CategoryAttribute)?.Category; // Get assembly type from category. @@ -153,7 +153,7 @@ private static AssemblyType GetAssemblyType(Type testDiscovererType) /// Data type of the test discoverer private static bool GetIsDirectoryBased(Type testDiscovererType) { - var attribute = testDiscovererType.GetTypeInfo().GetCustomAttribute(typeof(DirectoryBasedTestDiscovererAttribute), inherit: false); + var attribute = testDiscovererType.GetCustomAttribute(typeof(DirectoryBasedTestDiscovererAttribute), inherit: false); return attribute is DirectoryBasedTestDiscovererAttribute; } } diff --git a/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestExtensionPluginInformation.cs b/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestExtensionPluginInformation.cs index 6aaa8bd8c0..c5b9d4ef1c 100644 --- a/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestExtensionPluginInformation.cs +++ b/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestExtensionPluginInformation.cs @@ -68,7 +68,7 @@ private static string GetExtensionUri(Type testLoggerType) { string extensionUri = string.Empty; - object[] attributes = testLoggerType.GetTypeInfo().GetCustomAttributes(typeof(ExtensionUriAttribute), false).ToArray(); + object[] attributes = testLoggerType.GetCustomAttributes(typeof(ExtensionUriAttribute), false).ToArray(); if (attributes.Length > 0) { ExtensionUriAttribute extensionUriAttribute = (ExtensionUriAttribute)attributes[0]; @@ -81,7 +81,7 @@ private static string GetExtensionUri(Type testLoggerType) if (extensionUri.IsNullOrEmpty()) { - EqtTrace.Error("The type \"{0}\" defined in \"{1}\" does not have ExtensionUri attribute.", testLoggerType.ToString(), testLoggerType.GetTypeInfo().Module.Name); + EqtTrace.Error("The type \"{0}\" defined in \"{1}\" does not have ExtensionUri attribute.", testLoggerType.ToString(), testLoggerType.Module.Name); } return extensionUri; diff --git a/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestExtensions.cs b/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestExtensions.cs index afc3a705df..ddcbee1e29 100644 --- a/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestExtensions.cs +++ b/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestExtensions.cs @@ -430,7 +430,7 @@ internal static Dictionary GetExtensionsDiscoveredFromAssem var testPluginInformation = extension.Value as TestPluginInformation; // TODO: Avoid ArgumentNullException here var extensionType = Type.GetType(testPluginInformation?.AssemblyQualifiedName!); - if (string.Equals(extensionType?.GetTypeInfo().Assembly.GetAssemblyLocation(), extensionAssembly)) + if (string.Equals(extensionType?.Assembly.GetAssemblyLocation(), extensionAssembly)) { extensions.Add(extension.Key, extension.Value); } diff --git a/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestLoggerPluginInformation.cs b/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestLoggerPluginInformation.cs index 4e57bcd94c..2cb6ae2072 100644 --- a/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestLoggerPluginInformation.cs +++ b/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestLoggerPluginInformation.cs @@ -54,7 +54,7 @@ private static string GetFriendlyName(Type testLoggerType) { string friendlyName = string.Empty; - object[] attributes = testLoggerType.GetTypeInfo().GetCustomAttributes(typeof(FriendlyNameAttribute), false).ToArray(); + object[] attributes = testLoggerType.GetCustomAttributes(typeof(FriendlyNameAttribute), false).ToArray(); if (attributes.Length > 0) { FriendlyNameAttribute friendlyNameAttribute = (FriendlyNameAttribute)attributes[0]; diff --git a/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestRunTimePluginInformation.cs b/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestRunTimePluginInformation.cs index 4a7060713a..5dcf374ecd 100644 --- a/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestRunTimePluginInformation.cs +++ b/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestRunTimePluginInformation.cs @@ -54,7 +54,7 @@ private static string GetFriendlyName(Type? testHostType) { string friendlyName = string.Empty; - object[]? attributes = testHostType?.GetTypeInfo().GetCustomAttributes(typeof(FriendlyNameAttribute), false).ToArray(); + object[]? attributes = testHostType?.GetCustomAttributes(typeof(FriendlyNameAttribute), false).ToArray(); if (attributes != null && attributes.Length > 0) { FriendlyNameAttribute friendlyNameAttribute = (FriendlyNameAttribute)attributes[0]; diff --git a/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestSettingsProviderPluginInformation.cs b/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestSettingsProviderPluginInformation.cs index 6322353be3..da61696432 100644 --- a/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestSettingsProviderPluginInformation.cs +++ b/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestSettingsProviderPluginInformation.cs @@ -68,7 +68,7 @@ private static string GetTestSettingsName(Type testSettingsProviderType) { string settingName = string.Empty; - object[] attributes = testSettingsProviderType.GetTypeInfo().GetCustomAttributes(typeof(SettingsNameAttribute), false).ToArray(); + object[] attributes = testSettingsProviderType.GetCustomAttributes(typeof(SettingsNameAttribute), false).ToArray(); if (attributes != null && attributes.Length > 0) { SettingsNameAttribute settingsNameAttribute = (SettingsNameAttribute)attributes[0]; diff --git a/src/Microsoft.TestPlatform.Common/Utilities/InstallationContext.cs b/src/Microsoft.TestPlatform.Common/Utilities/InstallationContext.cs index 267faa0d58..5a3bdb5b3f 100644 --- a/src/Microsoft.TestPlatform.Common/Utilities/InstallationContext.cs +++ b/src/Microsoft.TestPlatform.Common/Utilities/InstallationContext.cs @@ -25,7 +25,7 @@ public InstallationContext(IFileHelper fileHelper) public bool TryGetVisualStudioDirectory(out string visualStudioDirectory) { - var vsInstallPath = new DirectoryInfo(typeof(InstallationContext).GetTypeInfo().Assembly.GetAssemblyLocation()).Parent?.Parent?.Parent?.FullName; + var vsInstallPath = new DirectoryInfo(typeof(InstallationContext).Assembly.GetAssemblyLocation()).Parent?.Parent?.Parent?.FullName; if (!vsInstallPath.IsNullOrEmpty()) { var pathToDevenv = Path.Combine(vsInstallPath, DevenvExe); diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DefaultDataCollectionLauncher.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DefaultDataCollectionLauncher.cs index 866cdc612e..adbb6151ae 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DefaultDataCollectionLauncher.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DefaultDataCollectionLauncher.cs @@ -53,7 +53,7 @@ internal DefaultDataCollectionLauncher(IProcessHelper processHelper, IMessageLog /// ProcessId of launched Process. 0 means not launched. public override int LaunchDataCollector(IDictionary? environmentVariables, IList commandLineArguments) { - var dataCollectorDirectory = Path.GetDirectoryName(typeof(DefaultDataCollectionLauncher).GetTypeInfo().Assembly.GetAssemblyLocation()); + var dataCollectorDirectory = Path.GetDirectoryName(typeof(DefaultDataCollectionLauncher).Assembly.GetAssemblyLocation()); TPDebug.Assert(dataCollectorDirectory is not null, "dataCollectorDirectory is not null"); var currentProcessPath = _processHelper.GetCurrentProcessFileName(); diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DotnetDataCollectionLauncher.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DotnetDataCollectionLauncher.cs index 6bfab43138..5a5f0cedb9 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DotnetDataCollectionLauncher.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DotnetDataCollectionLauncher.cs @@ -62,7 +62,7 @@ internal DotnetDataCollectionLauncher(IProcessHelper processHelper, IFileHelper /// ProcessId of launched Process. 0 means not launched. public override int LaunchDataCollector(IDictionary? environmentVariables, IList commandLineArguments) { - var dataCollectorDirectory = Path.GetDirectoryName(typeof(DefaultDataCollectionLauncher).GetTypeInfo().Assembly.GetAssemblyLocation()); + var dataCollectorDirectory = Path.GetDirectoryName(typeof(DefaultDataCollectionLauncher).Assembly.GetAssemblyLocation()); TPDebug.Assert(dataCollectorDirectory is not null, "dataCollectorDirectory is null"); var dataCollectorAssemblyPath = Path.Combine(dataCollectorDirectory, DataCollectorProcessName); diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/InProcDataCollectionExtensionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/InProcDataCollectionExtensionManager.cs index 9f7c321dfd..cecdc7a0b1 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/InProcDataCollectionExtensionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/InProcDataCollectionExtensionManager.cs @@ -100,12 +100,12 @@ protected InProcDataCollectionExtensionManager(string? runSettings, ITestEventsP /// /// The . /// - protected virtual IInProcDataCollector CreateDataCollector(string assemblyQualifiedName, string codebase, XmlElement configuration, TypeInfo interfaceTypeInfo) + protected virtual IInProcDataCollector CreateDataCollector(string assemblyQualifiedName, string codebase, XmlElement configuration, Type interfaceType) { var inProcDataCollector = new InProcDataCollector( codebase, assemblyQualifiedName, - interfaceTypeInfo, + interfaceType, configuration?.OuterXml); inProcDataCollector.LoadDataCollector(_inProcDataCollectionSink); @@ -215,7 +215,7 @@ private void InitializeInProcDataCollectors(string? runSettings) _inProcDataCollectorSettingsCollection = inProcDataCollectionRunSettings!.DataCollectorSettingsList; - var interfaceTypeInfo = typeof(InProcDataCollection).GetTypeInfo(); + var interfaceTypeInfo = typeof(InProcDataCollection); foreach (var inProcDc in _inProcDataCollectorSettingsCollection) { var codeBase = GetCodebase(inProcDc.CodeBase!); diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/InProcDataCollector.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/InProcDataCollector.cs index c3d1684291..f8cdcf9837 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/InProcDataCollector.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/InProcDataCollector.cs @@ -44,9 +44,9 @@ internal class InProcDataCollector : IInProcDataCollector public InProcDataCollector( string codeBase, string assemblyQualifiedName, - TypeInfo interfaceTypeInfo, + Type interfaceType, string? configXml) - : this(codeBase, assemblyQualifiedName, interfaceTypeInfo, configXml, new PlatformAssemblyLoadContext(), TestPluginCache.Instance) + : this(codeBase, assemblyQualifiedName, interfaceType, configXml, new PlatformAssemblyLoadContext(), TestPluginCache.Instance) { } @@ -63,7 +63,7 @@ public InProcDataCollector( /// /// /// - internal InProcDataCollector(string codeBase, string assemblyQualifiedName, TypeInfo interfaceTypeInfo, string? configXml, IAssemblyLoadContext assemblyLoadContext, TestPluginCache testPluginCache) + internal InProcDataCollector(string codeBase, string assemblyQualifiedName, Type interfaceType, string? configXml, IAssemblyLoadContext assemblyLoadContext, TestPluginCache testPluginCache) { _configXml = configXml; _assemblyLoadContext = assemblyLoadContext; @@ -75,7 +75,7 @@ internal InProcDataCollector(string codeBase, string assemblyQualifiedName, Type { // If we're loading coverlet collector we skip to check the version of assembly // to allow upgrade through nuget package - filterPredicate = x => Constants.CoverletDataCollectorTypeName.Equals(x.FullName) && interfaceTypeInfo.IsAssignableFrom(x.GetTypeInfo()); + filterPredicate = x => Constants.CoverletDataCollectorTypeName.Equals(x.FullName) && interfaceType.IsAssignableFrom(x); // Coverlet collector is consumed as nuget package we need to add assemblies directory to resolver to correctly load references. TPDebug.Assert(Path.IsPathRooted(codeBase), "Absolute path expected"); @@ -83,7 +83,7 @@ internal InProcDataCollector(string codeBase, string assemblyQualifiedName, Type } else { - filterPredicate = x => string.Equals(x.AssemblyQualifiedName, assemblyQualifiedName) && interfaceTypeInfo.IsAssignableFrom(x.GetTypeInfo()); + filterPredicate = x => string.Equals(x.AssemblyQualifiedName, assemblyQualifiedName) && interfaceType.IsAssignableFrom(x); } _dataCollectorType = assembly?.GetTypes().FirstOrDefault(filterPredicate); diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyDataCollectionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyDataCollectionManager.cs index 1cb86f1268..ab52e9018a 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyDataCollectionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyDataCollectionManager.cs @@ -348,7 +348,7 @@ private static string GetTimestampedLogFile(string logFile) return settingsXml; } - var extensionsFolder = Path.Combine(Path.GetDirectoryName(typeof(ITestPlatform).GetTypeInfo().Assembly.GetAssemblyLocation())!, "Extensions"); + var extensionsFolder = Path.Combine(Path.GetDirectoryName(typeof(ITestPlatform).Assembly.GetAssemblyLocation())!, "Extensions"); using var stream = new StringReader(settingsXml); using var reader = XmlReader.Create(stream, XmlRunSettingsUtilities.ReaderSettings); diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscovererEnumerator.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscovererEnumerator.cs index aafa907ef8..b657246841 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscovererEnumerator.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscovererEnumerator.cs @@ -296,7 +296,7 @@ private static bool IsDiscovererFromDeprecatedLocations( return false; } - var discovererLocation = discoverer.Value.GetType().GetTypeInfo().Assembly.GetAssemblyLocation(); + var discovererLocation = discoverer.Value.GetType().Assembly.GetAssemblyLocation(); return Path.GetDirectoryName(discovererLocation)! .Equals(Constants.DefaultAdapterLocation, StringComparison.OrdinalIgnoreCase); diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/BaseRunTests.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/BaseRunTests.cs index 0d5e6dacae..71df2a37a9 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/BaseRunTests.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/BaseRunTests.cs @@ -494,12 +494,12 @@ private bool RunTestInternalWithExecutors(IEnumerable> execut if (!CrossPlatEngine.Constants.DefaultAdapters.Contains(executor.Metadata.ExtensionUri, StringComparer.OrdinalIgnoreCase)) { // If real executor is wrapped by a decorator we get the real decorated type - TypeInfo executorTypeInfo = + Type executorType = (executor.Value is SerialTestRunDecorator serialTestRunDecorator) - ? serialTestRunDecorator.OriginalTestExecutor.GetType().GetTypeInfo() - : executor.Value.GetType().GetTypeInfo(); + ? serialTestRunDecorator.OriginalTestExecutor.GetType() + : executor.Value.GetType(); - var executorLocation = executorTypeInfo.Assembly.GetAssemblyLocation(); + var executorLocation = executorType.Assembly.GetAssemblyLocation(); executorsFromDeprecatedLocations |= Path.GetDirectoryName(executorLocation)!.Equals(CrossPlatEngine.Constants.DefaultAdapterLocation); } diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/XML/XmlPersistence.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/XML/XmlPersistence.cs index aa73268c32..8808c57314 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/XML/XmlPersistence.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/XML/XmlPersistence.cs @@ -528,7 +528,7 @@ private static IEnumerable ReflectFields(Type type) foreach ( FieldInfo reflectedFieldInfo in - type.GetTypeInfo().GetFields( + type.GetFields( BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly)) { FieldPersistenceInfo info = new(reflectedFieldInfo); @@ -599,7 +599,7 @@ private static string GetDefaultFieldLocation(FieldInfo fieldInfo) private static bool ImplementsIXmlTestStore(Type type) { - return type.GetTypeInfo().GetInterface(typeof(IXmlTestStore).Name) != null; + return type.GetInterface(typeof(IXmlTestStore).Name) != null; } private static T? GetAttribute(FieldInfo fieldInfo) where T : Attribute diff --git a/src/Microsoft.TestPlatform.ObjectModel/TestObject.cs b/src/Microsoft.TestPlatform.ObjectModel/TestObject.cs index e99175c525..fdf1972ab3 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/TestObject.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/TestObject.cs @@ -108,7 +108,7 @@ public virtual IEnumerable Properties object? defaultValue = null; var valueType = property.GetValueType(); - if (valueType != null && valueType.GetTypeInfo().IsValueType) + if (valueType != null && valueType.IsValueType) { defaultValue = Activator.CreateInstance(valueType); } @@ -249,7 +249,7 @@ protected virtual void ProtectedSetPropertyValue(TestProperty property, object? // Do not try conversion if the object is already of the type we're trying to convert. // Note that typeof(T) may be object in case the value is getting deserialized via the StoreKvpList, however // the de-serializer could have converted it already, hence the runtime type check. - if (valueType != null && (valueType.GetTypeInfo().IsAssignableFrom(typeof(T).GetTypeInfo()) || valueType.GetTypeInfo().IsAssignableFrom(value?.GetType().GetTypeInfo()))) + if (valueType != null && (valueType.IsAssignableFrom(typeof(T)) || valueType.IsAssignableFrom(value?.GetType()))) { return value; } diff --git a/src/Microsoft.TestPlatform.ObjectModel/TestProperty/TestProperty.cs b/src/Microsoft.TestPlatform.ObjectModel/TestProperty/TestProperty.cs index 7555f82793..57ce97ef87 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/TestProperty/TestProperty.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/TestProperty/TestProperty.cs @@ -62,7 +62,7 @@ private TestProperty(string id, string label, string category, string descriptio // Note that this doesn't handle generic types. Such types will fail during serialization. ValueType = valueType.FullName!; } - else if (valueType.GetTypeInfo().IsValueType) + else if (valueType.IsValueType) { // In case of custom types, let the assembly qualified name be available to help // deserialization on the client. diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/common/System/ProcessHelper.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/common/System/ProcessHelper.cs index 5db8da531c..c5797a9bfa 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/common/System/ProcessHelper.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/common/System/ProcessHelper.cs @@ -235,7 +235,7 @@ void InitializeAndStart() /// public string? GetTestEngineDirectory() { - return Path.GetDirectoryName(typeof(ProcessHelper).GetTypeInfo().Assembly.Location); + return Path.GetDirectoryName(typeof(ProcessHelper).Assembly.Location); } /// diff --git a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs index 5a92e65263..1759c00013 100644 --- a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs +++ b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs @@ -180,7 +180,7 @@ public virtual TestProcessStartInfo GetTestHostProcessStartInfo( string testHostProcessName = GetTestHostName(_architecture, _targetFramework, _processHelper.GetCurrentProcessArchitecture()); - var currentWorkingDirectory = Path.GetDirectoryName(typeof(DefaultTestHostManager).GetTypeInfo().Assembly.Location); + var currentWorkingDirectory = Path.GetDirectoryName(typeof(DefaultTestHostManager).Assembly.Location); var argumentsString = " " + connectionInfo.ToCommandLineOptions(); TPDebug.Assert(currentWorkingDirectory is not null, "Current working directory must not be null."); diff --git a/src/Microsoft.TestPlatform.Utilities/CodeCoverageDataAttachmentsHandler.cs b/src/Microsoft.TestPlatform.Utilities/CodeCoverageDataAttachmentsHandler.cs index 3e675e6f6a..be2a1030f3 100644 --- a/src/Microsoft.TestPlatform.Utilities/CodeCoverageDataAttachmentsHandler.cs +++ b/src/Microsoft.TestPlatform.Utilities/CodeCoverageDataAttachmentsHandler.cs @@ -166,7 +166,7 @@ private static void LoadCodeCoverageAssembly() return; } - var dataAttachmentAssemblyLocation = typeof(CodeCoverageDataAttachmentsHandler).GetTypeInfo().Assembly.GetAssemblyLocation()!; + var dataAttachmentAssemblyLocation = typeof(CodeCoverageDataAttachmentsHandler).Assembly.GetAssemblyLocation()!; var assemblyPath = Path.Combine(Path.GetDirectoryName(dataAttachmentAssemblyLocation)!, CodeCoverageIoAssemblyName + ".dll"); s_codeCoverageAssembly = new PlatformAssemblyLoadContext().LoadAssemblyFromPath(assemblyPath); diff --git a/src/datacollector/DataCollectorMain.cs b/src/datacollector/DataCollectorMain.cs index a867bde716..5946455b36 100644 --- a/src/datacollector/DataCollectorMain.cs +++ b/src/datacollector/DataCollectorMain.cs @@ -105,7 +105,6 @@ public void Run(string[]? args) if (EqtTrace.IsVerboseEnabled) { var version = typeof(DataCollectorMain) - .GetTypeInfo() .Assembly .GetCustomAttribute()?.InformationalVersion; EqtTrace.Verbose($"Version: {version}"); diff --git a/src/testhost.x86/DefaultEngineInvoker.cs b/src/testhost.x86/DefaultEngineInvoker.cs index 14746cee92..b28332e8ad 100644 --- a/src/testhost.x86/DefaultEngineInvoker.cs +++ b/src/testhost.x86/DefaultEngineInvoker.cs @@ -100,7 +100,6 @@ public void Invoke(IDictionary argsDictionary) if (EqtTrace.IsVerboseEnabled) { var version = typeof(DefaultEngineInvoker) - .GetTypeInfo() .Assembly .GetCustomAttribute()?.InformationalVersion; EqtTrace.Verbose($"Version: {version} Current process architecture: {_processHelper.GetCurrentProcessArchitecture()}"); diff --git a/src/vstest.console/Internal/Product.cs b/src/vstest.console/Internal/Product.cs index 277da3d2a3..de39a99c4f 100644 --- a/src/vstest.console/Internal/Product.cs +++ b/src/vstest.console/Internal/Product.cs @@ -12,7 +12,6 @@ public class Product private static string? GetProductVersion() { var attr = typeof(Product) - .GetTypeInfo() .Assembly .GetCustomAttribute(); return attr?.InformationalVersion; diff --git a/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs b/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs index 860306190d..76d33b2f41 100644 --- a/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs +++ b/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs @@ -1110,7 +1110,7 @@ private static void AddConsoleLogger(XmlDocument document, LoggerRunSettings log FriendlyName = ConsoleLogger.FriendlyName, Uri = new Uri(ConsoleLogger.ExtensionUri), AssemblyQualifiedName = typeof(ConsoleLogger).AssemblyQualifiedName, - CodeBase = typeof(ConsoleLogger).GetTypeInfo().Assembly.Location, + CodeBase = typeof(ConsoleLogger).Assembly.Location, IsEnabled = true }; @@ -1144,7 +1144,7 @@ private static bool UpdateConsoleLoggerIfExists( { var consoleLogger = loggerRunSettings.LoggerSettingsList[existingLoggerIndex]; consoleLogger.AssemblyQualifiedName = typeof(ConsoleLogger).AssemblyQualifiedName; - consoleLogger.CodeBase = typeof(ConsoleLogger).GetTypeInfo().Assembly.Location; + consoleLogger.CodeBase = typeof(ConsoleLogger).Assembly.Location; RunSettingsProviderExtensions.UpdateRunSettingsXmlDocumentInnerXml( document, ObjectModel.Constants.LoggerRunSettingsName, diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Performance/TranslationLayer/TelemetryPerfTestBase.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Performance/TranslationLayer/TelemetryPerfTestBase.cs index 1e869fea26..2245128fee 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Performance/TranslationLayer/TelemetryPerfTestBase.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Performance/TranslationLayer/TelemetryPerfTestBase.cs @@ -22,7 +22,7 @@ public class TelemetryPerfTestBase : PerformanceTestBase { private const string TelemetryInstrumentationKey = "08de1ac5-2db8-4c30-97c6-2e12695fa610"; private readonly TelemetryClient _client; - private readonly string _rootDirectory = new DirectoryInfo(typeof(DiscoveryPerfTests).GetTypeInfo().Assembly.GetAssemblyLocation()).Parent.Parent.Parent.Parent.Parent.Parent.FullName; + private readonly string _rootDirectory = new DirectoryInfo(typeof(DiscoveryPerfTests)..Assembly.GetAssemblyLocation()).Parent.Parent.Parent.Parent.Parent.Parent.FullName; public TelemetryPerfTestBase() { diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestDiscoveryExtensionManagerTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestDiscoveryExtensionManagerTests.cs index 796ee6b2b8..5e6e25272f 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestDiscoveryExtensionManagerTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestDiscoveryExtensionManagerTests.cs @@ -49,7 +49,7 @@ public void GetDiscoveryExtensionManagerShouldReturnADiscoveryManagerWithExtensi { var extensionManager = TestDiscoveryExtensionManager.GetDiscoveryExtensionManager( - typeof(TestDiscoveryExtensionManagerTests).GetTypeInfo().Assembly.Location); + typeof(TestDiscoveryExtensionManagerTests).Assembly.Location); Assert.IsNotNull(extensionManager.Discoverers); Assert.IsTrue(extensionManager.Discoverers.Any()); diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestExecutorExtensionManagerTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestExecutorExtensionManagerTests.cs index ca0aefbf1f..3ecb36ab0d 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestExecutorExtensionManagerTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestExecutorExtensionManagerTests.cs @@ -47,7 +47,7 @@ public void GetExecutorExtensionManagerShouldReturnAnExecutionManagerWithExtensi { var extensionManager = TestExecutorExtensionManager.GetExecutionExtensionManager( - typeof(TestExecutorExtensionManagerTests).GetTypeInfo().Assembly.Location); + typeof(TestExecutorExtensionManagerTests).Assembly.Location); Assert.IsNotNull(extensionManager.TestExtensions); Assert.IsTrue(extensionManager.TestExtensions.Any()); diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginCacheTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginCacheTests.cs index a33d8c122c..b762049b48 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginCacheTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginCacheTests.cs @@ -31,7 +31,7 @@ public TestPluginCacheTests() // Reset the singleton. TestPluginCache.Instance = null; _mockFileHelper = new Mock(); - _testablePluginCache = new TestableTestPluginCache(new List { typeof(TestPluginCacheTests).GetTypeInfo().Assembly.Location }); + _testablePluginCache = new TestableTestPluginCache(new List { typeof(TestPluginCacheTests).Assembly.Location }); _mockFileHelper.Setup(fh => fh.DirectoryExists(It.IsAny())).Returns(true); } @@ -71,7 +71,7 @@ public void UpdateAdditionalExtensionsShouldNotThrowIfExtensionPathIsEmpty() [TestMethod] public void UpdateAdditionalExtensionsShouldUpdateAdditionalExtensions() { - var additionalExtensions = new List { typeof(TestPluginCacheTests).GetTypeInfo().Assembly.Location }; + var additionalExtensions = new List { typeof(TestPluginCacheTests).Assembly.Location }; TestPluginCache.Instance.UpdateExtensions(additionalExtensions, false); var updatedExtensions = TestPluginCache.Instance.GetExtensionPaths(string.Empty); @@ -84,8 +84,8 @@ public void UpdateAdditionalExtensionsShouldOnlyAddUniqueExtensionPaths() { var additionalExtensions = new List { - typeof(TestPluginCacheTests).GetTypeInfo().Assembly.Location, - typeof(TestPluginCacheTests).GetTypeInfo().Assembly.Location + typeof(TestPluginCacheTests).Assembly.Location, + typeof(TestPluginCacheTests).Assembly.Location }; TestPluginCache.Instance.UpdateExtensions(additionalExtensions, false); var updatedExtensions = TestPluginCache.Instance.GetExtensionPaths(string.Empty); @@ -206,7 +206,7 @@ public void GetExtensionPathsShouldNotSkipDefaultExtensionsIfSetFalse() [TestMethod] public void GetDefaultResolutionPathsShouldReturnCurrentDirectoryByDefault() { - var currentDirectory = Path.GetDirectoryName(typeof(TestPluginCache).GetTypeInfo().Assembly.Location); + var currentDirectory = Path.GetDirectoryName(typeof(TestPluginCache).Assembly.Location); var expectedDirectories = new List { currentDirectory! }; var resolutionPaths = TestPluginCache.Instance.GetDefaultResolutionPaths(); @@ -218,7 +218,7 @@ public void GetDefaultResolutionPathsShouldReturnCurrentDirectoryByDefault() [TestMethod] public void GetDefaultResolutionPathsShouldReturnAdditionalExtensionPathsDirectories() { - var currentDirectory = Path.GetDirectoryName(typeof(TestPluginCache).GetTypeInfo().Assembly.Location)!; + var currentDirectory = Path.GetDirectoryName(typeof(TestPluginCache).Assembly.Location)!; var candidateDirectory = Directory.GetParent(currentDirectory)!.FullName; var extensionPaths = new List { Path.Combine(candidateDirectory, "foo.dll") }; @@ -244,7 +244,7 @@ public void GetDefaultResolutionPathsShouldReturnDirectoryFromDefaultExtensionsP // Setup the testable instance. TestPluginCache.Instance = _testablePluginCache; - var defaultExtensionsFile = typeof(TestPluginCache).GetTypeInfo().Assembly.Location; + var defaultExtensionsFile = typeof(TestPluginCache).Assembly.Location; _testablePluginCache.DefaultExtensionPaths = new List() { defaultExtensionsFile }; var resolutionPaths = TestPluginCache.Instance.GetDefaultResolutionPaths(); @@ -269,7 +269,7 @@ public void GetResolutionPathsShouldReturnExtensionAssemblyDirectoryAndTpCommonD var temp = Path.GetTempPath(); var resolutionPaths = TestPluginCache.GetResolutionPaths($@"{temp}{Path.DirectorySeparatorChar}Idonotexist.dll").Select(p => p.Replace("/", "\\")).ToList(); - var tpCommonDirectory = Path.GetDirectoryName(typeof(TestPluginCache).GetTypeInfo().Assembly.Location)!; + var tpCommonDirectory = Path.GetDirectoryName(typeof(TestPluginCache)..Assembly.Location)!; var expectedPaths = new List { temp, tpCommonDirectory }.ConvertAll(p => p.Replace("/", "\\").TrimEnd('\\')); CollectionAssert.AreEqual(expectedPaths, resolutionPaths, $"Collection {string.Join(", ", resolutionPaths)}, is not equal to the expected collection {string.Join(", ", expectedPaths)}."); @@ -278,7 +278,7 @@ public void GetResolutionPathsShouldReturnExtensionAssemblyDirectoryAndTpCommonD [TestMethod] public void GetResolutionPathsShouldNotHaveDuplicatePathsIfExtensionIsInSameDirectory() { - var tpCommonlocation = typeof(TestPluginCache).GetTypeInfo().Assembly.Location; + var tpCommonlocation = typeof(TestPluginCache).Assembly.Location; var resolutionPaths = TestPluginCache.GetResolutionPaths(tpCommonlocation); @@ -296,7 +296,7 @@ public void GetTestExtensionsShouldReturnExtensionsInAssembly() { TestPluginCacheHelper.SetupMockAdditionalPathExtensions(typeof(TestPluginCacheTests)); - TestPluginCache.Instance.GetTestExtensions(typeof(TestPluginCacheTests).GetTypeInfo().Assembly.Location); + TestPluginCache.Instance.GetTestExtensions(typeof(TestPluginCacheTests).Assembly.Location); Assert.IsNotNull(TestPluginCache.Instance.TestExtensions); Assert.IsTrue(TestPluginCache.Instance.TestExtensions.TestDiscoverers!.Count > 0); @@ -305,7 +305,7 @@ public void GetTestExtensionsShouldReturnExtensionsInAssembly() [TestMethod] public void GetTestExtensionsShouldAddTestExtensionsDiscoveredToCache() { - var extensionAssembly = typeof(TestPluginCacheTests).GetTypeInfo().Assembly.Location; + var extensionAssembly = typeof(TestPluginCacheTests).Assembly.Location; var testDiscovererPluginInfos = _testablePluginCache.GetTestExtensions(extensionAssembly); @@ -318,7 +318,7 @@ public void GetTestExtensionsShouldAddTestExtensionsDiscoveredToCache() [TestMethod] public void GetTestExtensionsShouldGetTestExtensionsFromCache() { - var extensionAssembly = typeof(TestPluginCacheTests).GetTypeInfo().Assembly.Location; + var extensionAssembly = typeof(TestPluginCacheTests).Assembly.Location; var testDiscovererPluginInfos = _testablePluginCache.GetTestExtensions(extensionAssembly); Assert.IsFalse(testDiscovererPluginInfos.ContainsKey("td")); @@ -335,7 +335,7 @@ public void GetTestExtensionsShouldShouldThrowIfDiscovererThrows() { //TODO : make ITestDiscoverer interface and then mock it in order to make this test case pass. - var extensionAssembly = typeof(TestPluginCacheTests).GetTypeInfo().Assembly.Location; + var extensionAssembly = typeof(TestPluginCacheTests).Assembly.Location; Assert.ThrowsException(() => _testablePluginCache.GetTestExtensions(extensionAssembly)); } diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginDiscovererTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginDiscovererTests.cs index 43e300c336..3aa8ba3970 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginDiscovererTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginDiscovererTests.cs @@ -38,7 +38,7 @@ public void GetTestExtensionsInformationShouldNotThrowOnALoadException() [TestMethod] public void GetTestExtensionsInformationShouldNotConsiderAbstractClasses() { - var pathToExtensions = new List { typeof(TestPluginDiscovererTests).GetTypeInfo().Assembly.Location }; + var pathToExtensions = new List { typeof(TestPluginDiscovererTests).Assembly.Location }; // The below should not throw an exception. var testExtensions = TestPluginDiscoverer.GetTestExtensionsInformation(pathToExtensions); @@ -49,7 +49,7 @@ public void GetTestExtensionsInformationShouldNotConsiderAbstractClasses() [TestMethod] public void GetTestExtensionsInformationShouldReturnDiscovererExtensions() { - var pathToExtensions = new List { typeof(TestPluginDiscovererTests).GetTypeInfo().Assembly.Location }; + var pathToExtensions = new List { typeof(TestPluginDiscovererTests).Assembly.Location }; // The below should not throw an exception. var testExtensions = TestPluginDiscoverer.GetTestExtensionsInformation(pathToExtensions); @@ -64,7 +64,7 @@ public void GetTestExtensionsInformationShouldReturnDiscovererExtensions() [TestMethod] public void GetTestExtensionsInformationShouldReturnExecutorExtensions() { - var pathToExtensions = new List { typeof(TestPluginDiscovererTests).GetTypeInfo().Assembly.Location }; + var pathToExtensions = new List { typeof(TestPluginDiscovererTests).Assembly.Location }; // The below should not throw an exception. var testExtensions = TestPluginDiscoverer.GetTestExtensionsInformation(pathToExtensions); @@ -80,7 +80,7 @@ public void GetTestExtensionsInformationShouldReturnExecutorExtensions() [TestMethod] public void GetTestExtensionsInformationShouldReturnLoggerExtensions() { - var pathToExtensions = new List { typeof(TestPluginDiscovererTests).GetTypeInfo().Assembly.Location }; + var pathToExtensions = new List { typeof(TestPluginDiscovererTests).Assembly.Location }; // The below should not throw an exception. var testExtensions = TestPluginDiscoverer.GetTestExtensionsInformation(pathToExtensions); @@ -95,7 +95,7 @@ public void GetTestExtensionsInformationShouldReturnLoggerExtensions() [TestMethod] public void GetTestExtensionsInformationShouldReturnDataCollectorExtensionsAndIgnoresInvalidDataCollectors() { - var pathToExtensions = new List { typeof(TestPluginDiscovererTests).GetTypeInfo().Assembly.Location }; + var pathToExtensions = new List { typeof(TestPluginDiscovererTests).Assembly.Location }; // The below should not throw an exception. var testExtensions = TestPluginDiscoverer.GetTestExtensionsInformation(pathToExtensions); @@ -110,7 +110,7 @@ public void GetTestExtensionsInformationShouldReturnDataCollectorExtensionsAndIg [TestMethod] public void GetTestExtensionsInformationShouldReturnSettingsProviderExtensions() { - var pathToExtensions = new List { typeof(TestPluginDiscovererTests).GetTypeInfo().Assembly.Location }; + var pathToExtensions = new List { typeof(TestPluginDiscovererTests).Assembly.Location }; // The below should not throw an exception. var testExtensions = TestPluginDiscoverer.GetTestExtensionsInformation(pathToExtensions); @@ -128,7 +128,7 @@ public void GetTestExtensionsInformationShouldNotAbortOnFaultyExtensions() { var pathToExtensions = new List { - typeof(TestPluginDiscovererTests).GetTypeInfo().Assembly.Location, + typeof(TestPluginDiscovererTests).Assembly.Location, }; var testExtensions = TestPluginDiscoverer.GetTestExtensionsInformation(pathToExtensions); diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginManagerTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginManagerTests.cs index dc97e8fc40..1234165df3 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginManagerTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginManagerTests.cs @@ -109,7 +109,7 @@ public void GetTestExtensionsShouldDiscoverExtensionsOnlyOnce() public void GetTestExtensionsForAnExtensionAssemblyShouldReturnExtensionsInThatAssembly() { TestPluginManager.GetTestExtensions( - typeof(TestPluginManagerTests).GetTypeInfo().Assembly.Location, + typeof(TestPluginManagerTests).Assembly.Location, out _, out var testExtensions); diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestExtensionsTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestExtensionsTests.cs index c7c8fcd484..5f870afe4a 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestExtensionsTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestExtensionsTests.cs @@ -114,7 +114,7 @@ public void AddExtensionsShouldNotAddAnAlreadyExistingExtensionToTheCollection() [TestMethod] public void GetExtensionsDiscoveredFromAssemblyShouldReturnNullIfNoExtensionsPresent() { - var assemblyLocation = typeof(TestExtensionsTests).GetTypeInfo().Assembly.Location; + var assemblyLocation = typeof(TestExtensionsTests).Assembly.Location; Assert.IsNull(_testExtensions.GetExtensionsDiscoveredFromAssembly(assemblyLocation)); } @@ -133,7 +133,7 @@ public void GetExtensionsDiscoveredFromAssemblyShouldNotThrowIfExtensionAssembly [TestMethod] public void GetExtensionsDiscoveredFromAssemblyShouldReturnTestDiscoverers() { - var assemblyLocation = typeof(TestExtensionsTests).GetTypeInfo().Assembly.Location; + var assemblyLocation = typeof(TestExtensionsTests).Assembly.Location; _testExtensions.TestDiscoverers = new Dictionary { @@ -153,7 +153,7 @@ public void GetExtensionsDiscoveredFromAssemblyShouldReturnTestDiscoverers() [TestMethod] public void GetExtensionsDiscoveredFromAssemblyShouldReturnTestExecutors() { - var assemblyLocation = typeof(TestExtensionsTests).GetTypeInfo().Assembly.Location; + var assemblyLocation = typeof(TestExtensionsTests).Assembly.Location; _testExtensions.TestExecutors = new Dictionary { @@ -173,7 +173,7 @@ public void GetExtensionsDiscoveredFromAssemblyShouldReturnTestExecutors() [TestMethod] public void GetExtensionsDiscoveredFromAssemblyShouldReturnTestSettingsProviders() { - var assemblyLocation = typeof(TestExtensionsTests).GetTypeInfo().Assembly.Location; + var assemblyLocation = typeof(TestExtensionsTests).Assembly.Location; _testExtensions.TestSettingsProviders = new Dictionary { @@ -193,7 +193,7 @@ public void GetExtensionsDiscoveredFromAssemblyShouldReturnTestSettingsProviders [TestMethod] public void GetExtensionsDiscoveredFromAssemblyShouldReturnTestLoggers() { - var assemblyLocation = typeof(TestExtensionsTests).GetTypeInfo().Assembly.Location; + var assemblyLocation = typeof(TestExtensionsTests).Assembly.Location; _testExtensions.TestLoggers = new Dictionary { @@ -213,7 +213,7 @@ public void GetExtensionsDiscoveredFromAssemblyShouldReturnTestLoggers() [TestMethod] public void GetExtensionsDiscoveredFromAssemblyShouldReturnTestDiscoveresAndLoggers() { - var assemblyLocation = typeof(TestExtensionsTests).GetTypeInfo().Assembly.Location; + var assemblyLocation = typeof(TestExtensionsTests).Assembly.Location; _testExtensions.TestDiscoverers = new Dictionary { diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/DotnetDataCollectionLauncherTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/DotnetDataCollectionLauncherTests.cs index 6a1df7d787..32d12e3d5b 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/DotnetDataCollectionLauncherTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/DotnetDataCollectionLauncherTests.cs @@ -48,7 +48,7 @@ public void LaunchDataCollectorShouldLaunchDataCollectorProcess() [TestMethod] public void LaunchDataCollectorShouldAppendDoubleQuoteForDataCollectorDllPath() { - var currentWorkingDirectory = Path.GetDirectoryName(typeof(DefaultDataCollectionLauncher).GetTypeInfo().Assembly.GetAssemblyLocation())!; + var currentWorkingDirectory = Path.GetDirectoryName(typeof(DefaultDataCollectionLauncher).Assembly.GetAssemblyLocation())!; var dataCollectorAssemblyPath = Path.Combine(currentWorkingDirectory, "datacollector.dll"); List arguments = new(); diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/InProcDataCollectorTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/InProcDataCollectorTests.cs index e3ae6c7b20..0baec50dbd 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/InProcDataCollectorTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/InProcDataCollectorTests.cs @@ -69,49 +69,49 @@ public void InProcDataCollectorShouldNotThrowExceptionIfAssemblyDoesNotContainAn [TestMethod] public void InProcDataCollectorShouldInitializeIfAssemblyContainsAnyInProcDataCollector() { - var typeInfo = typeof(TestableInProcDataCollector).GetTypeInfo(); + var type = typeof(TestableInProcDataCollector); _assemblyLoadContext.Setup(alc => alc.LoadAssemblyFromPath(It.IsAny())) - .Returns(typeInfo.Assembly); + .Returns(type.Assembly); _inProcDataCollector = new InProcDataCollector( string.Empty, - typeInfo.AssemblyQualifiedName!, - typeInfo, + type.AssemblyQualifiedName!, + type, string.Empty, _assemblyLoadContext.Object, TestPluginCache.Instance); Assert.IsNotNull(_inProcDataCollector.AssemblyQualifiedName); - Assert.AreEqual(_inProcDataCollector.AssemblyQualifiedName, typeInfo.AssemblyQualifiedName); + Assert.AreEqual(_inProcDataCollector.AssemblyQualifiedName, type.AssemblyQualifiedName); } [TestMethod] public void InProcDataCollectorLoadCoverlet() { - var typeInfo = typeof(CoverletInProcDataCollector).GetTypeInfo(); + var type = typeof(CoverletInProcDataCollector); - Assert.AreEqual("9.9.9.9", typeInfo.Assembly.GetName().Version!.ToString()); + Assert.AreEqual("9.9.9.9", type.Assembly.GetName().Version!.ToString()); _assemblyLoadContext.Setup(alc => alc.LoadAssemblyFromPath(It.IsAny())) - .Returns(typeInfo.Assembly); + .Returns(type.Assembly); // We need to mock TestPluginCache because we have to create assembly resolver instance // using SetupAssemblyResolver method, we don't use any other method of class(like DiscoverTestExtensions etc...) // that fire creation TestableTestPluginCache testablePlugin = new(); - testablePlugin.SetupAssemblyResolver(typeInfo.Assembly.Location); + testablePlugin.SetupAssemblyResolver(type.Assembly.Location); _inProcDataCollector = new InProcDataCollector( - typeInfo.Assembly.Location, + type.Assembly.Location, "Coverlet.Collector.DataCollection.CoverletInProcDataCollector, coverlet.collector, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", - typeof(InProcDataCollection).GetTypeInfo(), + typeof(InProcDataCollection), string.Empty, _assemblyLoadContext.Object, testablePlugin); Assert.IsNotNull(_inProcDataCollector.AssemblyQualifiedName); - Assert.AreEqual(_inProcDataCollector.AssemblyQualifiedName, typeInfo.AssemblyQualifiedName); + Assert.AreEqual(_inProcDataCollector.AssemblyQualifiedName, type.AssemblyQualifiedName); } private class TestableInProcDataCollector : InProcDataCollection diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/ProxyDataCollectionManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/ProxyDataCollectionManagerTests.cs index d0f1629b56..f1f1a41428 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/ProxyDataCollectionManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/ProxyDataCollectionManagerTests.cs @@ -160,7 +160,7 @@ public void BeforeTestRunStartShouldPassRunSettingsWithExtensionsFolderUpdatedAs var result = _proxyDataCollectionManager.BeforeTestRunStart(true, true, null); - var extensionsFolderPath = Path.Combine(Path.GetDirectoryName(typeof(ITestPlatform).GetTypeInfo().Assembly.Location)!, "Extensions"); + var extensionsFolderPath = Path.Combine(Path.GetDirectoryName(typeof(ITestPlatform).Assembly.Location)!, "Extensions"); var expectedSettingsXml = $"{extensionsFolderPath}"; _mockDataCollectionRequestSender.Verify( x => x.SendBeforeTestRunStartAndGetResult(expectedSettingsXml, sourceList, true, It.IsAny()), Times.Once); diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscovererEnumeratorTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscovererEnumeratorTests.cs index 20c276ee28..4c06a6787c 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscovererEnumeratorTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscovererEnumeratorTests.cs @@ -50,7 +50,7 @@ public DiscovererEnumeratorTests() _discovererEnumerator = new DiscovererEnumerator(_mockRequestData.Object, _discoveryResultCache, _mockTestPlatformEventSource.Object, _mockAssemblyProperties.Object, _cancellationTokenSource.Token); _runSettingsMock = new Mock(); _messageLoggerMock = new Mock(); - TestPluginCacheHelper.SetupMockExtensions(new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, + TestPluginCacheHelper.SetupMockExtensions(new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, () => { }); TestDiscoveryExtensionManager.Destroy(); } @@ -71,9 +71,9 @@ public void Cleanup() public void LoadTestsShouldReportWarningOnNoDiscoverers() { TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(TestPluginCache).GetTypeInfo().Assembly.Location }, + new string[] { typeof(TestPluginCache).Assembly.Location }, () => { }); - var sources = new List { typeof(DiscoveryResultCacheTests).GetTypeInfo().Assembly.Location }; + var sources = new List { typeof(DiscoveryResultCacheTests).Assembly.Location }; var extensionSourceMap = new Dictionary> { @@ -91,7 +91,7 @@ public void LoadTestsShouldReportWarningOnNoDiscoverers() public void LoadTestsShouldNotCallIntoDiscoverersIfNoneMatchesSources() { TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, + new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, () => { }); var sources = new List { "temp.jpeg" }; @@ -116,7 +116,7 @@ public void LoadTestsShouldNotCallIntoDiscoverersIfNoneMatchesSources() public void LoadTestsShouldCallOnlyNativeDiscovererIfNativeAssembliesPassed() { TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, + new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, () => { }); _mockAssemblyProperties.Setup(pe => pe.GetAssemblyType("native.dll")).Returns(AssemblyType.Native); @@ -151,7 +151,7 @@ public void LoadTestsShouldCallOnlyNativeDiscovererIfNativeAssembliesPassed() public void LoadTestsShouldCallOnlyManagedDiscovererIfManagedAssembliesPassed() { TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, + new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, () => { }); _mockAssemblyProperties.Setup(pe => pe.GetAssemblyType("managed.dll")).Returns(AssemblyType.Managed); @@ -186,7 +186,7 @@ public void LoadTestsShouldCallOnlyManagedDiscovererIfManagedAssembliesPassed() public void LoadTestsShouldCallBothNativeAndManagedDiscoverersWithCorrectSources() { TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, + new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, () => { }); _mockAssemblyProperties.Setup(pe => pe.GetAssemblyType("native.dll")).Returns(AssemblyType.Native); @@ -229,13 +229,13 @@ public void LoadTestsShouldCallBothNativeAndManagedDiscoverersWithCorrectSources public void LoadTestsShouldCallIntoADiscovererThatMatchesTheSources() { TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, + new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, () => { }); var sources = new List { - typeof(DiscoveryResultCacheTests).GetTypeInfo().Assembly.Location, - typeof(DiscoveryResultCacheTests).GetTypeInfo().Assembly.Location + typeof(DiscoveryResultCacheTests).Assembly.Location, + typeof(DiscoveryResultCacheTests).Assembly.Location }; var extensionSourceMap = new Dictionary> @@ -270,13 +270,13 @@ public void LoadTestsShouldCallIntoADiscovererThatMatchesTheSources() public void LoadTestsShouldCallIntoMultipleDiscoverersThatMatchesTheSources() { TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, + new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, () => { }); var dllsources = new List { - typeof(DiscoveryResultCacheTests).GetTypeInfo().Assembly.Location, - typeof(DiscoveryResultCacheTests).GetTypeInfo().Assembly.Location + typeof(DiscoveryResultCacheTests).Assembly.Location, + typeof(DiscoveryResultCacheTests).Assembly.Location }; var jsonsources = new List @@ -351,13 +351,13 @@ public void LoadTestsShouldCallIntoMultipleDiscoverersThatMatchesTheSources() public void LoadTestsShouldCallIntoOtherDiscoverersWhenCreatingOneFails() { TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, + new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, () => { }); var sources = new List { "test1.csv", - typeof(DiscoveryResultCacheTests).GetTypeInfo().Assembly.Location + typeof(DiscoveryResultCacheTests).Assembly.Location }; var extensionSourceMap = new Dictionary> @@ -395,13 +395,13 @@ public void LoadTestsShouldCallIntoOtherDiscoverersWhenCreatingOneFails() public void LoadTestsShouldCallIntoOtherDiscoverersEvenIfDiscoveryInOneFails() { TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, + new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, () => { }); var sources = new List { "test1.cs", - typeof(DiscoveryResultCacheTests).GetTypeInfo().Assembly.Location + typeof(DiscoveryResultCacheTests).Assembly.Location }; var extensionSourceMap = new Dictionary> @@ -450,13 +450,13 @@ public void LoadTestsShouldCollectMetrics() }; TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, + new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, () => { }); var sources = new List { - typeof(DiscoveryResultCacheTests).GetTypeInfo().Assembly.Location, - typeof(DiscoveryResultCacheTests).GetTypeInfo().Assembly.Location + typeof(DiscoveryResultCacheTests).Assembly.Location, + typeof(DiscoveryResultCacheTests).Assembly.Location }; var extensionSourceMap = new Dictionary> @@ -485,13 +485,13 @@ public void LoadTestsShouldCollectMetrics() public void LoadTestsShouldNotCallIntoDiscoverersWhenCancelled() { // Setup - string[] extensions = new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }; + string[] extensions = new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }; TestPluginCacheHelper.SetupMockExtensions(extensions, () => { }); var dllsources = new List { - typeof(DiscoveryResultCacheTests).GetTypeInfo().Assembly.Location, - typeof(DiscoveryResultCacheTests).GetTypeInfo().Assembly.Location + typeof(DiscoveryResultCacheTests).Assembly.Location, + typeof(DiscoveryResultCacheTests).Assembly.Location }; var jsonsources = new List { @@ -573,13 +573,13 @@ public void LoadTestShouldInstrumentAdapterDiscoveryStop() public void LoadTestsShouldIterateOverAllExtensionsInTheMapAndDiscoverTests() { TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, + new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, () => { }); var dllsources = new List { - typeof(DiscoveryResultCacheTests).GetTypeInfo().Assembly.Location, - typeof(DiscoveryResultCacheTests).GetTypeInfo().Assembly.Location + typeof(DiscoveryResultCacheTests).Assembly.Location, + typeof(DiscoveryResultCacheTests).Assembly.Location }; var jsonsources = new List { @@ -589,7 +589,7 @@ public void LoadTestsShouldIterateOverAllExtensionsInTheMapAndDiscoverTests() var extensionSourceMap = new Dictionary> { - { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location, jsonsources }, + { typeof(DiscovererEnumeratorTests).Assembly.Location, jsonsources }, { "_none_", dllsources } }; @@ -683,8 +683,8 @@ private static void SetupForNoTestsAvailableInGivenAssemblies( out Dictionary> extensionSourceMap, out string sourcesString) { - var crossPlatEngineAssemblyLocation = typeof(DiscovererEnumerator).GetTypeInfo().Assembly.Location; - var objectModelAseeAssemblyLocation = typeof(TestCase).GetTypeInfo().Assembly.Location; + var crossPlatEngineAssemblyLocation = typeof(DiscovererEnumerator).Assembly.Location; + var objectModelAseeAssemblyLocation = typeof(TestCase).Assembly.Location; var sources = new string[] { crossPlatEngineAssemblyLocation, objectModelAseeAssemblyLocation }; extensionSourceMap = new Dictionary> @@ -697,12 +697,12 @@ private static void SetupForNoTestsAvailableInGivenAssemblies( private void InvokeLoadTestWithMockSetup() { TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, + new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, () => { }); var sources = new List { - typeof(DiscoveryResultCacheTests).GetTypeInfo().Assembly.Location + typeof(DiscoveryResultCacheTests).Assembly.Location }; var extensionSourceMap = new Dictionary> diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscoveryManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscoveryManagerTests.cs index 92d9b539fe..2162e8975b 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscoveryManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscoveryManagerTests.cs @@ -60,7 +60,7 @@ public void InitializeShouldUpdateAdditionalExtenions() TestPluginCache.Instance = new TestableTestPluginCache(); _discoveryManager.Initialize( - new string[] { typeof(DiscoveryManagerTests).GetTypeInfo().Assembly.Location }, mockLogger.Object); + new string[] { typeof(DiscoveryManagerTests).Assembly.Location }, mockLogger.Object); var allDiscoverers = TestDiscoveryExtensionManager.Create().Discoverers; @@ -122,7 +122,7 @@ public void DiscoverTestsShouldLogIfTheSourceDoesNotExistIfItHasAPackage() var packageName = "recipe.AppxRecipe"; - var fakeDirectory = Directory.GetDirectoryRoot(typeof(DiscoveryManagerTests).GetTypeInfo().Assembly.Location); + var fakeDirectory = Directory.GetDirectoryRoot(typeof(DiscoveryManagerTests).Assembly.Location); criteria.Package = Path.Combine(fakeDirectory, Path.Combine(packageName)); var mockLogger = new Mock(); @@ -161,13 +161,13 @@ public void DiscoverTestsShouldLogIfThereAreNoValidSources() public void DiscoverTestsShouldLogIfTheSameSourceIsSpecifiedTwice() { TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, + new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, () => { }); var sources = new List { - typeof(DiscoveryManagerTests).GetTypeInfo().Assembly.Location, - typeof(DiscoveryManagerTests).GetTypeInfo().Assembly.Location + typeof(DiscoveryManagerTests).Assembly.Location, + typeof(DiscoveryManagerTests).Assembly.Location }; var criteria = new DiscoveryCriteria(sources, 100, null); @@ -188,12 +188,12 @@ public void DiscoverTestsShouldLogIfTheSameSourceIsSpecifiedTwice() public void DiscoverTestsShouldDiscoverTestsInTheSpecifiedSource() { TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, + new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, () => { }); var sources = new List { - typeof(DiscoveryManagerTests).GetTypeInfo().Assembly.Location + typeof(DiscoveryManagerTests).Assembly.Location }; var criteria = new DiscoveryCriteria(sources, 1, null); @@ -216,12 +216,12 @@ public void DiscoverTestsShouldSendMetricsOnDiscoveryComplete() DiscoveryCompleteEventArgs? receivedDiscoveryCompleteEventArgs = null; TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, + new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, () => { }); var sources = new List { - typeof(DiscoveryManagerTests).GetTypeInfo().Assembly.Location + typeof(DiscoveryManagerTests).Assembly.Location }; var mockLogger = new Mock(); @@ -254,12 +254,12 @@ public void DiscoverTestsShouldCollectMetrics() _mockRequestData.Setup(rd => rd.MetricsCollection).Returns(mockMetricsCollector.Object); TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(DiscovererEnumeratorTests).GetTypeInfo().Assembly.Location }, + new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, () => { }); var sources = new List { - typeof(DiscoveryManagerTests).GetTypeInfo().Assembly.Location + typeof(DiscoveryManagerTests).Assembly.Location }; var mockLogger = new Mock(); @@ -276,7 +276,7 @@ public void DiscoverTestsShouldCollectMetrics() [TestMethod] public void DiscoveryInitializeShouldVerifyWarningMessageIfAdapterFailedToLoad() { - var assemblyLocation = typeof(DiscoveryManagerTests).GetTypeInfo().Assembly.Location; + var assemblyLocation = typeof(DiscoveryManagerTests).Assembly.Location; var mockLogger = new Mock(); TestPluginCacheHelper.SetupMockExtensions( new string[] { assemblyLocation }, @@ -296,7 +296,7 @@ public void DiscoveryInitializeShouldVerifyWarningMessageIfAdapterFailedToLoad() public void DiscoveryTestsShouldSendAbortValuesCorrectlyIfAbortionHappened() { // Arrange - var sources = new List { typeof(DiscoveryManagerTests).GetTypeInfo().Assembly.Location }; + var sources = new List { typeof(DiscoveryManagerTests).Assembly.Location }; var criteria = new DiscoveryCriteria(sources, 100, null); var mockHandler = new Mock(); diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/BaseRunTestsTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/BaseRunTestsTests.cs index f1da1e0c02..db60a3184d 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/BaseRunTestsTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/BaseRunTestsTests.cs @@ -92,7 +92,7 @@ public BaseRunTestsTests() new PlatformThread(), _mockDataSerializer.Object); - TestPluginCacheHelper.SetupMockExtensions(new string[] { typeof(BaseRunTestsTests).GetTypeInfo().Assembly.Location }, () => { }); + TestPluginCacheHelper.SetupMockExtensions(new string[] { typeof(BaseRunTestsTests).Assembly.Location }, () => { }); } [TestCleanup] @@ -247,7 +247,7 @@ public void RunTestsShouldAbortIfExecutorUriExtensionMapIsNull() [TestMethod] public void RunTestsShouldInvokeTheTestExecutorIfAdapterAssemblyIsKnown() { - var assemblyLocation = typeof(BaseRunTestsTests).GetTypeInfo().Assembly.Location; + var assemblyLocation = typeof(BaseRunTestsTests).Assembly.Location; var executorUriExtensionMap = new List> { new Tuple(new Uri(BaseRunTestsExecutorUri), assemblyLocation) @@ -326,7 +326,7 @@ public void RunTestsShouldInstrumentAdapterExecutionStop() [TestMethod] public void RunTestsShouldReportAWarningIfExecutorUriIsNotDefinedInExtensionAssembly() { - var assemblyLocation = typeof(BaseRunTestsTests).GetTypeInfo().Assembly.Location; + var assemblyLocation = typeof(BaseRunTestsTests).Assembly.Location; var executorUriExtensionMap = new List> { new Tuple(new Uri("executor://nonexistent/"), assemblyLocation) @@ -362,7 +362,7 @@ public void RunTestsShouldReportAWarningIfExecutorUriIsNotDefinedInExtensionAsse [TestMethod] public void RunTestsShouldNotAddExecutorUriToExecutorUriListIfNoTestsAreRun() { - var assemblyLocation = typeof(BaseRunTestsTests).GetTypeInfo().Assembly.Location; + var assemblyLocation = typeof(BaseRunTestsTests).Assembly.Location; var executorUriExtensionMap = new List> { new Tuple(new Uri(BaseRunTestsExecutorUri), assemblyLocation) @@ -379,7 +379,7 @@ public void RunTestsShouldNotAddExecutorUriToExecutorUriListIfNoTestsAreRun() [TestMethod] public void RunTestsShouldAddExecutorUriToExecutorUriListIfExecutorHasRunTests() { - var assemblyLocation = typeof(BaseRunTestsTests).GetTypeInfo().Assembly.Location; + var assemblyLocation = typeof(BaseRunTestsTests).Assembly.Location; var executorUriExtensionMap = new List> { new Tuple(new Uri(BaseRunTestsExecutorUri), assemblyLocation) @@ -404,7 +404,7 @@ public void RunTestsShouldAddExecutorUriToExecutorUriListIfExecutorHasRunTests() [TestMethod] public void RunTestsShouldReportWarningIfExecutorThrowsAnException() { - var assemblyLocation = typeof(BaseRunTestsTests).GetTypeInfo().Assembly.Location; + var assemblyLocation = typeof(BaseRunTestsTests).Assembly.Location; var executorUriExtensionMap = new List> { new Tuple(new Uri(BaseRunTestsExecutorUri), assemblyLocation) @@ -435,7 +435,7 @@ public void RunTestsShouldReportWarningIfExecutorThrowsAnException() [TestMethod] public void RunTestsShouldNotFailOtherExecutorsRunIfOneExecutorThrowsAnException() { - var assemblyLocation = typeof(BaseRunTestsTests).GetTypeInfo().Assembly.Location; + var assemblyLocation = typeof(BaseRunTestsTests).Assembly.Location; var executorUriExtensionMap = new List> { new Tuple(new Uri(BadBaseRunTestsExecutorUri), assemblyLocation), @@ -468,7 +468,7 @@ public void RunTestsShouldNotFailOtherExecutorsRunIfOneExecutorThrowsAnException [TestMethod] public void RunTestsShouldIterateThroughAllExecutors() { - var assemblyLocation = typeof(BaseRunTestsTests).GetTypeInfo().Assembly.Location; + var assemblyLocation = typeof(BaseRunTestsTests).Assembly.Location; var executorUriExtensionMap = new List> { new Tuple(new Uri(BadBaseRunTestsExecutorUri), assemblyLocation), @@ -607,7 +607,7 @@ public void RunTestsShouldCloneTheTestResultsObjectsIfTestSourceIsPackage() public void RunTestsShouldNotifyItsImplementersOfAnyExceptionThrownByTheExecutors() { bool? isExceptionThrown = null; - var assemblyLocation = typeof(BaseRunTestsTests).GetTypeInfo().Assembly.Location; + var assemblyLocation = typeof(BaseRunTestsTests).Assembly.Location; var executorUriExtensionMap = new List> { new Tuple(new Uri(BaseRunTestsExecutorUri), assemblyLocation) @@ -627,7 +627,7 @@ public void RunTestsShouldNotifyItsImplementersOfAnyExceptionThrownByTheExecutor [TestMethod] public void RunTestsShouldReportLogMessagesFromExecutors() { - var assemblyLocation = typeof(BaseRunTestsTests).GetTypeInfo().Assembly.Location; + var assemblyLocation = typeof(BaseRunTestsTests).Assembly.Location; var executorUriExtensionMap = new List> { new Tuple(new Uri(BaseRunTestsExecutorUri), assemblyLocation) @@ -695,7 +695,7 @@ public void RunTestsShouldCollectMetrics() { { "DummyMessage", "DummyValue" } }; - var assemblyLocation = typeof(BaseRunTestsTests).GetTypeInfo().Assembly.Location; + var assemblyLocation = typeof(BaseRunTestsTests).Assembly.Location; var executorUriExtensionMap = new List> { new Tuple(new Uri(BadBaseRunTestsExecutorUri), assemblyLocation), @@ -810,8 +810,8 @@ private void SetupForExecutionThreadApartmentStateTests(PlatformApartmentState a _mockThread.Object, _mockDataSerializer.Object); - TestPluginCacheHelper.SetupMockExtensions(new string[] { typeof(BaseRunTestsTests).GetTypeInfo().Assembly.Location }, () => { }); - var assemblyLocation = typeof(BaseRunTestsTests).GetTypeInfo().Assembly.Location; + TestPluginCacheHelper.SetupMockExtensions(new string[] { typeof(BaseRunTestsTests).Assembly.Location }, () => { }); + var assemblyLocation = typeof(BaseRunTestsTests).Assembly.Location; var executorUriExtensionMap = new List> { new Tuple(new Uri(BaseRunTestsExecutorUri), assemblyLocation) @@ -845,7 +845,7 @@ private void SetUpTestRunEvents(string? package = null, bool setupHandleTestRunC new PlatformThread(), _mockDataSerializer.Object); - var assemblyLocation = typeof(BaseRunTestsTests).GetTypeInfo().Assembly.Location; + var assemblyLocation = typeof(BaseRunTestsTests).Assembly.Location; var executorUriExtensionMap = new List> { new Tuple(new Uri(BadBaseRunTestsExecutorUri), assemblyLocation), diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/ExecutionManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/ExecutionManagerTests.cs index 7dfec2e75a..6f9799a003 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/ExecutionManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/ExecutionManagerTests.cs @@ -76,7 +76,7 @@ public void TestCleanup() [TestMethod] public void InitializeShouldLoadAndInitializeAllExtensions() { - var commonAssemblyLocation = typeof(ExecutionManagerTests).GetTypeInfo().Assembly.Location; + var commonAssemblyLocation = typeof(ExecutionManagerTests).Assembly.Location; var mockTestMessageEventHandler = new Mock(); TestPluginCacheHelper.SetupMockExtensions( new string[] { commonAssemblyLocation }, @@ -141,7 +141,7 @@ public void InitializeShouldNotFailIfMetricsFieldIsNull() [TestMethod] public void StartTestRunShouldRunTestsInTheProvidedSources() { - var assemblyLocation = typeof(ExecutionManagerTests).GetTypeInfo().Assembly.Location; + var assemblyLocation = typeof(ExecutionManagerTests).Assembly.Location; TestPluginCacheHelper.SetupMockExtensions( new string[] { assemblyLocation }, () => { }); @@ -185,7 +185,7 @@ public void StartTestRunShouldRunTestsInTheProvidedSources() [TestMethod] public void StartTestRunShouldRunTestsForTheProvidedTests() { - var assemblyLocation = typeof(ExecutionManagerTests).GetTypeInfo().Assembly.Location; + var assemblyLocation = typeof(ExecutionManagerTests).Assembly.Location; var tests = new List { @@ -251,7 +251,7 @@ public void StartTestRunShouldAbortTheRunIfAnyExceptionComesForTheProvidedSource //[TestMethod] //public void InitializeShouldVerifyWarningMessageIfAdapterFailedToLoad() //{ - // var assemblyLocation = typeof(ExecutionManagerTests).GetTypeInfo().Assembly.Location; + // var assemblyLocation = typeof(ExecutionManagerTests).Assembly.Location; // var mockLogger = new Mock(); // TestPluginCacheHelper.SetupMockExtensions( // new string[] { assemblyLocation }, diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithSourcesTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithSourcesTests.cs index 4c1c64250f..6f2c0259ca 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithSourcesTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithSourcesTests.cs @@ -57,7 +57,7 @@ public RunTestsWithSourcesTests() _mockRequestData.Setup(rd => rd.MetricsCollection).Returns(_mockMetricsCollection.Object); TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(RunTestsWithSourcesTests).GetTypeInfo().Assembly.Location }, + new string[] { typeof(RunTestsWithSourcesTests).Assembly.Location }, () => { }); TestPluginCache.Instance.DiscoverTestExtensions(TestPlatformConstants.TestAdapterEndsWithPattern); @@ -128,7 +128,7 @@ public void GetExecutorUriExtensionMapShouldReturnEmptyOnInvalidSources() [TestMethod] public void GetExecutorUriExtensionMapShouldReturnDefaultExecutorUrisForTheDiscoverersDefined() { - var assemblyLocation = typeof(RunTestsWithSourcesTests).GetTypeInfo().Assembly.Location; + var assemblyLocation = typeof(RunTestsWithSourcesTests).Assembly.Location; var adapterSourceMap = new Dictionary> { @@ -188,7 +188,7 @@ public void InvokeExecutorShouldInvokeTestExecutorWithTheSources() [TestMethod] public void RunTestsShouldRunTestsForTheSourcesSpecified() { - var assemblyLocation = typeof(RunTestsWithSourcesTests).GetTypeInfo().Assembly.Location; + var assemblyLocation = typeof(RunTestsWithSourcesTests).Assembly.Location; var adapterSourceMap = new Dictionary> { @@ -312,9 +312,9 @@ public void SendSessionEndShouldCallSessionEnd() [MemberNotNull(nameof(_runTestsInstance))] private void SetupForNoTestsAvailable(string? testCaseFilter, out string sourcesString) { - var testAssemblyLocation = typeof(TestCase).GetTypeInfo().Assembly.Location; + var testAssemblyLocation = typeof(TestCase).Assembly.Location; - var adapterAssemblyLocation = typeof(RunTestsWithSourcesTests).GetTypeInfo().Assembly.Location; + var adapterAssemblyLocation = typeof(RunTestsWithSourcesTests).Assembly.Location; var adapterSourceMap = new Dictionary>(); diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestEngineTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestEngineTests.cs index 9ed67b2da8..d7db863d7a 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestEngineTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestEngineTests.cs @@ -32,7 +32,7 @@ public class TestEngineTests public TestEngineTests() { - TestPluginCacheHelper.SetupMockExtensions(new[] { typeof(TestEngineTests).GetTypeInfo().Assembly.Location }, () => { }); + TestPluginCacheHelper.SetupMockExtensions(new[] { typeof(TestEngineTests).Assembly.Location }, () => { }); _mockProcessHelper = new Mock(); _mockRequestData = new Mock(); _mockMetricsCollection = new Mock(); diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestExtensionManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestExtensionManagerTests.cs index 78503bb7f4..fb0e47a7b9 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestExtensionManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestExtensionManagerTests.cs @@ -33,7 +33,7 @@ public void TestCleanup() [TestMethod] public void UseAdditionalExtensionsShouldUpdateAdditionalExtensionsInCache() { - var extensions = new List { typeof(TestExtensionManagerTests).GetTypeInfo().Assembly.Location }; + var extensions = new List { typeof(TestExtensionManagerTests).Assembly.Location }; _testExtensionManager.UseAdditionalExtensions(extensions, true); diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestLoggerManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestLoggerManagerTests.cs index 0432df7c67..8c96225ea8 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestLoggerManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestLoggerManagerTests.cs @@ -37,7 +37,7 @@ public class TestLoggerManagerTests public void Initialize() { TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(TestLoggerManagerTests).GetTypeInfo().Assembly.Location }, + new string[] { typeof(TestLoggerManagerTests).Assembly.Location }, () => { }); } @@ -277,8 +277,6 @@ public void AddLoggerShouldAddDefaultLoggerParameterForTestLoggerWithParameters( var mockMetricsCollection = new Mock(); mockRequestData.Setup(rd => rd.MetricsCollection).Returns(mockMetricsCollection.Object); - var codeBase = typeof(TestLoggerManagerTests).GetTypeInfo().Assembly.Location; - string settingsXml = @" @@ -667,7 +665,7 @@ public void InitializeShouldInitializeLoggerFromAssemblyNameWhenAssemblyNameAndC mockRequestData.Setup(rd => rd.MetricsCollection).Returns(mockMetricsCollection.Object); var assemblyQualifiedName = typeof(ValidLoggerWithParameters).AssemblyQualifiedName; - var codeBase = typeof(TestLoggerManagerTests).GetTypeInfo().Assembly.Location; + var codeBase = typeof(TestLoggerManagerTests).Assembly.Location; string settingsXml = @" @@ -722,7 +720,7 @@ public void InitializeShouldNotInitializeLoggersFromAssemblyNameWhenInterfaceDoe mockRequestData.Setup(rd => rd.MetricsCollection).Returns(mockMetricsCollection.Object); var assemblyQualifiedName = typeof(InvalidLogger).AssemblyQualifiedName; - var codeBase = typeof(TestLoggerManagerTests).GetTypeInfo().Assembly.Location; + var codeBase = typeof(TestLoggerManagerTests).Assembly.Location; string settingsXml = @" @@ -774,7 +772,7 @@ public void InitializeShouldNotInitializeLoggersWhenCodeBaseInvalid() mockRequestData.Setup(rd => rd.MetricsCollection).Returns(mockMetricsCollection.Object); var assemblyQualifiedName = typeof(InvalidLogger).AssemblyQualifiedName; - var codeBase = typeof(TestLoggerManagerTests).GetTypeInfo().Assembly.Location; + var codeBase = typeof(TestLoggerManagerTests).Assembly.Location; string settingsXml = @" @@ -802,7 +800,7 @@ public void InitializeShouldInitializeLoggerOnceWhenMultipleLoggersWithSameAssem mockRequestData.Setup(rd => rd.MetricsCollection).Returns(mockMetricsCollection.Object); var assemblyQualifiedName = typeof(ValidLoggerWithParameters).AssemblyQualifiedName; - var codeBase = typeof(TestLoggerManagerTests).GetTypeInfo().Assembly.Location; + var codeBase = typeof(TestLoggerManagerTests).Assembly.Location; string settingsXml = @" @@ -833,7 +831,7 @@ public void InitializeShouldInitializeLoggerOnce() mockRequestData.Setup(rd => rd.MetricsCollection).Returns(mockMetricsCollection.Object); var assemblyQualifiedName = typeof(ValidLoggerWithParameters).AssemblyQualifiedName; - var codeBase = typeof(TestLoggerManagerTests).GetTypeInfo().Assembly.Location; + var codeBase = typeof(TestLoggerManagerTests).Assembly.Location; string settingsXml = @" @@ -865,7 +863,7 @@ public void InitializeShouldNotConsiderLoggerAsInitializedWhenInitializationErro mockRequestData.Setup(rd => rd.MetricsCollection).Returns(mockMetricsCollection.Object); var assemblyQualifiedName = typeof(LoggerWithInitializationError).AssemblyQualifiedName; - var codeBase = typeof(TestLoggerManagerTests).GetTypeInfo().Assembly.Location; + var codeBase = typeof(TestLoggerManagerTests).Assembly.Location; string settingsXml = @" @@ -891,7 +889,7 @@ public void InitializeShouldThrowWhenLoggerManagerAlreadyDisposed() mockRequestData.Setup(rd => rd.MetricsCollection).Returns(mockMetricsCollection.Object); var assemblyQualifiedName = typeof(ValidLoggerWithParameters).AssemblyQualifiedName; - var codeBase = typeof(TestLoggerManagerTests).GetTypeInfo().Assembly.Location; + var codeBase = typeof(TestLoggerManagerTests).Assembly.Location; string settingsXml = @" @@ -917,7 +915,7 @@ public void InitializeShouldInitilaizeMultipleLoggersIfPresent() mockRequestData.Setup(rd => rd.MetricsCollection).Returns(mockMetricsCollection.Object); var assemblyQualifiedName = typeof(ValidLoggerWithParameters).AssemblyQualifiedName; - var codeBase = typeof(TestLoggerManagerTests).GetTypeInfo().Assembly.Location; + var codeBase = typeof(TestLoggerManagerTests).Assembly.Location; string settingsXml = @" @@ -948,7 +946,7 @@ public void AreLoggersInitializedShouldReturnTrueWhenLoggersInitialized() mockRequestData.Setup(rd => rd.MetricsCollection).Returns(mockMetricsCollection.Object); var assemblyQualifiedName = typeof(ValidLoggerWithParameters).AssemblyQualifiedName; - var codeBase = typeof(TestLoggerManagerTests).GetTypeInfo().Assembly.Location; + var codeBase = typeof(TestLoggerManagerTests).Assembly.Location; string settingsXml = @" @@ -976,21 +974,6 @@ public void AreLoggersInitializedShouldReturnFalseWhenLoggersNotInitialized() var mockMetricsCollection = new Mock(); mockRequestData.Setup(rd => rd.MetricsCollection).Returns(mockMetricsCollection.Object); - var assemblyQualifiedName = typeof(ValidLoggerWithParameters).AssemblyQualifiedName; - var codeBase = typeof(TestLoggerManagerTests).GetTypeInfo().Assembly.Location; - - string settingsXml = - @" - - - - - - - - - "; - var testLoggerManager = new DummyTestLoggerManager(mockRequestData.Object); Assert.IsFalse(testLoggerManager.LoggersInitialized); @@ -1004,9 +987,6 @@ public void AreLoggersInitializedShouldReturnFalseWhenNoLoggersPresent() var mockMetricsCollection = new Mock(); mockRequestData.Setup(rd => rd.MetricsCollection).Returns(mockMetricsCollection.Object); - var assemblyQualifiedName = typeof(ValidLoggerWithParameters).AssemblyQualifiedName; - var codeBase = typeof(TestLoggerManagerTests).GetTypeInfo().Assembly.Location; - string settingsXml = @" @@ -1031,7 +1011,7 @@ public void InitializeShouldPassConfigurationElementAsParameters() mockRequestData.Setup(rd => rd.MetricsCollection).Returns(mockMetricsCollection.Object); var assemblyQualifiedName = typeof(ValidLoggerWithParameters).AssemblyQualifiedName; - var codeBase = typeof(TestLoggerManagerTests).GetTypeInfo().Assembly.Location; + var codeBase = typeof(TestLoggerManagerTests).Assembly.Location; string settingsXml = @" @@ -1071,7 +1051,7 @@ public void InitializeShouldSkipEmptyConfigurationValueInParameters() mockRequestData.Setup(rd => rd.MetricsCollection).Returns(mockMetricsCollection.Object); var assemblyQualifiedName = typeof(ValidLoggerWithParameters).AssemblyQualifiedName; - var codeBase = typeof(TestLoggerManagerTests).GetTypeInfo().Assembly.Location; + var codeBase = typeof(TestLoggerManagerTests).Assembly.Location; string settingsXml = @" @@ -1111,7 +1091,7 @@ public void InitializeShouldUseLastValueInParametersForDuplicateConfigurationVal mockRequestData.Setup(rd => rd.MetricsCollection).Returns(mockMetricsCollection.Object); var assemblyQualifiedName = typeof(ValidLoggerWithParameters).AssemblyQualifiedName; - var codeBase = typeof(TestLoggerManagerTests).GetTypeInfo().Assembly.Location; + var codeBase = typeof(TestLoggerManagerTests).Assembly.Location; string settingsXml = @" @@ -1152,7 +1132,7 @@ public void InitializeShouldNotInitializeDisabledLoggers() mockRequestData.Setup(rd => rd.MetricsCollection).Returns(mockMetricsCollection.Object); var assemblyQualifiedName = typeof(ValidLoggerWithParameters).AssemblyQualifiedName; - var codeBase = typeof(TestLoggerManagerTests).GetTypeInfo().Assembly.Location; + var codeBase = typeof(TestLoggerManagerTests).Assembly.Location; string settingsXml = @" @@ -1183,7 +1163,7 @@ public void InitializeShouldInitializeFromAssemblyNameIfAllAttributesPresent() mockRequestData.Setup(rd => rd.MetricsCollection).Returns(mockMetricsCollection.Object); var assemblyQualifiedName = typeof(ValidLoggerWithParameters).AssemblyQualifiedName; - var codeBase = typeof(TestLoggerManagerTests).GetTypeInfo().Assembly.Location; + var codeBase = typeof(TestLoggerManagerTests).Assembly.Location; string settingsXml = @" @@ -1221,7 +1201,7 @@ public void InitializeShouldInitializeFromUriIfUriAndNamePresent() var mockMetricsCollection = new Mock(); mockRequestData.Setup(rd => rd.MetricsCollection).Returns(mockMetricsCollection.Object); - var codeBase = typeof(TestLoggerManagerTests).GetTypeInfo().Assembly.Location; + var codeBase = typeof(TestLoggerManagerTests).Assembly.Location; string settingsXml = @" @@ -1259,7 +1239,7 @@ public void InitializeShouldInitializeFromUriIfUnableToFromAssemblyName() var mockMetricsCollection = new Mock(); mockRequestData.Setup(rd => rd.MetricsCollection).Returns(mockMetricsCollection.Object); - var codeBase = typeof(TestLoggerManagerTests).GetTypeInfo().Assembly.Location; + var codeBase = typeof(TestLoggerManagerTests).Assembly.Location; string settingsXml = @" @@ -1297,7 +1277,7 @@ public void InitializeShouldInitializeFromNameIfUnableToFromUri() var mockMetricsCollection = new Mock(); mockRequestData.Setup(rd => rd.MetricsCollection).Returns(mockMetricsCollection.Object); - var codeBase = typeof(TestLoggerManagerTests).GetTypeInfo().Assembly.Location; + var codeBase = typeof(TestLoggerManagerTests).Assembly.Location; string settingsXml = @" @@ -1335,7 +1315,7 @@ public void InitializeShouldInitializeLoggersWithTestRunDirectoryIfPresentInRunS var mockMetricsCollection = new Mock(); mockRequestData.Setup(rd => rd.MetricsCollection).Returns(mockMetricsCollection.Object); - var codeBase = typeof(TestLoggerManagerTests).GetTypeInfo().Assembly.Location; + var codeBase = typeof(TestLoggerManagerTests).Assembly.Location; string settingsXml = @" @@ -1380,7 +1360,7 @@ public void InitializeShouldInitializeLoggersWithDefaultTestRunDirectoryIfNotPre var mockMetricsCollection = new Mock(); mockRequestData.Setup(rd => rd.MetricsCollection).Returns(mockMetricsCollection.Object); - var codeBase = typeof(TestLoggerManagerTests).GetTypeInfo().Assembly.Location; + var codeBase = typeof(TestLoggerManagerTests).Assembly.Location; string settingsXml = @" @@ -1424,7 +1404,7 @@ public void InitializeShouldNotInitializeIfUnableToFromName() var mockMetricsCollection = new Mock(); mockRequestData.Setup(rd => rd.MetricsCollection).Returns(mockMetricsCollection.Object); - var codeBase = typeof(TestLoggerManagerTests).GetTypeInfo().Assembly.Location; + var codeBase = typeof(TestLoggerManagerTests).Assembly.Location; string settingsXml = @" diff --git a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs index cfe1ca37f5..f81737beb5 100644 --- a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs +++ b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs @@ -435,7 +435,7 @@ public void LaunchTestHostShouldSetExitCallbackInCaseCustomHost() [TestCategory("Windows")] public void GetTestSourcesShouldReturnAppropriateSourceIfAppxRecipeIsProvided() { - var sourcePath = Path.Combine(Path.GetDirectoryName(typeof(TestableTestHostManager).GetTypeInfo().Assembly.GetAssemblyLocation())!, @"..\..\..\..\..\test\TestAssets\UWPTestAssets\UnitTestApp8.build.appxrecipe"); + var sourcePath = Path.Combine(Path.GetDirectoryName(typeof(TestableTestHostManager).Assembly.GetAssemblyLocation())!, @"..\..\..\..\..\test\TestAssets\UWPTestAssets\UnitTestApp8.build.appxrecipe"); IEnumerable sources = _testHostManager.GetTestSources(new List { sourcePath }); Assert.IsTrue(sources.Any()); Assert.IsTrue(sources.First().EndsWith(".exe", StringComparison.OrdinalIgnoreCase)); @@ -445,7 +445,7 @@ public void GetTestSourcesShouldReturnAppropriateSourceIfAppxRecipeIsProvided() [TestCategory("Windows")] public void AppxManifestFileShouldReturnAppropriateSourceIfAppxManifestIsProvided() { - var appxManifestPath = Path.Combine(Path.GetDirectoryName(typeof(TestableTestHostManager).GetTypeInfo().Assembly.GetAssemblyLocation())!, @"..\..\..\..\..\test\TestAssets\UWPTestAssets\AppxManifest.xml"); + var appxManifestPath = Path.Combine(Path.GetDirectoryName(typeof(TestableTestHostManager).Assembly.GetAssemblyLocation())!, @"..\..\..\..\..\test\TestAssets\UWPTestAssets\AppxManifest.xml"); string? source = AppxManifestFile.GetApplicationExecutableName(appxManifestPath); Assert.AreEqual("UnitTestApp8.exe", source); } diff --git a/test/Microsoft.TestPlatform.TestUtilities/TestPluginCacheHelper.cs b/test/Microsoft.TestPlatform.TestUtilities/TestPluginCacheHelper.cs index 8ab04fccf5..b385d4ce44 100644 --- a/test/Microsoft.TestPlatform.TestUtilities/TestPluginCacheHelper.cs +++ b/test/Microsoft.TestPlatform.TestUtilities/TestPluginCacheHelper.cs @@ -18,7 +18,7 @@ public static class TestPluginCacheHelper public static TestableTestPluginCache SetupMockAdditionalPathExtensions(Type callingTest) { return SetupMockAdditionalPathExtensions( - new string[] { callingTest.GetTypeInfo().Assembly.Location }); + new string[] { callingTest.Assembly.Location }); } public static TestableTestPluginCache SetupMockAdditionalPathExtensions(string[] extensions) @@ -43,7 +43,7 @@ public static void SetupMockExtensions(Type callingTest, Mock? mock public static void SetupMockExtensions(Type callingTest, Action callback, Mock? mockFileHelper = null) { - SetupMockExtensions(new[] { callingTest.GetTypeInfo().Assembly.Location }, callback, mockFileHelper); + SetupMockExtensions(new[] { callingTest.Assembly.Location }, callback, mockFileHelper); } public static void SetupMockExtensions(string[] extensions, Action callback, Mock? mockFileHelper = null) diff --git a/test/Microsoft.TestPlatform.Utilities.UnitTests/ClientUtilitiesTests.cs b/test/Microsoft.TestPlatform.Utilities.UnitTests/ClientUtilitiesTests.cs index ecb2407bcf..413119ced6 100644 --- a/test/Microsoft.TestPlatform.Utilities.UnitTests/ClientUtilitiesTests.cs +++ b/test/Microsoft.TestPlatform.Utilities.UnitTests/ClientUtilitiesTests.cs @@ -36,7 +36,7 @@ public void FixRelativePathsInRunSettingsShouldNotModifyAnEmptyRunSettings() var doc = new XmlDocument(); doc.LoadXml(runSettingsXml); - var currentAssemblyLocation = typeof(ClientUtilitiesTests).GetTypeInfo().Assembly.Location; + var currentAssemblyLocation = typeof(ClientUtilitiesTests).Assembly.Location; ClientUtilities.FixRelativePathsInRunSettings(doc, currentAssemblyLocation); @@ -57,7 +57,7 @@ public void FixRelativePathsInRunSettingsShouldModifyRelativeTestSettingsFilePat var doc = new XmlDocument(); doc.LoadXml(runSettingsXml); - var currentAssemblyLocation = typeof(ClientUtilitiesTests).GetTypeInfo().Assembly.Location; + var currentAssemblyLocation = typeof(ClientUtilitiesTests).Assembly.Location; ClientUtilities.FixRelativePathsInRunSettings(doc, currentAssemblyLocation); @@ -84,7 +84,7 @@ public void FixRelativePathsInRunSettingsShouldNotModifyAbsoluteTestSettingsFile var doc = new XmlDocument(); doc.LoadXml(runSettingsXml); - var currentAssemblyLocation = typeof(ClientUtilitiesTests).GetTypeInfo().Assembly.Location; + var currentAssemblyLocation = typeof(ClientUtilitiesTests).Assembly.Location; ClientUtilities.FixRelativePathsInRunSettings(doc, currentAssemblyLocation); @@ -105,7 +105,7 @@ public void FixRelativePathsInRunSettingsShouldNotModifyEmptyTestSettingsFilePat var doc = new XmlDocument(); doc.LoadXml(runSettingsXml); - var currentAssemblyLocation = typeof(ClientUtilitiesTests).GetTypeInfo().Assembly.Location; + var currentAssemblyLocation = typeof(ClientUtilitiesTests).Assembly.Location; ClientUtilities.FixRelativePathsInRunSettings(doc, currentAssemblyLocation); @@ -126,7 +126,7 @@ public void FixRelativePathsInRunSettingsShouldModifyRelativeResultsDirectory() var doc = new XmlDocument(); doc.LoadXml(runSettingsXml); - var currentAssemblyLocation = typeof(ClientUtilitiesTests).GetTypeInfo().Assembly.Location; + var currentAssemblyLocation = typeof(ClientUtilitiesTests).Assembly.Location; ClientUtilities.FixRelativePathsInRunSettings(doc, currentAssemblyLocation); @@ -153,7 +153,7 @@ public void FixRelativePathsInRunSettingsShouldNotModifyAbsoluteResultsDirectory var doc = new XmlDocument(); doc.LoadXml(runSettingsXml); - var currentAssemblyLocation = typeof(ClientUtilitiesTests).GetTypeInfo().Assembly.Location; + var currentAssemblyLocation = typeof(ClientUtilitiesTests).Assembly.Location; ClientUtilities.FixRelativePathsInRunSettings(doc, currentAssemblyLocation); @@ -174,7 +174,7 @@ public void FixRelativePathsInRunSettingsShouldNotModifyEmptyResultsDirectory() var doc = new XmlDocument(); doc.LoadXml(runSettingsXml); - var currentAssemblyLocation = typeof(ClientUtilitiesTests).GetTypeInfo().Assembly.Location; + var currentAssemblyLocation = typeof(ClientUtilitiesTests).Assembly.Location; ClientUtilities.FixRelativePathsInRunSettings(doc, currentAssemblyLocation); @@ -200,7 +200,7 @@ public void FixRelativePathsInRunSettingsShouldExpandEnvironmentVariable() var doc = new XmlDocument(); doc.LoadXml(runSettingsXml); - var currentAssemblyLocation = typeof(ClientUtilitiesTests).GetTypeInfo().Assembly.Location; + var currentAssemblyLocation = typeof(ClientUtilitiesTests).Assembly.Location; ClientUtilities.FixRelativePathsInRunSettings(doc, currentAssemblyLocation); diff --git a/test/Microsoft.TestPlatform.Utilities.UnitTests/CodeCoverageRunSettingsProcessorTests.cs b/test/Microsoft.TestPlatform.Utilities.UnitTests/CodeCoverageRunSettingsProcessorTests.cs index 639ac46d43..e6023e99b7 100644 --- a/test/Microsoft.TestPlatform.Utilities.UnitTests/CodeCoverageRunSettingsProcessorTests.cs +++ b/test/Microsoft.TestPlatform.Utilities.UnitTests/CodeCoverageRunSettingsProcessorTests.cs @@ -227,7 +227,7 @@ public void MixedTestShouldCorrectlyAddMissingTags() private static XmlElement GetDefaultConfiguration() { var document = new XmlDocument(); - Assembly assembly = typeof(CodeCoverageRunSettingsProcessorTests).GetTypeInfo().Assembly; + Assembly assembly = typeof(CodeCoverageRunSettingsProcessorTests).Assembly; using (Stream stream = assembly.GetManifestResourceStream("Microsoft.TestPlatform.Utilities.UnitTests.DefaultCodeCoverageConfig.xml")!) { document.Load(stream); diff --git a/test/datacollector.PlatformTests/CommunicationLayerIntegrationTests.cs b/test/datacollector.PlatformTests/CommunicationLayerIntegrationTests.cs index 5be007cd7a..6c2b8ef679 100644 --- a/test/datacollector.PlatformTests/CommunicationLayerIntegrationTests.cs +++ b/test/datacollector.PlatformTests/CommunicationLayerIntegrationTests.cs @@ -38,7 +38,7 @@ public CommunicationLayerIntegrationTests() _mockRequestData = new Mock(); _mockMetricsCollection = new Mock(); _mockRequestData.Setup(rd => rd.MetricsCollection).Returns(_mockMetricsCollection.Object); - _dataCollectorSettings = string.Format(CultureInfo.InvariantCulture, "", typeof(CustomDataCollector).AssemblyQualifiedName, typeof(CustomDataCollector).GetTypeInfo().Assembly.Location); + _dataCollectorSettings = string.Format(CultureInfo.InvariantCulture, "", typeof(CustomDataCollector).AssemblyQualifiedName, typeof(CustomDataCollector).Assembly.Location); _runSettings = string.Format(CultureInfo.InvariantCulture, _defaultRunSettings, _dataCollectorSettings); _testSources = new List() { "testsource1.dll" }; _processHelper = new ProcessHelper(); diff --git a/test/datacollector.UnitTests/DataCollectionManagerTests.cs b/test/datacollector.UnitTests/DataCollectionManagerTests.cs index cd4fabb017..4edf16020c 100644 --- a/test/datacollector.UnitTests/DataCollectionManagerTests.cs +++ b/test/datacollector.UnitTests/DataCollectionManagerTests.cs @@ -47,7 +47,7 @@ public DataCollectionManagerTests() _mockDataCollector.As().Setup(x => x.GetTestExecutionEnvironmentVariables()).Returns(_envVarList); _mockCodeCoverageDataCollector = new Mock(); _mockCodeCoverageDataCollector.As().Setup(x => x.GetTestExecutionEnvironmentVariables()).Returns(_codeCoverageEnvVarList); - _dataCollectorSettings = string.Format(CultureInfo.InvariantCulture, _defaultRunSettings, string.Format(CultureInfo.InvariantCulture, _defaultDataCollectionSettings, _friendlyName, _uri, _mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); + _dataCollectorSettings = string.Format(CultureInfo.InvariantCulture, _defaultRunSettings, string.Format(CultureInfo.InvariantCulture, _defaultDataCollectionSettings, _friendlyName, _uri, _mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).Assembly.Location, string.Empty)); _mockMessageSink = new Mock(); _mockDataCollectionAttachmentManager = new Mock(); _mockDataCollectionAttachmentManager.SetReturnsDefault(new List()); @@ -74,7 +74,7 @@ public void InitializeDataCollectorsShouldReturnEmptyDictionaryIfDataCollectorsA [TestMethod] public void InitializeDataCollectorsShouldLoadDataCollector() { - var dataCollectorSettings = string.Format(CultureInfo.InvariantCulture, _defaultRunSettings, string.Format(CultureInfo.InvariantCulture, _defaultDataCollectionSettings, _friendlyName, _uri, _mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); + var dataCollectorSettings = string.Format(CultureInfo.InvariantCulture, _defaultRunSettings, string.Format(CultureInfo.InvariantCulture, _defaultDataCollectionSettings, _friendlyName, _uri, _mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).Assembly.Location, string.Empty)); _dataCollectionManager.InitializeDataCollectors(dataCollectorSettings); Assert.IsTrue(_dataCollectionManager.RunDataCollectors.ContainsKey(_mockDataCollector.Object.GetType())); @@ -86,7 +86,7 @@ public void InitializeDataCollectorsShouldLoadDataCollector() [TestMethod] public void InitializeShouldNotAddDataCollectorIfItIsDisabled() { - var dataCollectorSettingsDisabled = string.Format(CultureInfo.InvariantCulture, _defaultRunSettings, string.Format(CultureInfo.InvariantCulture, _defaultDataCollectionSettings, _friendlyName, _uri, _mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, "enabled=\"false\"")); + var dataCollectorSettingsDisabled = string.Format(CultureInfo.InvariantCulture, _defaultRunSettings, string.Format(CultureInfo.InvariantCulture, _defaultDataCollectionSettings, _friendlyName, _uri, _mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).Assembly.Location, "enabled=\"false\"")); _dataCollectionManager.InitializeDataCollectors(dataCollectorSettingsDisabled); Assert.AreEqual(0, _dataCollectionManager.RunDataCollectors.Count); @@ -96,7 +96,7 @@ public void InitializeShouldNotAddDataCollectorIfItIsDisabled() [TestMethod] public void InitializeShouldAddDataCollectorIfItIsEnabled() { - var dataCollectorSettingsEnabled = string.Format(CultureInfo.InvariantCulture, _defaultRunSettings, string.Format(CultureInfo.InvariantCulture, _defaultDataCollectionSettings, _friendlyName, _uri, _mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, "enabled=\"true\"")); + var dataCollectorSettingsEnabled = string.Format(CultureInfo.InvariantCulture, _defaultRunSettings, string.Format(CultureInfo.InvariantCulture, _defaultDataCollectionSettings, _friendlyName, _uri, _mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).Assembly.Location, "enabled=\"true\"")); _dataCollectionManager.InitializeDataCollectors(dataCollectorSettingsEnabled); Assert.IsTrue(_dataCollectionManager.RunDataCollectors.ContainsKey(_mockDataCollector.Object.GetType())); @@ -106,7 +106,7 @@ public void InitializeShouldAddDataCollectorIfItIsEnabled() [TestMethod] public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsNotCorrectAndUriIsCorrect() { - var dataCollectorSettingsWithWrongFriendlyName = string.Format(CultureInfo.InvariantCulture, _defaultRunSettings, string.Format(CultureInfo.InvariantCulture, _defaultDataCollectionSettings, "anyFriendlyName", _uri, _mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); + var dataCollectorSettingsWithWrongFriendlyName = string.Format(CultureInfo.InvariantCulture, _defaultRunSettings, string.Format(CultureInfo.InvariantCulture, _defaultDataCollectionSettings, "anyFriendlyName", _uri, _mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).Assembly.Location, string.Empty)); _dataCollectionManager.InitializeDataCollectors(dataCollectorSettingsWithWrongFriendlyName); Assert.AreEqual(1, _dataCollectionManager.RunDataCollectors.Count); @@ -116,7 +116,7 @@ public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsNotCo [TestMethod] public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsCorrectAndUriIsNotCorrect() { - var dataCollectorSettingsWithWrongUri = string.Format(CultureInfo.InvariantCulture, _defaultRunSettings, string.Format(CultureInfo.InvariantCulture, _defaultDataCollectionSettings, _friendlyName, "my://custom/WrongDatacollector", _mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); + var dataCollectorSettingsWithWrongUri = string.Format(CultureInfo.InvariantCulture, _defaultRunSettings, string.Format(CultureInfo.InvariantCulture, _defaultDataCollectionSettings, _friendlyName, "my://custom/WrongDatacollector", _mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).Assembly.Location, string.Empty)); _dataCollectionManager.InitializeDataCollectors(dataCollectorSettingsWithWrongUri); Assert.AreEqual(1, _dataCollectionManager.RunDataCollectors.Count); @@ -126,7 +126,7 @@ public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsCorre [TestMethod] public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsNullAndUriIsCorrect() { - var dataCollectorSettingsWithNullFriendlyName = string.Format(CultureInfo.InvariantCulture, _defaultRunSettings, string.Format(CultureInfo.InvariantCulture, _defaultDataCollectionSettings, string.Empty, _uri, _mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty).Replace("friendlyName=\"\"", string.Empty)); + var dataCollectorSettingsWithNullFriendlyName = string.Format(CultureInfo.InvariantCulture, _defaultRunSettings, string.Format(CultureInfo.InvariantCulture, _defaultDataCollectionSettings, string.Empty, _uri, _mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).Assembly.Location, string.Empty).Replace("friendlyName=\"\"", string.Empty)); _dataCollectionManager.InitializeDataCollectors(dataCollectorSettingsWithNullFriendlyName); Assert.AreEqual(1, _dataCollectionManager.RunDataCollectors.Count); @@ -136,21 +136,21 @@ public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsNullA [TestMethod] public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsCorrectAndUriIsEmpty() { - var dataCollectorSettingsWithEmptyUri = string.Format(CultureInfo.InvariantCulture, _defaultRunSettings, string.Format(CultureInfo.InvariantCulture, _defaultDataCollectionSettings, _friendlyName, string.Empty, _mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); + var dataCollectorSettingsWithEmptyUri = string.Format(CultureInfo.InvariantCulture, _defaultRunSettings, string.Format(CultureInfo.InvariantCulture, _defaultDataCollectionSettings, _friendlyName, string.Empty, _mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).Assembly.Location, string.Empty)); Assert.ThrowsException(() => _dataCollectionManager.InitializeDataCollectors(dataCollectorSettingsWithEmptyUri)); } [TestMethod] public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsEmptyAndUriIsCorrect() { - var dataCollectorSettingsWithEmptyFriendlyName = string.Format(CultureInfo.InvariantCulture, _defaultRunSettings, string.Format(CultureInfo.InvariantCulture, _defaultDataCollectionSettings, _friendlyName, string.Empty, _mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); + var dataCollectorSettingsWithEmptyFriendlyName = string.Format(CultureInfo.InvariantCulture, _defaultRunSettings, string.Format(CultureInfo.InvariantCulture, _defaultDataCollectionSettings, _friendlyName, string.Empty, _mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).Assembly.Location, string.Empty)); Assert.ThrowsException(() => _dataCollectionManager.InitializeDataCollectors(dataCollectorSettingsWithEmptyFriendlyName)); } [TestMethod] public void InitializeDataCollectorsShouldNotLoadDataCollectorIfFriendlyNameIsNotCorrectAndUriIsNotCorrect() { - var dataCollectorSettingsWithWrongFriendlyNameAndWrongUri = string.Format(CultureInfo.InvariantCulture, _defaultRunSettings, string.Format(CultureInfo.InvariantCulture, _defaultDataCollectionSettings, "anyFriendlyName", "datacollector://data", _mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); + var dataCollectorSettingsWithWrongFriendlyNameAndWrongUri = string.Format(CultureInfo.InvariantCulture, _defaultRunSettings, string.Format(CultureInfo.InvariantCulture, _defaultDataCollectionSettings, "anyFriendlyName", "datacollector://data", _mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).Assembly.Location, string.Empty)); _dataCollectionManager.InitializeDataCollectors(dataCollectorSettingsWithWrongFriendlyNameAndWrongUri); Assert.AreEqual(0, _dataCollectionManager.RunDataCollectors.Count); @@ -160,7 +160,7 @@ public void InitializeDataCollectorsShouldNotLoadDataCollectorIfFriendlyNameIsNo [TestMethod] public void InitializeDataCollectorsShouldNotAddSameDataCollectorMoreThanOnce() { - var datacollecterSettings = string.Format(CultureInfo.InvariantCulture, _defaultDataCollectionSettings, "CustomDataCollector", "my://custom/datacollector", _mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, "enabled =\"true\""); + var datacollecterSettings = string.Format(CultureInfo.InvariantCulture, _defaultDataCollectionSettings, "CustomDataCollector", "my://custom/datacollector", _mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).Assembly.Location, "enabled =\"true\""); var runSettings = string.Format(CultureInfo.InvariantCulture, _defaultRunSettings, datacollecterSettings + datacollecterSettings); _dataCollectionManager.InitializeDataCollectors(runSettings); @@ -234,8 +234,8 @@ public void InitializeDataCollectorsShouldReturnOtherThanCodeCoverageEnvironment _codeCoverageEnvVarList.Add(new KeyValuePair("same_key", "same_value")); _dataCollectorSettings = string.Format(CultureInfo.InvariantCulture, _defaultRunSettings, - string.Format(CultureInfo.InvariantCulture, _defaultDataCollectionSettings, "Code Coverage", "my://custom/ccdatacollector", _mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty) + - string.Format(CultureInfo.InvariantCulture, _defaultDataCollectionSettings, _friendlyName, _uri, _mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); + string.Format(CultureInfo.InvariantCulture, _defaultDataCollectionSettings, "Code Coverage", "my://custom/ccdatacollector", _mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).Assembly.Location, string.Empty) + + string.Format(CultureInfo.InvariantCulture, _defaultDataCollectionSettings, _friendlyName, _uri, _mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).Assembly.Location, string.Empty)); var result = _dataCollectionManager.InitializeDataCollectors(_dataCollectorSettings); @@ -341,7 +341,7 @@ public void SessionEndedShouldReturnEmptyCollectionIfDataCollectionIsNotEnabled( [TestMethod] public void GetInvokedDataCollectorsShouldReturnDataCollector() { - var dataCollectorSettingsWithNullFriendlyName = string.Format(CultureInfo.InvariantCulture, _defaultRunSettings, string.Format(CultureInfo.InvariantCulture, _defaultDataCollectionSettings, string.Empty, _uri, _mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty).Replace("friendlyName=\"\"", string.Empty)); + var dataCollectorSettingsWithNullFriendlyName = string.Format(CultureInfo.InvariantCulture, _defaultRunSettings, string.Format(CultureInfo.InvariantCulture, _defaultDataCollectionSettings, string.Empty, _uri, _mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).Assembly.Location, string.Empty).Replace("friendlyName=\"\"", string.Empty)); _dataCollectionManager.InitializeDataCollectors(dataCollectorSettingsWithNullFriendlyName); var invokedDataCollector = _dataCollectionManager.GetInvokedDataCollectors(); Assert.AreEqual(1, invokedDataCollector.Count); diff --git a/test/vstest.console.UnitTests/ExecutorUnitTests.cs b/test/vstest.console.UnitTests/ExecutorUnitTests.cs index 3005e86e2f..d26c3934c2 100644 --- a/test/vstest.console.UnitTests/ExecutorUnitTests.cs +++ b/test/vstest.console.UnitTests/ExecutorUnitTests.cs @@ -41,7 +41,7 @@ public void ExecutorPrintsSplashScreenTest() { var mockOutput = new MockOutput(); var exitCode = new Executor(mockOutput, _mockTestPlatformEventSource.Object, new ProcessHelper(), new PlatformEnvironment()).Execute("/badArgument"); - var assemblyVersion = typeof(Executor).GetTypeInfo().Assembly.GetCustomAttribute()!.InformationalVersion; + var assemblyVersion = typeof(Executor).Assembly.GetCustomAttribute()!.InformationalVersion; Assert.AreEqual(1, exitCode, "Exit code must be One for bad arguments"); @@ -331,7 +331,7 @@ public void ExecutorShouldPrintWarningIfRunningEmulatedOnARM64() environment.Setup(x => x.Architecture).Returns(PlatformArchitecture.ARM64); var exitCode = new Executor(mockOutput, _mockTestPlatformEventSource.Object, processHelper.Object, environment.Object).Execute(); - var assemblyVersion = typeof(Executor).GetTypeInfo().Assembly.GetCustomAttribute()!.InformationalVersion; + var assemblyVersion = typeof(Executor).Assembly.GetCustomAttribute()!.InformationalVersion; Assert.AreEqual(5, mockOutput.Messages.Count); Assert.AreEqual("vstest.console.exe is running in emulated mode as x64. For better performance, please consider using the native runner vstest.console.arm64.exe.", @@ -351,7 +351,7 @@ public void ExecutorShouldPrintRunnerArchitecture() environment.Setup(x => x.Architecture).Returns(PlatformArchitecture.X64); var exitCode = new Executor(mockOutput, _mockTestPlatformEventSource.Object, processHelper.Object, environment.Object).Execute(); - var assemblyVersion = typeof(Executor).GetTypeInfo().Assembly.GetCustomAttribute()!.InformationalVersion; + var assemblyVersion = typeof(Executor).Assembly.GetCustomAttribute()!.InformationalVersion; Assert.AreEqual(4, mockOutput.Messages.Count); Assert.IsTrue(Regex.IsMatch(mockOutput.Messages[0].Message!, @"Microsoft \(R\) Test Execution Command Line Tool Version .* \(x64\)")); diff --git a/test/vstest.console.UnitTests/Processors/RunTestsArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/RunTestsArgumentProcessorTests.cs index 5168369a40..1841900ae2 100644 --- a/test/vstest.console.UnitTests/Processors/RunTestsArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/RunTestsArgumentProcessorTests.cs @@ -288,7 +288,7 @@ public static void SetupMockExtensions() mockFileHelper.Setup(fh => fh.DirectoryExists(It.IsAny())).Returns(true); mockFileHelper.Setup(fh => fh.EnumerateFiles(It.IsAny(), SearchOption.TopDirectoryOnly, new[] { ".dll" })) .Callback(() => { }) - .Returns(new string[] { typeof(RunTestsArgumentProcessorTests).GetTypeInfo().Assembly.Location, typeof(ConsoleLogger).GetTypeInfo().Assembly.Location }); + .Returns(new string[] { typeof(RunTestsArgumentProcessorTests).Assembly.Location, typeof(ConsoleLogger).Assembly.Location }); var testableTestPluginCache = new TestableTestPluginCache(); diff --git a/test/vstest.console.UnitTests/Processors/TestAdapterPathArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/TestAdapterPathArgumentProcessorTests.cs index c6fff696bd..f95c70f2f1 100644 --- a/test/vstest.console.UnitTests/Processors/TestAdapterPathArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/TestAdapterPathArgumentProcessorTests.cs @@ -134,7 +134,7 @@ public void InitializeShouldUpdateTestAdapterPathInRunSettings() var mockOutput = new Mock(); var executor = new TestAdapterPathArgumentExecutor(CommandLineOptions.Instance, RunSettingsManager.Instance, mockOutput.Object, new FileHelper()); - var currentAssemblyPath = typeof(TestAdapterPathArgumentExecutor).GetTypeInfo().Assembly.Location; + var currentAssemblyPath = typeof(TestAdapterPathArgumentExecutor).Assembly.Location; var currentFolder = Path.GetDirectoryName(currentAssemblyPath); executor.Initialize(currentFolder); diff --git a/test/vstest.console.UnitTests/Processors/Utilities/ArgumentProcessorFactoryTests.cs b/test/vstest.console.UnitTests/Processors/Utilities/ArgumentProcessorFactoryTests.cs index d0f922425e..06fd5682dd 100644 --- a/test/vstest.console.UnitTests/Processors/Utilities/ArgumentProcessorFactoryTests.cs +++ b/test/vstest.console.UnitTests/Processors/Utilities/ArgumentProcessorFactoryTests.cs @@ -162,9 +162,9 @@ public void BuildCommadMapsForMultipleProcessorAddsProcessorToAppropriateMaps() private static IEnumerable GetArgumentProcessors(bool specialCommandFilter) { - var allProcessors = typeof(ArgumentProcessorFactory).GetTypeInfo() + var allProcessors = typeof(ArgumentProcessorFactory) .Assembly.GetTypes() - .Where(t => !t.GetTypeInfo().IsAbstract && !t.Name.Equals("IArgumentProcessor") && typeof(IArgumentProcessor).IsAssignableFrom(t)); + .Where(t => !t.IsAbstract && !t.Name.Equals("IArgumentProcessor") && typeof(IArgumentProcessor).IsAssignableFrom(t)); foreach (var processor in allProcessors) { From 3687abc69b5ec8ab9ee8415afb6a23bcf4a31d91 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Tue, 6 Jun 2023 19:27:01 +1000 Subject: [PATCH 02/11] Update ProcessHelper.cs --- .../common/System/ProcessHelper.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/common/System/ProcessHelper.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/common/System/ProcessHelper.cs index c5797a9bfa..89ba1aca36 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/common/System/ProcessHelper.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/common/System/ProcessHelper.cs @@ -8,7 +8,6 @@ using System.Diagnostics; using System.Globalization; using System.IO; -using System.Reflection; using System.Threading; #if !NET5_0_OR_GREATER using System.Threading.Tasks; From e3cf50d11dd9ff7174d90313c900eebc7cfb82d2 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Tue, 6 Jun 2023 19:39:32 +1000 Subject: [PATCH 03/11] . --- src/Microsoft.TestPlatform.ObjectModel/TestObject.cs | 1 - .../TestProperty/TestProperty.cs | 1 - 2 files changed, 2 deletions(-) diff --git a/src/Microsoft.TestPlatform.ObjectModel/TestObject.cs b/src/Microsoft.TestPlatform.ObjectModel/TestObject.cs index fdf1972ab3..634fe33e5f 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/TestObject.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/TestObject.cs @@ -8,7 +8,6 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; -using System.Reflection; using System.Runtime.Serialization; using Microsoft.VisualStudio.TestPlatform.CoreUtilities; diff --git a/src/Microsoft.TestPlatform.ObjectModel/TestProperty/TestProperty.cs b/src/Microsoft.TestPlatform.ObjectModel/TestProperty/TestProperty.cs index 57ce97ef87..ed0e02b8be 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/TestProperty/TestProperty.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/TestProperty/TestProperty.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Globalization; -using System.Reflection; using System.Runtime.Serialization; using Microsoft.VisualStudio.TestPlatform.Utilities; From 128de0a21c313947bab1af6f97e444eaf80b13bd Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Tue, 6 Jun 2023 19:53:56 +1000 Subject: [PATCH 04/11] Update DefaultTestHostManager.cs --- .../Hosting/DefaultTestHostManager.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs index 1759c00013..6b42aa4caa 100644 --- a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs +++ b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs @@ -9,7 +9,6 @@ using System.Globalization; using System.IO; using System.Linq; -using System.Reflection; using System.Text; using System.Threading; using System.Threading.Tasks; From 73e6ae3d5b32081eeead8a3db4b22f73b1b0b261 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Tue, 6 Jun 2023 19:57:51 +1000 Subject: [PATCH 05/11] . --- .../DataCollection/DataCollectorConfig.cs | 1 - .../ExtensionFramework/Utilities/TestExtensions.cs | 1 - .../ExtensionFramework/Utilities/TestLoggerPluginInformation.cs | 1 - .../Utilities/TestSettingsProviderPluginInformation.cs | 1 - 4 files changed, 4 deletions(-) diff --git a/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectorConfig.cs b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectorConfig.cs index 615425a784..7c6019e525 100644 --- a/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectorConfig.cs +++ b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectorConfig.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Reflection; using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework.Utilities; using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection; diff --git a/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestExtensions.cs b/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestExtensions.cs index ddcbee1e29..e1f6c01ebc 100644 --- a/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestExtensions.cs +++ b/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestExtensions.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Reflection; using Microsoft.VisualStudio.TestPlatform.Common.DataCollector; using Microsoft.VisualStudio.TestPlatform.Common.Telemetry; diff --git a/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestLoggerPluginInformation.cs b/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestLoggerPluginInformation.cs index 2cb6ae2072..14b7e06105 100644 --- a/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestLoggerPluginInformation.cs +++ b/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestLoggerPluginInformation.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Reflection; using Microsoft.VisualStudio.TestPlatform.ObjectModel; diff --git a/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestSettingsProviderPluginInformation.cs b/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestSettingsProviderPluginInformation.cs index da61696432..3066bb52c8 100644 --- a/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestSettingsProviderPluginInformation.cs +++ b/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestSettingsProviderPluginInformation.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Reflection; using Microsoft.VisualStudio.TestPlatform.ObjectModel; From 6500e940ac7737933656ff126903c326098cbee3 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Tue, 6 Jun 2023 20:17:10 +1000 Subject: [PATCH 06/11] . --- .../Utilities/TestExtensionPluginInformation.cs | 1 - .../ExtensionFramework/TestPluginDiscovererTests.cs | 1 - .../ExtensionFramework/TestPluginManagerTests.cs | 1 - .../DataCollection/DotnetDataCollectionLauncherTests.cs | 1 - .../TestEngineTests.cs | 1 - .../TestLoggerManagerTests.cs | 1 - .../Hosting/DefaultTestHostManagerTests.cs | 1 - .../TestPluginCacheHelper.cs | 1 - .../CommunicationLayerIntegrationTests.cs | 1 - test/datacollector.UnitTests/DataCollectionManagerTests.cs | 1 - .../Processors/RunTestsArgumentProcessorTests.cs | 1 - .../Processors/TestAdapterPathArgumentProcessorTests.cs | 1 - .../Processors/Utilities/ArgumentProcessorFactoryTests.cs | 1 - 13 files changed, 13 deletions(-) diff --git a/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestExtensionPluginInformation.cs b/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestExtensionPluginInformation.cs index c5b9d4ef1c..14e9eea63e 100644 --- a/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestExtensionPluginInformation.cs +++ b/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestExtensionPluginInformation.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Reflection; using Microsoft.VisualStudio.TestPlatform.ObjectModel; diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginDiscovererTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginDiscovererTests.cs index 3aa8ba3970..15fdc0702a 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginDiscovererTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginDiscovererTests.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Reflection; using System.Threading; using System.Threading.Tasks; using System.Xml; diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginManagerTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginManagerTests.cs index 1234165df3..62682571f6 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginManagerTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginManagerTests.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Reflection; using Microsoft.TestPlatform.TestUtilities; using Microsoft.VisualStudio.TestPlatform.Common; diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/DotnetDataCollectionLauncherTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/DotnetDataCollectionLauncherTests.cs index 32d12e3d5b..205553eec3 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/DotnetDataCollectionLauncherTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/DotnetDataCollectionLauncherTests.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Globalization; using System.IO; -using System.Reflection; using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestEngineTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestEngineTests.cs index d7db863d7a..c20ae3f1c6 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestEngineTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestEngineTests.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Reflection; using Microsoft.TestPlatform.TestUtilities; using Microsoft.VisualStudio.TestPlatform.Common.Telemetry; diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestLoggerManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestLoggerManagerTests.cs index 8c96225ea8..c263627a84 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestLoggerManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestLoggerManagerTests.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using System.Reflection; using System.Threading; using Microsoft.TestPlatform.TestUtilities; diff --git a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs index f81737beb5..c38169246a 100644 --- a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs +++ b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs @@ -7,7 +7,6 @@ using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; -using System.Reflection; using System.Threading; using System.Threading.Tasks; diff --git a/test/Microsoft.TestPlatform.TestUtilities/TestPluginCacheHelper.cs b/test/Microsoft.TestPlatform.TestUtilities/TestPluginCacheHelper.cs index b385d4ce44..a36eee6046 100644 --- a/test/Microsoft.TestPlatform.TestUtilities/TestPluginCacheHelper.cs +++ b/test/Microsoft.TestPlatform.TestUtilities/TestPluginCacheHelper.cs @@ -3,7 +3,6 @@ using System; using System.Linq; -using System.Reflection; using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework; using Microsoft.VisualStudio.TestPlatform.Common.SettingsProvider; diff --git a/test/datacollector.PlatformTests/CommunicationLayerIntegrationTests.cs b/test/datacollector.PlatformTests/CommunicationLayerIntegrationTests.cs index 6c2b8ef679..0b9caa9c19 100644 --- a/test/datacollector.PlatformTests/CommunicationLayerIntegrationTests.cs +++ b/test/datacollector.PlatformTests/CommunicationLayerIntegrationTests.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.Diagnostics; using System.Globalization; -using System.Reflection; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.DataCollection; diff --git a/test/datacollector.UnitTests/DataCollectionManagerTests.cs b/test/datacollector.UnitTests/DataCollectionManagerTests.cs index 4edf16020c..8a4ba62b67 100644 --- a/test/datacollector.UnitTests/DataCollectionManagerTests.cs +++ b/test/datacollector.UnitTests/DataCollectionManagerTests.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Globalization; using System.IO; -using System.Reflection; using System.Threading; using System.Threading.Tasks; using System.Xml; diff --git a/test/vstest.console.UnitTests/Processors/RunTestsArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/RunTestsArgumentProcessorTests.cs index 1841900ae2..2ed759112b 100644 --- a/test/vstest.console.UnitTests/Processors/RunTestsArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/RunTestsArgumentProcessorTests.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Reflection; using System.Runtime.Versioning; using System.Threading.Tasks; diff --git a/test/vstest.console.UnitTests/Processors/TestAdapterPathArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/TestAdapterPathArgumentProcessorTests.cs index f95c70f2f1..8dd96a60ad 100644 --- a/test/vstest.console.UnitTests/Processors/TestAdapterPathArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/TestAdapterPathArgumentProcessorTests.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Reflection; using Microsoft.VisualStudio.TestPlatform.CommandLine.Processors; using Microsoft.VisualStudio.TestPlatform.Common; diff --git a/test/vstest.console.UnitTests/Processors/Utilities/ArgumentProcessorFactoryTests.cs b/test/vstest.console.UnitTests/Processors/Utilities/ArgumentProcessorFactoryTests.cs index 06fd5682dd..56b49def73 100644 --- a/test/vstest.console.UnitTests/Processors/Utilities/ArgumentProcessorFactoryTests.cs +++ b/test/vstest.console.UnitTests/Processors/Utilities/ArgumentProcessorFactoryTests.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Reflection; using Microsoft.VisualStudio.TestPlatform.CommandLine.Processors; using Microsoft.VisualStudio.TestPlatform.Utilities; From 920a3cd735667ae6311f3683c9da51e55198eef6 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Tue, 6 Jun 2023 20:20:51 +1000 Subject: [PATCH 07/11] . --- src/Microsoft.TestPlatform.Client/TestPlatform.cs | 1 - .../ExtensionFramework/Utilities/TestRunTimePluginInformation.cs | 1 - .../Utilities/InstallationContext.cs | 1 - .../DataCollection/DefaultDataCollectionLauncher.cs | 1 - .../DataCollection/DotnetDataCollectionLauncher.cs | 1 - .../DataCollection/InProcDataCollectionExtensionManager.cs | 1 - .../Execution/BaseRunTests.cs | 1 - src/vstest.console/TestPlatformHelpers/TestRequestManager.cs | 1 - .../ExtensionFramework/TestDiscoveryExtensionManagerTests.cs | 1 - .../ExtensionFramework/TestExecutorExtensionManagerTests.cs | 1 - .../ExtensionFramework/Utilities/TestExtensionsTests.cs | 1 - .../DataCollection/ProxyDataCollectionManagerTests.cs | 1 - .../Discovery/DiscovererEnumeratorTests.cs | 1 - .../Discovery/DiscoveryManagerTests.cs | 1 - .../Execution/BaseRunTestsTests.cs | 1 - .../Execution/ExecutionManagerTests.cs | 1 - .../Execution/RunTestsWithSourcesTests.cs | 1 - .../TestExtensionManagerTests.cs | 1 - .../ClientUtilitiesTests.cs | 1 - 19 files changed, 19 deletions(-) diff --git a/src/Microsoft.TestPlatform.Client/TestPlatform.cs b/src/Microsoft.TestPlatform.Client/TestPlatform.cs index 581c629ff9..b3e4d9df4c 100644 --- a/src/Microsoft.TestPlatform.Client/TestPlatform.cs +++ b/src/Microsoft.TestPlatform.Client/TestPlatform.cs @@ -6,7 +6,6 @@ using System.Globalization; using System.IO; using System.Linq; -using System.Reflection; using Microsoft.VisualStudio.TestPlatform.Client.Discovery; using Microsoft.VisualStudio.TestPlatform.Client.Execution; diff --git a/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestRunTimePluginInformation.cs b/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestRunTimePluginInformation.cs index 5dcf374ecd..52554b9197 100644 --- a/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestRunTimePluginInformation.cs +++ b/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestRunTimePluginInformation.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Reflection; using Microsoft.VisualStudio.TestPlatform.ObjectModel; diff --git a/src/Microsoft.TestPlatform.Common/Utilities/InstallationContext.cs b/src/Microsoft.TestPlatform.Common/Utilities/InstallationContext.cs index 5a3bdb5b3f..6c0c0bebaa 100644 --- a/src/Microsoft.TestPlatform.Common/Utilities/InstallationContext.cs +++ b/src/Microsoft.TestPlatform.Common/Utilities/InstallationContext.cs @@ -3,7 +3,6 @@ using System.Diagnostics.CodeAnalysis; using System.IO; -using System.Reflection; using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers.Interfaces; diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DefaultDataCollectionLauncher.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DefaultDataCollectionLauncher.cs index adbb6151ae..721d618432 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DefaultDataCollectionLauncher.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DefaultDataCollectionLauncher.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Reflection; using Microsoft.VisualStudio.TestPlatform.Common.Logging; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DotnetDataCollectionLauncher.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DotnetDataCollectionLauncher.cs index 5a5f0cedb9..b1d2c674eb 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DotnetDataCollectionLauncher.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DotnetDataCollectionLauncher.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.Globalization; using System.IO; -using System.Reflection; using Microsoft.VisualStudio.TestPlatform.Common.Logging; using Microsoft.VisualStudio.TestPlatform.CoreUtilities.Extensions; diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/InProcDataCollectionExtensionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/InProcDataCollectionExtensionManager.cs index cecdc7a0b1..89917eaa08 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/InProcDataCollectionExtensionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/InProcDataCollectionExtensionManager.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using System.Reflection; using System.Xml; using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework; diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/BaseRunTests.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/BaseRunTests.cs index 71df2a37a9..4600200c39 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/BaseRunTests.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/BaseRunTests.cs @@ -9,7 +9,6 @@ using System.Globalization; using System.IO; using System.Linq; -using System.Reflection; using System.Threading.Tasks; using Microsoft.VisualStudio.TestPlatform.Common.ExtensionDecorators; diff --git a/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs b/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs index 76d33b2f41..094e0351ca 100644 --- a/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs +++ b/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs @@ -9,7 +9,6 @@ using System.Globalization; using System.IO; using System.Linq; -using System.Reflection; using System.Threading; using System.Threading.Tasks; using System.Xml; diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestDiscoveryExtensionManagerTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestDiscoveryExtensionManagerTests.cs index 5e6e25272f..89631f1b85 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestDiscoveryExtensionManagerTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestDiscoveryExtensionManagerTests.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; -using System.Reflection; using Microsoft.TestPlatform.TestUtilities; using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework; diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestExecutorExtensionManagerTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestExecutorExtensionManagerTests.cs index 3ecb36ab0d..6f0b810351 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestExecutorExtensionManagerTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestExecutorExtensionManagerTests.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Linq; -using System.Reflection; using Microsoft.TestPlatform.TestUtilities; using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework; diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestExtensionsTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestExtensionsTests.cs index 5f870afe4a..a26d10ac56 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestExtensionsTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestExtensionsTests.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Collections.Generic; -using System.Reflection; using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework.Utilities; using Microsoft.VisualStudio.TestPlatform.Common.Telemetry; diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/ProxyDataCollectionManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/ProxyDataCollectionManagerTests.cs index f1f1a41428..6ed0c20b60 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/ProxyDataCollectionManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/ProxyDataCollectionManagerTests.cs @@ -7,7 +7,6 @@ using System.Diagnostics; using System.Globalization; using System.IO; -using System.Reflection; using Microsoft.VisualStudio.TestPlatform.Common.DataCollection; using Microsoft.VisualStudio.TestPlatform.Common.Telemetry; diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscovererEnumeratorTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscovererEnumeratorTests.cs index 4c06a6787c..ec44ce64b4 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscovererEnumeratorTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscovererEnumeratorTests.cs @@ -6,7 +6,6 @@ using System.ComponentModel; using System.IO; using System.Linq; -using System.Reflection; using System.Threading; using Microsoft.TestPlatform.TestUtilities; diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscoveryManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscoveryManagerTests.cs index 2162e8975b..dca3280bf7 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscoveryManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscoveryManagerTests.cs @@ -5,7 +5,6 @@ using System.Globalization; using System.IO; using System.Linq; -using System.Reflection; using Microsoft.TestPlatform.TestUtilities; using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework; diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/BaseRunTestsTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/BaseRunTestsTests.cs index db60a3184d..6d0f6746d1 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/BaseRunTestsTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/BaseRunTestsTests.cs @@ -7,7 +7,6 @@ using System.Globalization; using System.IO; using System.Linq; -using System.Reflection; using Microsoft.TestPlatform.TestUtilities; using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework; diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/ExecutionManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/ExecutionManagerTests.cs index 6f9799a003..c630d9c529 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/ExecutionManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/ExecutionManagerTests.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Reflection; using System.Xml; using Microsoft.TestPlatform.TestUtilities; diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithSourcesTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithSourcesTests.cs index 6f2c0259ca..d0b676eb03 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithSourcesTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithSourcesTests.cs @@ -6,7 +6,6 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; -using System.Reflection; using Microsoft.TestPlatform.TestUtilities; using Microsoft.VisualStudio.TestPlatform.Common; diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestExtensionManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestExtensionManagerTests.cs index fb0e47a7b9..c4c8293cd2 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestExtensionManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestExtensionManagerTests.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Collections.Generic; -using System.Reflection; using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework; using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine; diff --git a/test/Microsoft.TestPlatform.Utilities.UnitTests/ClientUtilitiesTests.cs b/test/Microsoft.TestPlatform.Utilities.UnitTests/ClientUtilitiesTests.cs index 413119ced6..50849cada2 100644 --- a/test/Microsoft.TestPlatform.Utilities.UnitTests/ClientUtilitiesTests.cs +++ b/test/Microsoft.TestPlatform.Utilities.UnitTests/ClientUtilitiesTests.cs @@ -3,7 +3,6 @@ using System; using System.IO; -using System.Reflection; using System.Xml; using Microsoft.VisualStudio.TestPlatform.Utilities; From 96a697487b05a8da93bd074b66dc717bf1472a6d Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Tue, 6 Jun 2023 20:29:03 +1000 Subject: [PATCH 08/11] . --- .../DataCollection/ProxyDataCollectionManager.cs | 1 - .../Discovery/DiscovererEnumerator.cs | 1 - 2 files changed, 2 deletions(-) diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyDataCollectionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyDataCollectionManager.cs index ab52e9018a..216c29c155 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyDataCollectionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyDataCollectionManager.cs @@ -6,7 +6,6 @@ using System.Globalization; using System.IO; using System.Linq; -using System.Reflection; using System.Xml; using Microsoft.VisualStudio.TestPlatform.Common.DataCollection; diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscovererEnumerator.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscovererEnumerator.cs index b657246841..418d5a32d4 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscovererEnumerator.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscovererEnumerator.cs @@ -7,7 +7,6 @@ using System.Globalization; using System.IO; using System.Linq; -using System.Reflection; using System.Threading; using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework; From 4eef0f26dce872465896413924d756abe11b15e4 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Tue, 6 Jun 2023 21:11:22 +1000 Subject: [PATCH 09/11] . --- .../ExtensionFramework/TestPluginCacheTests.cs | 2 +- .../DataCollection/InProcDataCollectionExtensionManagerTests.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginCacheTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginCacheTests.cs index b762049b48..1ff5f5acd7 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginCacheTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginCacheTests.cs @@ -269,7 +269,7 @@ public void GetResolutionPathsShouldReturnExtensionAssemblyDirectoryAndTpCommonD var temp = Path.GetTempPath(); var resolutionPaths = TestPluginCache.GetResolutionPaths($@"{temp}{Path.DirectorySeparatorChar}Idonotexist.dll").Select(p => p.Replace("/", "\\")).ToList(); - var tpCommonDirectory = Path.GetDirectoryName(typeof(TestPluginCache)..Assembly.Location)!; + var tpCommonDirectory = Path.GetDirectoryName(typeof(TestPluginCache).Assembly.Location)!; var expectedPaths = new List { temp, tpCommonDirectory }.ConvertAll(p => p.Replace("/", "\\").TrimEnd('\\')); CollectionAssert.AreEqual(expectedPaths, resolutionPaths, $"Collection {string.Join(", ", resolutionPaths)}, is not equal to the expected collection {string.Join(", ", expectedPaths)}."); diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/InProcDataCollectionExtensionManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/InProcDataCollectionExtensionManagerTests.cs index 730d1a0a07..0025d2a607 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/InProcDataCollectionExtensionManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/InProcDataCollectionExtensionManagerTests.cs @@ -301,7 +301,7 @@ public TestableInProcDataCollectionExtensionManager(string runSettings, ITestEve { } - protected override IInProcDataCollector CreateDataCollector(string assemblyQualifiedName, string codebase, XmlElement configuration, TypeInfo interfaceTypeInfo) + protected override IInProcDataCollector CreateDataCollector(string assemblyQualifiedName, string codebase, XmlElement configuration, Type interfaceType) { return new MockDataCollector(assemblyQualifiedName, codebase, configuration); } From 6978595765636d28cab25670eea085c3870339ec Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Tue, 6 Jun 2023 21:42:15 +1000 Subject: [PATCH 10/11] . --- .../Performance/TranslationLayer/TelemetryPerfTestBase.cs | 2 +- .../DataCollection/InProcDataCollectionExtensionManagerTests.cs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Performance/TranslationLayer/TelemetryPerfTestBase.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Performance/TranslationLayer/TelemetryPerfTestBase.cs index 2245128fee..6ac19cb445 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Performance/TranslationLayer/TelemetryPerfTestBase.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Performance/TranslationLayer/TelemetryPerfTestBase.cs @@ -22,7 +22,7 @@ public class TelemetryPerfTestBase : PerformanceTestBase { private const string TelemetryInstrumentationKey = "08de1ac5-2db8-4c30-97c6-2e12695fa610"; private readonly TelemetryClient _client; - private readonly string _rootDirectory = new DirectoryInfo(typeof(DiscoveryPerfTests)..Assembly.GetAssemblyLocation()).Parent.Parent.Parent.Parent.Parent.Parent.FullName; + private readonly string _rootDirectory = new DirectoryInfo(typeof(DiscoveryPerfTests).Assembly.GetAssemblyLocation()).Parent.Parent.Parent.Parent.Parent.Parent.FullName; public TelemetryPerfTestBase() { diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/InProcDataCollectionExtensionManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/InProcDataCollectionExtensionManagerTests.cs index 0025d2a607..1edc315269 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/InProcDataCollectionExtensionManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/InProcDataCollectionExtensionManagerTests.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using System.Reflection; using System.Xml; using Microsoft.TestPlatform.TestUtilities; From 17b3727ebbfef827545d505025f13dbf1369cf61 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Tue, 6 Jun 2023 23:00:27 +1000 Subject: [PATCH 11/11] . --- .../Performance/TranslationLayer/TelemetryPerfTestBase.cs | 1 - .../ExtensionFramework/TestPluginCacheTests.cs | 1 - 2 files changed, 2 deletions(-) diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Performance/TranslationLayer/TelemetryPerfTestBase.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Performance/TranslationLayer/TelemetryPerfTestBase.cs index 6ac19cb445..922ee5a27e 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Performance/TranslationLayer/TelemetryPerfTestBase.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Performance/TranslationLayer/TelemetryPerfTestBase.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Reflection; using System.Runtime.CompilerServices; using Microsoft.ApplicationInsights; diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginCacheTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginCacheTests.cs index 1ff5f5acd7..ff82d8f17b 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginCacheTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginCacheTests.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using System.Reflection; using Microsoft.TestPlatform.TestUtilities; using Microsoft.VisualStudio.TestPlatform.Common;