From d4dba98d9a9701936916a723a40eb461878f8b79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Tue, 7 Jan 2025 13:34:03 +0100 Subject: [PATCH] Fix "Could not load file or assembly 'Microsoft.Testing.Platform'" exception (#4537) --- eng/verify-nupkgs.ps1 | 2 +- .../MSTest.TestAdapter/BannedSymbols.txt | 1 + .../Execution/TestExecutionManager.cs | 8 ++----- .../Helpers/MSTestDiscovererHelpers.cs | 2 +- .../IPlatformServiceProvider.cs | 2 ++ .../MSTest.TestAdapter.nuspec | 10 ++++++++ .../MSTest.TestAdapter/MSTestSettings.cs | 2 +- .../PlatformServiceProvider.cs | 2 ++ .../RunConfigurationSettings.cs | 2 +- .../BridgedConfiguration.cs | 23 +++++++++++++++++++ .../MSTestBannerCapability.cs | 3 +++ .../MSTestBridgedTestFramework.cs | 7 +++--- .../TestingPlatformAdapter/MSTestExtension.cs | 2 ++ ...TestGracefulStopTestExecutionCapability.cs | 9 +++++--- .../TestApplicationBuilderExtensions.cs | 2 ++ .../TestingPlatformBuilderHook.cs | 5 +++- .../VSTestAdapter/MSTestDiscoverer.cs | 5 ++-- .../VSTestAdapter/MSTestExecutor.cs | 8 ++++--- .../Interfaces/IConfiguration.cs | 13 ++++++++--- .../MSTestAdapter.PlatformServices.csproj | 4 +--- .../Services/MSTestAdapterSettings.cs | 2 +- .../Services/SettingsProvider.cs | 1 - .../Services/MSTestAdapterSettingsTests.cs | 2 +- .../MSTestSettingsTests.cs | 2 +- .../RunConfigurationSettingsTests.cs | 2 +- .../TestablePlatformServiceProvider.cs | 2 ++ 26 files changed, 90 insertions(+), 33 deletions(-) create mode 100644 src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/BridgedConfiguration.cs diff --git a/eng/verify-nupkgs.ps1 b/eng/verify-nupkgs.ps1 index d39c6437ba..c4e8ca3be5 100644 --- a/eng/verify-nupkgs.ps1 +++ b/eng/verify-nupkgs.ps1 @@ -22,7 +22,7 @@ function Confirm-NugetPackages { "MSTest.Sdk" = 15; "MSTest.Internal.TestFx.Documentation" = 10; "MSTest.TestFramework" = 148; - "MSTest.TestAdapter" = 74; + "MSTest.TestAdapter" = 75; "MSTest" = 6; "MSTest.Analyzers" = 50; } diff --git a/src/Adapter/MSTest.TestAdapter/BannedSymbols.txt b/src/Adapter/MSTest.TestAdapter/BannedSymbols.txt index 91178cbc64..31a6272126 100644 --- a/src/Adapter/MSTest.TestAdapter/BannedSymbols.txt +++ b/src/Adapter/MSTest.TestAdapter/BannedSymbols.txt @@ -1 +1,2 @@ M:Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Helpers.ReflectHelper.#ctor; This is allowed only for tests. +N:Microsoft.Testing.Platform diff --git a/src/Adapter/MSTest.TestAdapter/Execution/TestExecutionManager.cs b/src/Adapter/MSTest.TestAdapter/Execution/TestExecutionManager.cs index a5e145fd8f..290b8fe441 100644 --- a/src/Adapter/MSTest.TestAdapter/Execution/TestExecutionManager.cs +++ b/src/Adapter/MSTest.TestAdapter/Execution/TestExecutionManager.cs @@ -401,12 +401,10 @@ private void ExecuteTestsInSource(IEnumerable tests, IRunContext? runC ExecuteTestsWithTestRunner(testsToRun, frameworkHandle, source, sourceLevelParameters, testRunner); } -#if !WINDOWS_UWP - if (MSTestGracefulStopTestExecutionCapability.Instance.IsStopRequested) + if (PlatformServiceProvider.Instance.IsGracefulStopRequested) { testRunner.ForceCleanup(); } -#endif PlatformServiceProvider.Instance.AdapterTraceLogger.LogInfo("Executed tests belonging to source {0}", source); } @@ -428,12 +426,10 @@ private void ExecuteTestsWithTestRunner( foreach (TestCase currentTest in orderedTests) { _testRunCancellationToken?.ThrowIfCancellationRequested(); -#if !WINDOWS_UWP - if (MSTestGracefulStopTestExecutionCapability.Instance.IsStopRequested) + if (PlatformServiceProvider.Instance.IsGracefulStopRequested) { break; } -#endif // If it is a fixture test, add it to the list of fixture tests and do not execute it. // It is executed by test itself. diff --git a/src/Adapter/MSTest.TestAdapter/Helpers/MSTestDiscovererHelpers.cs b/src/Adapter/MSTest.TestAdapter/Helpers/MSTestDiscovererHelpers.cs index 7d4d8ee7b8..3b76323e58 100644 --- a/src/Adapter/MSTest.TestAdapter/Helpers/MSTestDiscovererHelpers.cs +++ b/src/Adapter/MSTest.TestAdapter/Helpers/MSTestDiscovererHelpers.cs @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using Microsoft.Testing.Platform.Configurations; using Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.ObjectModel; +using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; diff --git a/src/Adapter/MSTest.TestAdapter/IPlatformServiceProvider.cs b/src/Adapter/MSTest.TestAdapter/IPlatformServiceProvider.cs index 8bf09bab56..ca15e2503c 100644 --- a/src/Adapter/MSTest.TestAdapter/IPlatformServiceProvider.cs +++ b/src/Adapter/MSTest.TestAdapter/IPlatformServiceProvider.cs @@ -56,6 +56,8 @@ internal interface IPlatformServiceProvider /// TestRunCancellationToken? TestRunCancellationToken { get; set; } + bool IsGracefulStopRequested { get; set; } + /// /// Creates an instance to the platform service for a test source host. /// diff --git a/src/Adapter/MSTest.TestAdapter/MSTest.TestAdapter.nuspec b/src/Adapter/MSTest.TestAdapter/MSTest.TestAdapter.nuspec index 845b2f2dee..48850bcbb4 100644 --- a/src/Adapter/MSTest.TestAdapter/MSTest.TestAdapter.nuspec +++ b/src/Adapter/MSTest.TestAdapter/MSTest.TestAdapter.nuspec @@ -99,6 +99,16 @@ + + diff --git a/src/Adapter/MSTest.TestAdapter/MSTestSettings.cs b/src/Adapter/MSTest.TestAdapter/MSTestSettings.cs index 75581be1a8..98659fc7da 100644 --- a/src/Adapter/MSTest.TestAdapter/MSTestSettings.cs +++ b/src/Adapter/MSTest.TestAdapter/MSTestSettings.cs @@ -6,8 +6,8 @@ using System.Xml; using System.Xml.Linq; -using Microsoft.Testing.Platform.Configurations; using Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.ObjectModel; +using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface; #if !WINDOWS_UWP using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; #endif diff --git a/src/Adapter/MSTest.TestAdapter/PlatformServiceProvider.cs b/src/Adapter/MSTest.TestAdapter/PlatformServiceProvider.cs index 94bcdc3e8d..b1f036f25e 100644 --- a/src/Adapter/MSTest.TestAdapter/PlatformServiceProvider.cs +++ b/src/Adapter/MSTest.TestAdapter/PlatformServiceProvider.cs @@ -140,6 +140,8 @@ public IReflectionOperations2 ReflectionOperations /// public TestRunCancellationToken? TestRunCancellationToken { get; set; } + public bool IsGracefulStopRequested { get; set; } + /// /// Gets or sets the instance for the platform service. /// diff --git a/src/Adapter/MSTest.TestAdapter/RunConfigurationSettings.cs b/src/Adapter/MSTest.TestAdapter/RunConfigurationSettings.cs index e9a1701c71..d46e352562 100644 --- a/src/Adapter/MSTest.TestAdapter/RunConfigurationSettings.cs +++ b/src/Adapter/MSTest.TestAdapter/RunConfigurationSettings.cs @@ -7,7 +7,7 @@ #if !WINDOWS_UWP using System.Globalization; -using Microsoft.Testing.Platform.Configurations; +using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface; #endif using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter; diff --git a/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/BridgedConfiguration.cs b/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/BridgedConfiguration.cs new file mode 100644 index 0000000000..2c4b60307c --- /dev/null +++ b/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/BridgedConfiguration.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +#if !WINDOWS_UWP +using System.Diagnostics.CodeAnalysis; + +using Microsoft.Testing.Platform.Configurations; + +using PlatformServicesConfiguration = Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.IConfiguration; + +namespace Microsoft.VisualStudio.TestTools.UnitTesting; + +[SuppressMessage("ApiDesign", "RS0030:Do not use banned APIs", Justification = "We can use MTP from this folder")] +internal sealed class BridgedConfiguration : PlatformServicesConfiguration +{ + private readonly IConfiguration _configuration; + + public BridgedConfiguration(IConfiguration configuration) + => _configuration = configuration; + + public string? this[string key] => _configuration[key]; +} +#endif diff --git a/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/MSTestBannerCapability.cs b/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/MSTestBannerCapability.cs index af5c0c0e4b..4a9994befc 100644 --- a/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/MSTestBannerCapability.cs +++ b/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/MSTestBannerCapability.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. #if !WINDOWS_UWP +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; using System.Text; @@ -11,6 +12,8 @@ namespace Microsoft.VisualStudio.TestTools.UnitTesting; #pragma warning disable TPEXP // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. + +[SuppressMessage("ApiDesign", "RS0030:Do not use banned APIs", Justification = "We can use MTP from this folder")] internal sealed class MSTestBannerCapability : IBannerMessageOwnerCapability { private readonly IPlatformInformation _platformInformation; diff --git a/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/MSTestBridgedTestFramework.cs b/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/MSTestBridgedTestFramework.cs index 6a9ca840a1..9f0b8108f9 100644 --- a/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/MSTestBridgedTestFramework.cs +++ b/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/MSTestBridgedTestFramework.cs @@ -3,26 +3,27 @@ #if !WINDOWS_UWP using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Reflection; using Microsoft.Testing.Extensions.VSTestBridge; using Microsoft.Testing.Extensions.VSTestBridge.Requests; using Microsoft.Testing.Platform.Capabilities.TestFramework; -using Microsoft.Testing.Platform.Configurations; using Microsoft.Testing.Platform.Messages; using Microsoft.Testing.Platform.Services; using Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter; namespace Microsoft.VisualStudio.TestTools.UnitTesting; +[SuppressMessage("ApiDesign", "RS0030:Do not use banned APIs", Justification = "We can use MTP from this folder")] internal sealed class MSTestBridgedTestFramework : SynchronizedSingleSessionVSTestBridgedTestFramework { - private readonly IConfiguration? _configuration; + private readonly BridgedConfiguration? _configuration; public MSTestBridgedTestFramework(MSTestExtension mstestExtension, Func> getTestAssemblies, IServiceProvider serviceProvider, ITestFrameworkCapabilities capabilities) : base(mstestExtension, getTestAssemblies, serviceProvider, capabilities) - => _configuration = serviceProvider.GetConfiguration(); + => _configuration = new(serviceProvider.GetConfiguration()); /// protected override Task SynchronizedDiscoverTestsAsync(VSTestDiscoverTestExecutionRequest request, IMessageBus messageBus, diff --git a/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/MSTestExtension.cs b/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/MSTestExtension.cs index d39139e914..8b307c2e68 100644 --- a/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/MSTestExtension.cs +++ b/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/MSTestExtension.cs @@ -2,12 +2,14 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. #if !WINDOWS_UWP +using System.Diagnostics.CodeAnalysis; using System.Reflection; using Microsoft.Testing.Platform.Extensions; namespace Microsoft.VisualStudio.TestTools.UnitTesting; +[SuppressMessage("ApiDesign", "RS0030:Do not use banned APIs", Justification = "We can use MTP from this folder")] internal sealed class MSTestExtension : IExtension { public string Uid { get; } = GetExtensionUid(); diff --git a/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/MSTestGracefulStopTestExecutionCapability.cs b/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/MSTestGracefulStopTestExecutionCapability.cs index 986e45c004..cdcac8348f 100644 --- a/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/MSTestGracefulStopTestExecutionCapability.cs +++ b/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/MSTestGracefulStopTestExecutionCapability.cs @@ -2,11 +2,16 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. #if !WINDOWS_UWP +using System.Diagnostics.CodeAnalysis; + using Microsoft.Testing.Platform.Capabilities.TestFramework; +using Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter; namespace Microsoft.VisualStudio.TestTools.UnitTesting; #pragma warning disable TPEXP // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. + +[SuppressMessage("ApiDesign", "RS0030:Do not use banned APIs", Justification = "We can use MTP from this folder")] internal sealed class MSTestGracefulStopTestExecutionCapability : IGracefulStopTestExecutionCapability #pragma warning restore TPEXP // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. { @@ -16,11 +21,9 @@ private MSTestGracefulStopTestExecutionCapability() public static MSTestGracefulStopTestExecutionCapability Instance { get; } = new(); - public bool IsStopRequested { get; private set; } - public Task StopTestExecutionAsync(CancellationToken cancellationToken) { - IsStopRequested = true; + PlatformServiceProvider.Instance.IsGracefulStopRequested = true; return Task.CompletedTask; } } diff --git a/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/TestApplicationBuilderExtensions.cs b/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/TestApplicationBuilderExtensions.cs index 3cb51f0732..5f8556f55c 100644 --- a/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/TestApplicationBuilderExtensions.cs +++ b/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/TestApplicationBuilderExtensions.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. #if !WINDOWS_UWP +using System.Diagnostics.CodeAnalysis; using System.Reflection; using Microsoft.Testing.Extensions.VSTestBridge.Capabilities; @@ -13,6 +14,7 @@ namespace Microsoft.VisualStudio.TestTools.UnitTesting; +[SuppressMessage("ApiDesign", "RS0030:Do not use banned APIs", Justification = "We can use MTP from this folder")] public static class TestApplicationBuilderExtensions { public static void AddMSTest(this ITestApplicationBuilder testApplicationBuilder, Func> getTestAssemblies) diff --git a/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/TestingPlatformBuilderHook.cs b/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/TestingPlatformBuilderHook.cs index befda48370..c2c3413f3a 100644 --- a/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/TestingPlatformBuilderHook.cs +++ b/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/TestingPlatformBuilderHook.cs @@ -2,15 +2,18 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. #if !WINDOWS_UWP +using System.Diagnostics.CodeAnalysis; using System.Reflection; using Microsoft.Testing.Platform.Builder; namespace Microsoft.VisualStudio.TestTools.UnitTesting; +[SuppressMessage("ApiDesign", "RS0030:Do not use banned APIs", Justification = "We can use MTP from this folder")] public static class TestingPlatformBuilderHook { #pragma warning disable IDE0060 // Remove unused parameter - public static void AddExtensions(ITestApplicationBuilder testApplicationBuilder, string[] arguments) => testApplicationBuilder.AddMSTest(() => [Assembly.GetEntryAssembly()!]); + public static void AddExtensions(ITestApplicationBuilder testApplicationBuilder, string[] arguments) + => testApplicationBuilder.AddMSTest(() => [Assembly.GetEntryAssembly()!]); } #endif diff --git a/src/Adapter/MSTest.TestAdapter/VSTestAdapter/MSTestDiscoverer.cs b/src/Adapter/MSTest.TestAdapter/VSTestAdapter/MSTestDiscoverer.cs index c61b73aaa3..94c8d93926 100644 --- a/src/Adapter/MSTest.TestAdapter/VSTestAdapter/MSTestDiscoverer.cs +++ b/src/Adapter/MSTest.TestAdapter/VSTestAdapter/MSTestDiscoverer.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using Microsoft.Testing.Platform.Configurations; +using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; @@ -34,7 +34,8 @@ public class MSTestDiscoverer : ITestDiscoverer /// Used to send testcases and discovery related events back to Discoverer manager. [System.Security.SecurityCritical] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Justification = "Discovery context can be null.")] - public void DiscoverTests(IEnumerable sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink) => MSTestDiscoverer.DiscoverTests(sources, discoveryContext, logger, discoverySink, null); + public void DiscoverTests(IEnumerable sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink) + => DiscoverTests(sources, discoveryContext, logger, discoverySink, null); internal static void DiscoverTests(IEnumerable sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink, IConfiguration? configuration) { diff --git a/src/Adapter/MSTest.TestAdapter/VSTestAdapter/MSTestExecutor.cs b/src/Adapter/MSTest.TestAdapter/VSTestAdapter/MSTestExecutor.cs index 51f8df0a8b..63a71c5de6 100644 --- a/src/Adapter/MSTest.TestAdapter/VSTestAdapter/MSTestExecutor.cs +++ b/src/Adapter/MSTest.TestAdapter/VSTestAdapter/MSTestExecutor.cs @@ -3,8 +3,8 @@ using System.Runtime.InteropServices; -using Microsoft.Testing.Platform.Configurations; using Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution; +using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; @@ -51,9 +51,11 @@ internal MSTestExecutor(CancellationToken cancellationToken) /// public TestExecutionManager TestExecutionManager { get; protected set; } - public void RunTests(IEnumerable? tests, IRunContext? runContext, IFrameworkHandle? frameworkHandle) => RunTests(tests, runContext, frameworkHandle, null); + public void RunTests(IEnumerable? tests, IRunContext? runContext, IFrameworkHandle? frameworkHandle) + => RunTests(tests, runContext, frameworkHandle, null); - public void RunTests(IEnumerable? sources, IRunContext? runContext, IFrameworkHandle? frameworkHandle) => RunTests(sources, runContext, frameworkHandle, null); + public void RunTests(IEnumerable? sources, IRunContext? runContext, IFrameworkHandle? frameworkHandle) + => RunTests(sources, runContext, frameworkHandle, null); internal void RunTests(IEnumerable? tests, IRunContext? runContext, IFrameworkHandle? frameworkHandle, IConfiguration? configuration) { diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/IConfiguration.cs b/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/IConfiguration.cs index 4a177a55d9..0630e03f79 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/IConfiguration.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/IConfiguration.cs @@ -1,10 +1,17 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -#if WINDOWS_UWP -namespace Microsoft.Testing.Platform.Configurations; +namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface; +/// +/// Represents a configuration interface. +/// internal interface IConfiguration { + /// + /// Gets or sets the value associated with the specified key. + /// + /// The key of the value to get or set. + /// The value associated with the specified key. + string? this[string key] { get; } } -#endif diff --git a/src/Adapter/MSTestAdapter.PlatformServices/MSTestAdapter.PlatformServices.csproj b/src/Adapter/MSTestAdapter.PlatformServices/MSTestAdapter.PlatformServices.csproj index afa1b916ed..07f30f5b18 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/MSTestAdapter.PlatformServices.csproj +++ b/src/Adapter/MSTestAdapter.PlatformServices/MSTestAdapter.PlatformServices.csproj @@ -31,8 +31,6 @@ - Analyzer false @@ -40,7 +38,7 @@ - + diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Services/MSTestAdapterSettings.cs b/src/Adapter/MSTestAdapter.PlatformServices/Services/MSTestAdapterSettings.cs index 59ac48a834..ffc894c1eb 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Services/MSTestAdapterSettings.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Services/MSTestAdapterSettings.cs @@ -5,7 +5,7 @@ using System.Globalization; using System.Xml; -using Microsoft.Testing.Platform.Configurations; +using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Services/SettingsProvider.cs b/src/Adapter/MSTestAdapter.PlatformServices/Services/SettingsProvider.cs index 618229553b..25366d653c 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Services/SettingsProvider.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Services/SettingsProvider.cs @@ -6,7 +6,6 @@ #endif using System.Xml; -using Microsoft.Testing.Platform.Configurations; using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface; namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; diff --git a/test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/Services/MSTestAdapterSettingsTests.cs b/test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/Services/MSTestAdapterSettingsTests.cs index 787e96b51a..2811b99aa6 100644 --- a/test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/Services/MSTestAdapterSettingsTests.cs +++ b/test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/Services/MSTestAdapterSettingsTests.cs @@ -3,8 +3,8 @@ using System.Xml; -using Microsoft.Testing.Platform.Configurations; using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; +using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities; diff --git a/test/UnitTests/MSTestAdapter.UnitTests/MSTestSettingsTests.cs b/test/UnitTests/MSTestAdapter.UnitTests/MSTestSettingsTests.cs index 779bb7b37d..691d773329 100644 --- a/test/UnitTests/MSTestAdapter.UnitTests/MSTestSettingsTests.cs +++ b/test/UnitTests/MSTestAdapter.UnitTests/MSTestSettingsTests.cs @@ -3,9 +3,9 @@ using System.Xml; -using Microsoft.Testing.Platform.Configurations; using Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter; using Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.ObjectModel; +using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface; using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.TestableImplementations; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; diff --git a/test/UnitTests/MSTestAdapter.UnitTests/RunConfigurationSettingsTests.cs b/test/UnitTests/MSTestAdapter.UnitTests/RunConfigurationSettingsTests.cs index 355ee93e9d..1a8a26b478 100644 --- a/test/UnitTests/MSTestAdapter.UnitTests/RunConfigurationSettingsTests.cs +++ b/test/UnitTests/MSTestAdapter.UnitTests/RunConfigurationSettingsTests.cs @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using Microsoft.Testing.Platform.Configurations; using Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter; +using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface; using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.TestableImplementations; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; diff --git a/test/UnitTests/MSTestAdapter.UnitTests/TestableImplementations/TestablePlatformServiceProvider.cs b/test/UnitTests/MSTestAdapter.UnitTests/TestableImplementations/TestablePlatformServiceProvider.cs index afec0277f4..85730ab2c0 100644 --- a/test/UnitTests/MSTestAdapter.UnitTests/TestableImplementations/TestablePlatformServiceProvider.cs +++ b/test/UnitTests/MSTestAdapter.UnitTests/TestableImplementations/TestablePlatformServiceProvider.cs @@ -125,6 +125,8 @@ public IReflectionOperations2 ReflectionOperations public TestRunCancellationToken TestRunCancellationToken { get; set; } + public bool IsGracefulStopRequested { get; set; } + public ITestContext GetTestContext(ITestMethod testMethod, StringWriter writer, IDictionary properties) => new TestContextImplementation(testMethod, writer, properties); public ITestSourceHost CreateTestSourceHost(string source, TestPlatform.ObjectModel.Adapter.IRunSettings runSettings, TestPlatform.ObjectModel.Adapter.IFrameworkHandle frameworkHandle) => MockTestSourceHost.Object;