diff --git a/TestFx.sln b/TestFx.sln index 355e63a231..4bfa5cd378 100644 --- a/TestFx.sln +++ b/TestFx.sln @@ -19,8 +19,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestFramework", "TestFramew EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MSTest.Core", "src\TestFramework\MSTest.Core\MSTest.Core.csproj", "{7252D9E3-267D-442C-96BC-C73AEF3241D6}" EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "PlatformServices.Shared", "src\Adapter\PlatformServices.Shared\PlatformServices.Shared.shproj", "{2177C273-AE07-43B3-B87A-443E47A23C5A}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{A9596292-7E67-4566-9096-143DDAA4E8D8}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AdapterTests", "AdapterTests", "{F2D0BF2C-38F2-4244-80E3-4AAD1C3F4C89}" @@ -1195,7 +1193,6 @@ Global {5D153CAA-80C2-4551-9549-6C406FCEEFB1} = {24088844-2107-4DB2-8F3F-CBCA94FC4B28} {E48AC786-E150-4F41-9A16-32F02E4493D8} = {FF8B1B72-55A1-4FFE-809E-7B79323ED8D0} {7252D9E3-267D-442C-96BC-C73AEF3241D6} = {E48AC786-E150-4F41-9A16-32F02E4493D8} - {2177C273-AE07-43B3-B87A-443E47A23C5A} = {24088844-2107-4DB2-8F3F-CBCA94FC4B28} {F2D0BF2C-38F2-4244-80E3-4AAD1C3F4C89} = {A9596292-7E67-4566-9096-143DDAA4E8D8} {DF131865-84EE-4540-8112-E88ACEBDEA09} = {E48AC786-E150-4F41-9A16-32F02E4493D8} {F1A27537-78D1-4BBD-8E76-ADB31BC0C2B4} = {A9596292-7E67-4566-9096-143DDAA4E8D8} @@ -1252,7 +1249,4 @@ Global GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {31E0F4D5-975A-41CC-933E-545B2201FAF9} EndGlobalSection - GlobalSection(SharedMSBuildProjectFiles) = preSolution - src\Adapter\PlatformServices.Shared\PlatformServices.Shared.projitems*{2177c273-ae07-43b3-b87a-443e47a23c5a}*SharedItemsImports = 13 - EndGlobalSection EndGlobal diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.0/Constants.cs b/src/Adapter/PlatformServices.Portable/Constants.cs similarity index 100% rename from src/Adapter/PlatformServices.Shared/netstandard1.0/Constants.cs rename to src/Adapter/PlatformServices.Portable/Constants.cs diff --git a/src/Adapter/PlatformServices.Portable/PlatformServices.Portable.csproj b/src/Adapter/PlatformServices.Portable/PlatformServices.Portable.csproj index e410fbebcb..5ea03b2e3c 100644 --- a/src/Adapter/PlatformServices.Portable/PlatformServices.Portable.csproj +++ b/src/Adapter/PlatformServices.Portable/PlatformServices.Portable.csproj @@ -39,23 +39,21 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10ThreadSafeStringWriter.cs b/src/Adapter/PlatformServices.Portable/Services/ThreadSafeStringWriter.cs similarity index 100% rename from src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10ThreadSafeStringWriter.cs rename to src/Adapter/PlatformServices.Portable/Services/ThreadSafeStringWriter.cs diff --git a/src/Adapter/PlatformServices.Shared/PlatformServices.Shared.projitems b/src/Adapter/PlatformServices.Shared/PlatformServices.Shared.projitems deleted file mode 100644 index 9ce58de0a5..0000000000 --- a/src/Adapter/PlatformServices.Shared/PlatformServices.Shared.projitems +++ /dev/null @@ -1,14 +0,0 @@ - - - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - true - 2177c273-ae07-43b3-b87a-443e47a23c5a - - - UnitTestFramework.Extension.Shared - - - - - diff --git a/src/Adapter/PlatformServices.Shared/PlatformServices.Shared.shproj b/src/Adapter/PlatformServices.Shared/PlatformServices.Shared.shproj deleted file mode 100644 index fe9f815b3d..0000000000 --- a/src/Adapter/PlatformServices.Shared/PlatformServices.Shared.shproj +++ /dev/null @@ -1,14 +0,0 @@ - - - - 2177c273-ae07-43b3-b87a-443e47a23c5a - 14.0 - - - - - - - - - \ No newline at end of file diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestDeployment.cs b/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestDeployment.cs deleted file mode 100644 index 4fc5b9ee3f..0000000000 --- a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestDeployment.cs +++ /dev/null @@ -1,64 +0,0 @@ -// 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 || (NETCOREAPP && !WIN_UI) || NETSTANDARD_PORTABLE -namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; - -using System; -using System.Collections.Generic; -using System.Reflection; - -using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface; -using Microsoft.VisualStudio.TestPlatform.ObjectModel; -using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter; - -#pragma warning disable SA1649 // SA1649FileNameMustMatchTypeName - -/// -/// The test deployment. -/// -public class TestDeployment : ITestDeployment -{ - /// - /// Deploy deployment items for the specified test cases. - /// - /// The test cases. - /// The run context. - /// The framework handle. - /// True if deployment is done. - public bool Deploy(IEnumerable testCases, IRunContext runContext, IFrameworkHandle frameworkHandle) - { - return false; - } - - /// - /// Gets the set of deployment items on a method and its corresponding class. - /// - /// The method. - /// The type. - /// The warnings. - /// The of deployment items. - public KeyValuePair[] GetDeploymentItems(MethodInfo method, Type type, ICollection warnings) - { - return null; - } - - /// - /// Cleanup deployment item directories. - /// - public void Cleanup() - { - } - - /// - /// Gets the deployment output directory where the source file along with all its dependencies is dropped. - /// - /// The deployment output directory. - public string GetDeploymentDirectory() - { - return null; - } -} - -#pragma warning restore SA1649 // SA1649FileNameMustMatchTypeName -#endif diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TraceListenerManager.cs b/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TraceListenerManager.cs deleted file mode 100644 index 8e31236401..0000000000 --- a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TraceListenerManager.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#if NETCOREAPP || WIN_UI || WINDOWS_UWP || NETSTANDARD_PORTABLE -namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; - -using System.IO; - -using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface; - -#pragma warning disable SA1649 // SA1649FileNameMustMatchTypeName - -/// -/// Internal implementation of TraceListenerManager exposed to the user. -/// Responsible for performing Add(), Remove(), Close(), Dispose() operations on traceListener object. -/// -public class TraceListenerManager : ITraceListenerManager -{ - /// - /// Initializes a new instance of the class. - /// - /// A writer instance to log output messages. - /// A writer instance to log error messages. - public TraceListenerManager(TextWriter outputWriter, TextWriter errorWriter) - { - } - - /// - /// Returning as this feature is not supported in ASP .net and UWP - /// - /// The trace listener instance. - public void Add(ITraceListener traceListener) - { - return; - } - - /// - /// Returning as this feature is not supported in ASP .net and UWP - /// - /// The trace listener instance. - public void Close(ITraceListener traceListener) - { - return; - } - - /// - /// Returning as this feature is not supported in ASP .net and UWP - /// - /// The trace listener instance. - public void Dispose(ITraceListener traceListener) - { - return; - } - - /// - /// Returning as this feature is not supported in ASP .net and UWP - /// - /// The trace listener instance. - public void Remove(ITraceListener traceListener) - { - return; - } -} - -#pragma warning restore SA1649 // SA1649FileNameMustMatchTypeName -#endif diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.3/Services/ns13TraceListener.cs b/src/Adapter/PlatformServices.Shared/netstandard1.3/Services/ns13TraceListener.cs deleted file mode 100644 index ddeef27b48..0000000000 --- a/src/Adapter/PlatformServices.Shared/netstandard1.3/Services/ns13TraceListener.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#if NETSTANDARD || NETFRAMEWORK -namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; - -using System.Diagnostics; -using System.IO; - -using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface; - -#pragma warning disable SA1649 // SA1649FileNameMustMatchTypeName - -/// -/// Internal implementation of TraceListener exposed to the user. -/// The virtual operations of the TraceListener are implemented here -/// like Close(), Dispose() etc. -/// -public class TraceListenerWrapper : TextWriterTraceListener, ITraceListener -{ - // Summary: - // Initializes a new instance of an object that derives from System.Diagnostics.TextWriterTraceListener - // Class and initializes TextWriterTraceListener object using the specified writer as recipient of the - // tracing or debugging output. - public TraceListenerWrapper(TextWriter textWriter) - : base(textWriter) - { - } - - // Summary: - // Wrapper over Dispose() of System.Diagnostics.TextWriterTraceListener object - public new void Dispose() - { - base.Dispose(); - } - - // Summary: - // Gets the text writer of System.Diagnostics.TextWriterTraceListener.Writer - // that receives the tracing or debugging output. - public TextWriter GetWriter() - { - return Writer; - } -} - -#pragma warning restore SA1649 // SA1649FileNameMustMatchTypeName -#endif diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.3/ns13DeploymentItem.cs b/src/Adapter/PlatformServices/DeploymentItem.cs similarity index 100% rename from src/Adapter/PlatformServices.Shared/netstandard1.3/ns13DeploymentItem.cs rename to src/Adapter/PlatformServices/DeploymentItem.cs diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.3/Extensions/ns13ExceptionExtensions.cs b/src/Adapter/PlatformServices/Extensions/ExceptionExtensions.cs similarity index 100% rename from src/Adapter/PlatformServices.Shared/netstandard1.3/Extensions/ns13ExceptionExtensions.cs rename to src/Adapter/PlatformServices/Extensions/ExceptionExtensions.cs diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.0/MarshalByRefObject.cs b/src/Adapter/PlatformServices/MarshalByRefObject.cs similarity index 100% rename from src/Adapter/PlatformServices.Shared/netstandard1.0/MarshalByRefObject.cs rename to src/Adapter/PlatformServices/MarshalByRefObject.cs diff --git a/src/Adapter/PlatformServices/PlatformServices.csproj b/src/Adapter/PlatformServices/PlatformServices.csproj index f5c17986ff..fb7edee70b 100644 --- a/src/Adapter/PlatformServices/PlatformServices.csproj +++ b/src/Adapter/PlatformServices/PlatformServices.csproj @@ -61,38 +61,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Resources\Resource.Designer.cs diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.0/ns10RecursiveDirectoryPath.cs b/src/Adapter/PlatformServices/RecursiveDirectoryPath.cs similarity index 96% rename from src/Adapter/PlatformServices.Shared/netstandard1.0/ns10RecursiveDirectoryPath.cs rename to src/Adapter/PlatformServices/RecursiveDirectoryPath.cs index 30070f09e5..17a844eb79 100644 --- a/src/Adapter/PlatformServices.Shared/netstandard1.0/ns10RecursiveDirectoryPath.cs +++ b/src/Adapter/PlatformServices/RecursiveDirectoryPath.cs @@ -22,7 +22,6 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; /// [Serializable] [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1603:DocumentationMustContainValidXml", Justification = "Reviewed. Suppression is ok here.")] -#pragma warning disable SA1649 // File name must match first type name public class RecursiveDirectoryPath : MarshalByRefObject { /// diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.0/SerializableAttribute.cs b/src/Adapter/PlatformServices/SerializableAttribute.cs similarity index 100% rename from src/Adapter/PlatformServices.Shared/netstandard1.0/SerializableAttribute.cs rename to src/Adapter/PlatformServices/SerializableAttribute.cs diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10DiaSessionOperations.cs b/src/Adapter/PlatformServices/Services/DiaSessionOperations.cs similarity index 97% rename from src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10DiaSessionOperations.cs rename to src/Adapter/PlatformServices/Services/DiaSessionOperations.cs index ce747ab6ef..7b07f7ec98 100644 --- a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10DiaSessionOperations.cs +++ b/src/Adapter/PlatformServices/Services/DiaSessionOperations.cs @@ -6,8 +6,6 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; using System; using System.Reflection; -#pragma warning disable SA1649 // SA1649FileNameMustMatchTypeName - internal static class DiaSessionOperations { private static MethodInfo s_methodGetNavigationData; @@ -117,5 +115,3 @@ private static object SafeInvoke(Func action, string messageFormatOnExcept return null; } } - -#pragma warning restore SA1649 // SA1649FileNameMustMatchTypeName diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10FileOperations.cs b/src/Adapter/PlatformServices/Services/FileOperations.cs similarity index 98% rename from src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10FileOperations.cs rename to src/Adapter/PlatformServices/Services/FileOperations.cs index a8894c7727..6db7b5201e 100644 --- a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10FileOperations.cs +++ b/src/Adapter/PlatformServices/Services/FileOperations.cs @@ -14,8 +14,6 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface; using Microsoft.VisualStudio.TestPlatform.ObjectModel; -#pragma warning disable SA1649 // SA1649FileNameMustMatchTypeName - /// /// The file operations. /// @@ -215,6 +213,4 @@ private static object SafeInvoke(Func action, string messageFormatOnExcept #endif } -#pragma warning restore SA1649 // SA1649FileNameMustMatchTypeName - #endif diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.3/Services/ns13MSTestAdapterSettings.cs b/src/Adapter/PlatformServices/Services/MSTestAdapterSettings.cs similarity index 100% rename from src/Adapter/PlatformServices.Shared/netstandard1.3/Services/ns13MSTestAdapterSettings.cs rename to src/Adapter/PlatformServices/Services/MSTestAdapterSettings.cs diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10ReflectionOperations.cs b/src/Adapter/PlatformServices/Services/ReflectionOperations.cs similarity index 95% rename from src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10ReflectionOperations.cs rename to src/Adapter/PlatformServices/Services/ReflectionOperations.cs index 432d8e2918..378cb84346 100644 --- a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10ReflectionOperations.cs +++ b/src/Adapter/PlatformServices/Services/ReflectionOperations.cs @@ -12,8 +12,6 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Utilities; #endif -#pragma warning disable SA1649 // SA1649FileNameMustMatchTypeName - /// /// This service is responsible for platform specific reflection operations. /// @@ -77,5 +75,3 @@ public object[] GetCustomAttributes(Assembly assembly, Type type) #endif } } - -#pragma warning restore SA1649 // SA1649FileNameMustMatchTypeName diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10SettingsProvider.cs b/src/Adapter/PlatformServices/Services/SettingsProvider.cs similarity index 94% rename from src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10SettingsProvider.cs rename to src/Adapter/PlatformServices/Services/SettingsProvider.cs index 3328a6c9b4..3554587ff0 100644 --- a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10SettingsProvider.cs +++ b/src/Adapter/PlatformServices/Services/SettingsProvider.cs @@ -13,8 +13,6 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; using ISettingsProvider = Interface.ISettingsProvider; #endif -#pragma warning disable SA1649 // SA1649FileNameMustMatchTypeName - /// /// Class to read settings from the runsettings xml for the desktop. /// @@ -71,5 +69,3 @@ public IDictionary GetProperties(string source) #endif } } - -#pragma warning restore SA1649 // SA1649FileNameMustMatchTypeName diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestContextImplementation.cs b/src/Adapter/PlatformServices/Services/TestContextImplementation.cs similarity index 100% rename from src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestContextImplementation.cs rename to src/Adapter/PlatformServices/Services/TestContextImplementation.cs diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestContextPropertyStrings.cs b/src/Adapter/PlatformServices/Services/TestContextPropertyStrings.cs similarity index 100% rename from src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestContextPropertyStrings.cs rename to src/Adapter/PlatformServices/Services/TestContextPropertyStrings.cs diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestDataSource.cs b/src/Adapter/PlatformServices/Services/TestDataSource.cs similarity index 97% rename from src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestDataSource.cs rename to src/Adapter/PlatformServices/Services/TestDataSource.cs index ae436825d6..4d84e5da64 100644 --- a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestDataSource.cs +++ b/src/Adapter/PlatformServices/Services/TestDataSource.cs @@ -19,8 +19,6 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; using UTF = Microsoft.VisualStudio.TestTools.UnitTesting; -#pragma warning disable SA1649 // SA1649FileNameMustMatchTypeName - /// /// The platform service that provides values from data source when data driven tests are run. /// @@ -155,5 +153,3 @@ private void GetConnectionProperties(UTF.DataSourceAttribute dataSourceAttribute } #endif } - -#pragma warning restore SA1649 // SA1649FileNameMustMatchTypeName diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.3/Services/ns13TestDeployment.cs b/src/Adapter/PlatformServices/Services/TestDeployment.cs similarity index 92% rename from src/Adapter/PlatformServices.Shared/netstandard1.3/Services/ns13TestDeployment.cs rename to src/Adapter/PlatformServices/Services/TestDeployment.cs index 12c94dabca..dd577ae525 100644 --- a/src/Adapter/PlatformServices.Shared/netstandard1.3/Services/ns13TestDeployment.cs +++ b/src/Adapter/PlatformServices/Services/TestDeployment.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. -#if NETFRAMEWORK || WIN_UI || NETSTANDARD +#if NETFRAMEWORK || NETSTANDARD || NETCOREAPP || WINDOWS_UWP namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; using System; @@ -11,9 +11,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; using System.Linq; using System.Reflection; +#if NETFRAMEWORK || WIN_UI || (NETSTANDARD && !NETSTANDARD_PORTABLE) using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Deployment; +#endif using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface; +#if NETFRAMEWORK || WIN_UI || (NETSTANDARD && !NETSTANDARD_PORTABLE) using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Utilities; +#endif using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities; @@ -23,14 +27,15 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; /// public class TestDeployment : ITestDeployment { - #region Service Utility Variables +#if NETFRAMEWORK || WIN_UI || (NETSTANDARD && !NETSTANDARD_PORTABLE) +#region Service Utility Variables private readonly DeploymentItemUtility _deploymentItemUtility; private readonly DeploymentUtility _deploymentUtility; private readonly FileUtility _fileUtility; private MSTestAdapterSettings _adapterSettings; - #endregion +#endregion /// /// Initializes a new instance of the class. @@ -67,6 +72,7 @@ internal static TestRunDirectories RunDirectories get; private set; } +#endif /// /// The get deployment items. @@ -77,14 +83,19 @@ internal static TestRunDirectories RunDirectories /// A string of deployment items. public KeyValuePair[] GetDeploymentItems(MethodInfo method, Type type, ICollection warnings) { +#if WINDOWS_UWP || (NETCOREAPP && !WIN_UI) || NETSTANDARD_PORTABLE + return null; +#else return _deploymentItemUtility.GetDeploymentItems(method, _deploymentItemUtility.GetClassLevelDeploymentItems(type, warnings), warnings); +#endif } /// - /// The cleanup. + /// Cleanup deployment item directories. /// public void Cleanup() { +#if NETFRAMEWORK || WIN_UI || (NETSTANDARD && !NETSTANDARD_PORTABLE) // Delete the deployment directory if (RunDirectories != null && _adapterSettings.DeleteDeploymentDirectoryAfterTestRunIsComplete) { @@ -94,6 +105,7 @@ public void Cleanup() EqtTrace.InfoIf(EqtTrace.IsInfoEnabled, "Deleted deployment directory {0}", RunDirectories.RootDeploymentDirectory); } +#endif } /// @@ -102,7 +114,11 @@ public void Cleanup() /// The deployment output directory. public string GetDeploymentDirectory() { +#if WINDOWS_UWP || (NETCOREAPP && !WIN_UI) || NETSTANDARD_PORTABLE + return null; +#else return RunDirectories?.OutDirectory; +#endif } /// @@ -114,6 +130,9 @@ public string GetDeploymentDirectory() /// Return true if deployment is done. public bool Deploy(IEnumerable tests, IRunContext runContext, IFrameworkHandle frameworkHandle) { +#if WINDOWS_UWP || (NETCOREAPP && !WIN_UI) || NETSTANDARD_PORTABLE + return false; +#else Debug.Assert(tests != null, "tests"); // Reset runDirectories before doing deployment, so that older values of runDirectories is not picked @@ -161,8 +180,10 @@ group test by test.Source into testGroup } return true; +#endif } +#if NETFRAMEWORK || WIN_UI || (NETSTANDARD && !NETSTANDARD_PORTABLE) internal static IDictionary GetDeploymentInformation(string source) { var properties = new Dictionary(); @@ -226,7 +247,6 @@ private bool CanDeploy() return true; } +#endif } - -#pragma warning restore SA1649 // SA1649FileNameMustMatchTypeName #endif diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestSource.cs b/src/Adapter/PlatformServices/Services/TestSource.cs similarity index 98% rename from src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestSource.cs rename to src/Adapter/PlatformServices/Services/TestSource.cs index 281e970146..acbb5f3963 100644 --- a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestSource.cs +++ b/src/Adapter/PlatformServices/Services/TestSource.cs @@ -15,8 +15,6 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities; -#pragma warning disable SA1649 // SA1649FileNameMustMatchTypeName - /// /// This platform service is responsible for any data or operations to validate /// the test sources provided to the adapter. @@ -212,5 +210,3 @@ private string FindAppxSource(IEnumerable sources) } #endif } - -#pragma warning restore SA1649 // SA1649FileNameMustMatchTypeName diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestSourceHost.cs b/src/Adapter/PlatformServices/Services/TestSourceHost.cs similarity index 99% rename from src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestSourceHost.cs rename to src/Adapter/PlatformServices/Services/TestSourceHost.cs index ba179801ec..3afa525f3c 100644 --- a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestSourceHost.cs +++ b/src/Adapter/PlatformServices/Services/TestSourceHost.cs @@ -16,8 +16,6 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities; using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; -#pragma warning disable SA1649 // SA1649FileNameMustMatchTypeName - /// /// A host that loads the test source. This can be in isolation for desktop using an AppDomain or just loading the source in the current context. /// @@ -413,5 +411,3 @@ private void AddSearchDirectoriesSpecifiedInRunSettingsToAssemblyResolver(Assemb } #endif } - -#pragma warning restore SA1649 // SA1649FileNameMustMatchTypeName diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10ThreadOperations.cs b/src/Adapter/PlatformServices/Services/ThreadOperations.cs similarity index 97% rename from src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10ThreadOperations.cs rename to src/Adapter/PlatformServices/Services/ThreadOperations.cs index 2ad6d233f1..e7ee1150a9 100644 --- a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10ThreadOperations.cs +++ b/src/Adapter/PlatformServices/Services/ThreadOperations.cs @@ -10,8 +10,6 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface; -#pragma warning disable SA1649 // SA1649FileNameMustMatchTypeName - /// /// This service is responsible for any Async operations specific to a platform. /// @@ -144,4 +142,3 @@ private static void AbortThread(Thread executionThread) } #endif } -#pragma warning restore SA1649 // SA1649FileNameMustMatchTypeName diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.3/Services/ns13ThreadSafeStringWriter.cs b/src/Adapter/PlatformServices/Services/ThreadSafeStringWriter.cs similarity index 100% rename from src/Adapter/PlatformServices.Shared/netstandard1.3/Services/ns13ThreadSafeStringWriter.cs rename to src/Adapter/PlatformServices/Services/ThreadSafeStringWriter.cs diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TraceListener.cs b/src/Adapter/PlatformServices/Services/TraceListener.cs similarity index 50% rename from src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TraceListener.cs rename to src/Adapter/PlatformServices/Services/TraceListener.cs index 1d20961dcd..25d250b1d2 100644 --- a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TraceListener.cs +++ b/src/Adapter/PlatformServices/Services/TraceListener.cs @@ -1,14 +1,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -#if NETCOREAPP || WIN_UI || WINDOWS_UWP || NETSTANDARD_PORTABLE +#if NETSTANDARD || NETFRAMEWORK || NETCOREAPP || WINDOWS_UWP namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; +using System.Diagnostics; using System.IO; using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface; - -#pragma warning disable SA1649 // SA1649FileNameMustMatchTypeName +using Microsoft.VisualStudio.TestPlatform.Utilities; /// /// Internal implementation of TraceListener exposed to the user. @@ -17,41 +17,53 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; /// The virtual operations of the TraceListener are implemented here /// like Close(), Dispose() etc. /// -public class TraceListenerWrapper : ITraceListener +public class TraceListenerWrapper : +#if NETFRAMEWORK || (NETSTANDARD && !NETSTANDARD_PORTABLE) + TextWriterTraceListener, +#endif + ITraceListener { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class +#if NETFRAMEWORK || (NETSTANDARD && !NETSTANDARD_PORTABLE) + /// that derives from System.Diagnostics.TextWriterTraceListener + /// class and initializes TextWriterTraceListener object using the specified writer as recipient of the tracing or debugging output +#endif + /// . /// /// Writer instance for tracing or debugging output. public TraceListenerWrapper(TextWriter textWriter) +#if NETFRAMEWORK || (NETSTANDARD && !NETSTANDARD_PORTABLE) + : base(textWriter) +#endif { } +#if NETCOREAPP || WIN_UI || WINDOWS_UWP || NETSTANDARD_PORTABLE /// - /// Returning as this feature is not supported in ASP .net and UWP - /// - public void Close() - { - return; - } - - /// - /// Returning as this feature is not supported in ASP .net and UWP + /// Returning as this feature is not supported in ASP .NET and UWP /// public void Dispose() { - return; } /// - /// Returning null as this feature is not supported in ASP .net and UWP + /// Returning as this feature is not supported in ASP .NET and UWP /// - /// A TextWriter instance. Null for now since this is unsupported. + public void Close() + => Dispose(); +#endif + + // Summary: + // Gets the text writer of System.Diagnostics.TextWriterTraceListener.Writer + // that receives the tracing or debugging output. public TextWriter GetWriter() { +#if NETFRAMEWORK || (NETSTANDARD && !NETSTANDARD_PORTABLE) + return Writer; +#else return null; +#endif } } - -#pragma warning restore SA1649 // SA1649FileNameMustMatchTypeName #endif diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.3/Services/ns13TraceListenerManager.cs b/src/Adapter/PlatformServices/Services/TraceListenerManager.cs similarity index 78% rename from src/Adapter/PlatformServices.Shared/netstandard1.3/Services/ns13TraceListenerManager.cs rename to src/Adapter/PlatformServices/Services/TraceListenerManager.cs index 204817cb9d..fca84e43c3 100644 --- a/src/Adapter/PlatformServices.Shared/netstandard1.3/Services/ns13TraceListenerManager.cs +++ b/src/Adapter/PlatformServices/Services/TraceListenerManager.cs @@ -1,24 +1,22 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -#if NETFRAMEWORK || NETSTANDARD +#if NETFRAMEWORK || NETSTANDARD || NETCOREAPP || WINDOWS_UWP namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; using System; -using System.Collections.Generic; using System.Diagnostics; using System.IO; using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface; -#pragma warning disable SA1649 // SA1649FileNameMustMatchTypeName - /// /// Internal implementation of TraceListenerManager exposed to the user. /// Responsible for performing Add(), Remove(), Close(), Dispose() operations on traceListener object. /// public class TraceListenerManager : ITraceListenerManager { +#if NETFRAMEWORK || (NETSTANDARD && !NETSTANDARD_PORTABLE) /// /// Original output stream /// @@ -28,6 +26,7 @@ public class TraceListenerManager : ITraceListenerManager /// Original error stream /// private readonly TextWriter _origStdErr; +#endif /// /// Initializes a new instance of the class. @@ -36,12 +35,14 @@ public class TraceListenerManager : ITraceListenerManager /// A writer instance to log error messages. public TraceListenerManager(TextWriter outputWriter, TextWriter errorWriter) { +#if NETFRAMEWORK || (NETSTANDARD && !NETSTANDARD_PORTABLE) _origStdOut = Console.Out; _origStdErr = Console.Error; // Update the output/error streams with redirected streams Console.SetOut(outputWriter); Console.SetError(errorWriter); +#endif } /// @@ -50,9 +51,11 @@ public TraceListenerManager(TextWriter outputWriter, TextWriter errorWriter) /// The trace listener instance. public void Add(ITraceListener traceListener) { +#if NETFRAMEWORK || (NETSTANDARD && !NETSTANDARD_PORTABLE) // NOTE: Listeners will not get Debug events in dotnet core due to platform limitation. // Refer https://github.com/Microsoft/testfx/pull/218 for more details. Trace.Listeners.Add(traceListener as TextWriterTraceListener); +#endif } /// @@ -61,7 +64,9 @@ public void Add(ITraceListener traceListener) /// The trace listener instance. public void Remove(ITraceListener traceListener) { +#if NETFRAMEWORK || (NETSTANDARD && !NETSTANDARD_PORTABLE) Trace.Listeners.Remove(traceListener as TextWriterTraceListener); +#endif } /// @@ -71,11 +76,20 @@ public void Remove(ITraceListener traceListener) /// The trace listener instance. public void Dispose(ITraceListener traceListener) { +#if NETFRAMEWORK || (NETSTANDARD && !NETSTANDARD_PORTABLE) traceListener.Dispose(); Console.SetOut(_origStdOut); Console.SetError(_origStdErr); +#endif } -} -#pragma warning restore SA1649 // SA1649FileNameMustMatchTypeName +#if NETCOREAPP || WIN_UI || WINDOWS_UWP || NETSTANDARD_PORTABLE + /// + /// Returning as this feature is not supported in ASP .net and UWP + /// + /// The trace listener instance. + public void Close(ITraceListener traceListener) + => Dispose(traceListener); +#endif +} #endif diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TraceLogger.cs b/src/Adapter/PlatformServices/Services/TraceLogger.cs similarity index 94% rename from src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TraceLogger.cs rename to src/Adapter/PlatformServices/Services/TraceLogger.cs index a4e86a411e..cb2b2a5b5f 100644 --- a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TraceLogger.cs +++ b/src/Adapter/PlatformServices/Services/TraceLogger.cs @@ -6,8 +6,6 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface; using Microsoft.VisualStudio.TestPlatform.ObjectModel; -#pragma warning disable SA1649 // SA1649FileNameMustMatchTypeName - /// /// A service to log any trace messages from the adapter that would be shown in *.TpTrace files. /// @@ -71,5 +69,3 @@ private string PrependAdapterName(string format) } #endif } - -#pragma warning restore SA1649 // SA1649FileNameMustMatchTypeName diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.3/Utilities/ns13DeploymentItemUtility.cs b/src/Adapter/PlatformServices/Utilities/DeploymentItemUtility.cs similarity index 100% rename from src/Adapter/PlatformServices.Shared/netstandard1.3/Utilities/ns13DeploymentItemUtility.cs rename to src/Adapter/PlatformServices/Utilities/DeploymentItemUtility.cs diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.3/Utilities/ns13DeploymentUtilityBase.cs b/src/Adapter/PlatformServices/Utilities/DeploymentUtilityBase.cs similarity index 100% rename from src/Adapter/PlatformServices.Shared/netstandard1.3/Utilities/ns13DeploymentUtilityBase.cs rename to src/Adapter/PlatformServices/Utilities/DeploymentUtilityBase.cs diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.3/Utilities/ns13FileUtility.cs b/src/Adapter/PlatformServices/Utilities/FileUtility.cs similarity index 100% rename from src/Adapter/PlatformServices.Shared/netstandard1.3/Utilities/ns13FileUtility.cs rename to src/Adapter/PlatformServices/Utilities/FileUtility.cs diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.0/Utilities/ns10Validate.cs b/src/Adapter/PlatformServices/Utilities/Validate.cs similarity index 94% rename from src/Adapter/PlatformServices.Shared/netstandard1.0/Utilities/ns10Validate.cs rename to src/Adapter/PlatformServices/Utilities/Validate.cs index 1ff6da234d..6994e3dc0c 100644 --- a/src/Adapter/PlatformServices.Shared/netstandard1.0/Utilities/ns10Validate.cs +++ b/src/Adapter/PlatformServices/Utilities/Validate.cs @@ -6,8 +6,6 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Uti using System; -#pragma warning disable SA1649 // File name must match first type name - internal class Validate { ///