diff --git a/TestFx.sln b/TestFx.sln index 183aebcedf..9c851aee28 100644 --- a/TestFx.sln +++ b/TestFx.sln @@ -191,11 +191,19 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NetCore", "NetCore", "{D11C src\Adapter\Build\NetCore\MSTest.TestAdapter.props = src\Adapter\Build\NetCore\MSTest.TestAdapter.props EndProjectSection EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlatformServices.WinUI", "src\Adapter\PlatformServices.WinUI\PlatformServices.WinUI.csproj", "{F4E2876F-6E42-4DCF-B629-041A9DF7C579}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WinUI", "WinUI", "{35D010CC-CDF2-4115-BCFB-E2E3D21C1055}" + ProjectSection(SolutionItems) = preProject + src\Adapter\Build\WinUI\MSTest.TestAdapter.props = src\Adapter\Build\WinUI\MSTest.TestAdapter.props + src\Adapter\Build\WinUI\MSTest.TestAdapter.targets = src\Adapter\Build\WinUI\MSTest.TestAdapter.targets + EndProjectSection +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution src\Adapter\PlatformServices.Shared\PlatformServices.Shared.projitems*{2177c273-ae07-43b3-b87a-443e47a23c5a}*SharedItemsImports = 13 - src\TestFramework\Extension.Shared\Extension.Shared.projitems*{272ca5e1-8e81-4825-9e47-86cce02f700d}*SharedItemsImports = 13 src\TestFramework\Extension.Shared\Extension.Shared.projitems*{23b9d9a2-4aee-47e6-97b5-060df21539fb}*SharedItemsImports = 5 + src\TestFramework\Extension.Shared\Extension.Shared.projitems*{272ca5e1-8e81-4825-9e47-86cce02f700d}*SharedItemsImports = 13 src\TestFramework\Extension.Shared\Extension.Shared.projitems*{df131865-84ee-4540-8112-e88acebdea09}*SharedItemsImports = 4 EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -1197,6 +1205,30 @@ Global {23B9D9A2-4AEE-47E6-97B5-060DF21539FB}.Release|x64.Build.0 = Release|Any CPU {23B9D9A2-4AEE-47E6-97B5-060DF21539FB}.Release|x86.ActiveCfg = Release|Any CPU {23B9D9A2-4AEE-47E6-97B5-060DF21539FB}.Release|x86.Build.0 = Release|Any CPU + {F4E2876F-6E42-4DCF-B629-041A9DF7C579}.Code Analysis Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F4E2876F-6E42-4DCF-B629-041A9DF7C579}.Code Analysis Debug|Any CPU.Build.0 = Debug|Any CPU + {F4E2876F-6E42-4DCF-B629-041A9DF7C579}.Code Analysis Debug|ARM.ActiveCfg = Debug|ARM + {F4E2876F-6E42-4DCF-B629-041A9DF7C579}.Code Analysis Debug|ARM.Build.0 = Debug|ARM + {F4E2876F-6E42-4DCF-B629-041A9DF7C579}.Code Analysis Debug|x64.ActiveCfg = Debug|x64 + {F4E2876F-6E42-4DCF-B629-041A9DF7C579}.Code Analysis Debug|x64.Build.0 = Debug|x64 + {F4E2876F-6E42-4DCF-B629-041A9DF7C579}.Code Analysis Debug|x86.ActiveCfg = Debug|x86 + {F4E2876F-6E42-4DCF-B629-041A9DF7C579}.Code Analysis Debug|x86.Build.0 = Debug|x86 + {F4E2876F-6E42-4DCF-B629-041A9DF7C579}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F4E2876F-6E42-4DCF-B629-041A9DF7C579}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F4E2876F-6E42-4DCF-B629-041A9DF7C579}.Debug|ARM.ActiveCfg = Debug|ARM + {F4E2876F-6E42-4DCF-B629-041A9DF7C579}.Debug|ARM.Build.0 = Debug|ARM + {F4E2876F-6E42-4DCF-B629-041A9DF7C579}.Debug|x64.ActiveCfg = Debug|x64 + {F4E2876F-6E42-4DCF-B629-041A9DF7C579}.Debug|x64.Build.0 = Debug|x64 + {F4E2876F-6E42-4DCF-B629-041A9DF7C579}.Debug|x86.ActiveCfg = Debug|x86 + {F4E2876F-6E42-4DCF-B629-041A9DF7C579}.Debug|x86.Build.0 = Debug|x86 + {F4E2876F-6E42-4DCF-B629-041A9DF7C579}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F4E2876F-6E42-4DCF-B629-041A9DF7C579}.Release|Any CPU.Build.0 = Release|Any CPU + {F4E2876F-6E42-4DCF-B629-041A9DF7C579}.Release|ARM.ActiveCfg = Release|ARM + {F4E2876F-6E42-4DCF-B629-041A9DF7C579}.Release|ARM.Build.0 = Release|ARM + {F4E2876F-6E42-4DCF-B629-041A9DF7C579}.Release|x64.ActiveCfg = Release|x64 + {F4E2876F-6E42-4DCF-B629-041A9DF7C579}.Release|x64.Build.0 = Release|x64 + {F4E2876F-6E42-4DCF-B629-041A9DF7C579}.Release|x86.ActiveCfg = Release|x86 + {F4E2876F-6E42-4DCF-B629-041A9DF7C579}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1263,6 +1295,8 @@ Global {E5E58613-82FC-44CD-B75F-4F1C7ED52D0D} = {D53BD452-F69F-4FB3-8B98-386EDA28A4C8} {23B9D9A2-4AEE-47E6-97B5-060DF21539FB} = {E48AC786-E150-4F41-9A16-32F02E4493D8} {D11C6664-1C4E-48F0-AA92-7F5BADC6F82C} = {CA01DAF5-8D9D-496E-9AD3-94BB7FBB2D34} + {F4E2876F-6E42-4DCF-B629-041A9DF7C579} = {24088844-2107-4DB2-8F3F-CBCA94FC4B28} + {35D010CC-CDF2-4115-BCFB-E2E3D21C1055} = {CA01DAF5-8D9D-496E-9AD3-94BB7FBB2D34} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {31E0F4D5-975A-41CC-933E-545B2201FAF9} diff --git a/src/Adapter/Build/WinUI/MSTest.TestAdapter.props b/src/Adapter/Build/WinUI/MSTest.TestAdapter.props new file mode 100644 index 0000000000..aa6baccb4a --- /dev/null +++ b/src/Adapter/Build/WinUI/MSTest.TestAdapter.props @@ -0,0 +1,33 @@ + + + + + Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll + PreserveNewest + False + + + Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.dll + PreserveNewest + False + + + Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll + PreserveNewest + False + + + Microsoft.TestPlatform.AdapterUtilities.dll + PreserveNewest + False + + + + + + + + diff --git a/src/Adapter/Build/WinUI/MSTest.TestAdapter.targets b/src/Adapter/Build/WinUI/MSTest.TestAdapter.targets new file mode 100644 index 0000000000..b0404380c6 --- /dev/null +++ b/src/Adapter/Build/WinUI/MSTest.TestAdapter.targets @@ -0,0 +1,42 @@ + + + + true + + + + + + + + + + + + + + + + + + %(CurrentUICultureHierarchy.Identity) + + + + + + + + + $(CurrentUICultureHierarchy)\%(FileName).resources.dll + PreserveNewest + %(FullPath) + False + + + + + \ No newline at end of file diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.0/ns10RecursiveDirectoryPath.cs b/src/Adapter/PlatformServices.Shared/netstandard1.0/ns10RecursiveDirectoryPath.cs index 9064d432c1..68bf86274d 100644 --- a/src/Adapter/PlatformServices.Shared/netstandard1.0/ns10RecursiveDirectoryPath.cs +++ b/src/Adapter/PlatformServices.Shared/netstandard1.0/ns10RecursiveDirectoryPath.cs @@ -54,6 +54,9 @@ public RecursiveDirectoryPath(string dirPath, bool includeSubDirectories) /// The . /// [SecurityCritical] +#if NET5_0 + [Obsolete] +#endif public override object InitializeLifetimeService() { return null; diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.3/Services/ns13TestDeployment.cs b/src/Adapter/PlatformServices.Shared/netstandard1.3/Services/ns13TestDeployment.cs index 6a66d03ddc..386fb021db 100644 --- a/src/Adapter/PlatformServices.Shared/netstandard1.3/Services/ns13TestDeployment.cs +++ b/src/Adapter/PlatformServices.Shared/netstandard1.3/Services/ns13TestDeployment.cs @@ -139,7 +139,7 @@ public bool Deploy(IEnumerable tests, IRunContext runContext, IFramewo } // Object model currently does not have support for SuspendCodeCoverage. We can remove this once support is added -#if !NETSTANDARD1_5 +#if !NETSTANDARD1_5 && !NET5_0 using (new SuspendCodeCoverage()) #endif { diff --git a/src/Adapter/PlatformServices.WinUI/Friends.cs b/src/Adapter/PlatformServices.WinUI/Friends.cs new file mode 100644 index 0000000000..ddccecfdf2 --- /dev/null +++ b/src/Adapter/PlatformServices.WinUI/Friends.cs @@ -0,0 +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. + +// Friend assemblies +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.WinUI.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] \ No newline at end of file diff --git a/src/Adapter/PlatformServices.WinUI/PlatformServices.WinUI.csproj b/src/Adapter/PlatformServices.WinUI/PlatformServices.WinUI.csproj new file mode 100644 index 0000000000..edb014985b --- /dev/null +++ b/src/Adapter/PlatformServices.WinUI/PlatformServices.WinUI.csproj @@ -0,0 +1,102 @@ + + + ..\..\..\ + NetCore + + + + Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices + Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices + net5.0-windows10.0.18362.0 + + 10.0.18362.0 + 10.0.17763.0 + $(TargetPlatformMinVersion) + + false + true + false + true + + + + Constants.cs + + + Services\ns10ReflectionOperations.cs + + + Services\ns10DiaSessionOperations.cs + + + Services\ns10TestContextImplementation.cs + + + Services\ns10TestDataSource.cs + + + Services\ns13TestDeployment.cs + + + + + + + + + + + + + + + + + + Services\ns10ThreadOperations.cs + + + Services\ns10TraceListener.cs + + + Services\ns10TraceListenerManager.cs + + + + + + + + + Resources\Resource.Designer.cs + True + True + Resource.resx + + + + + + Resources\Resource.resx + ResXFileCodeGenerator + Resource.Designer.cs + Designer + Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Adapter/PlatformServices.WinUI/Properties/AssemblyInfo.cs b/src/Adapter/PlatformServices.WinUI/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..8887cf230d --- /dev/null +++ b/src/Adapter/PlatformServices.WinUI/Properties/AssemblyInfo.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyDescription("")] +[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] + +// This is set by GlobalAssemblyInfo which is auto-generated due to import of Microbuild.Settings.targets +// [assembly: AssemblyVersion("1.0.0.0")] +// [assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: ComVisible(false)] + +[assembly: TypeForwardedTo(typeof(SerializableAttribute))] +[assembly: TypeForwardedTo(typeof(MarshalByRefObject))] \ No newline at end of file diff --git a/src/Adapter/PlatformServices.WinUI/Resources/README.txt b/src/Adapter/PlatformServices.WinUI/Resources/README.txt new file mode 100644 index 0000000000..10c5456835 --- /dev/null +++ b/src/Adapter/PlatformServices.WinUI/Resources/README.txt @@ -0,0 +1 @@ +This file is kept to commit Resources directory as language specific resx files needs to be copied here. \ No newline at end of file diff --git a/src/Adapter/PlatformServices.WinUI/Services/WinUIAdapterTraceLogger.cs b/src/Adapter/PlatformServices.WinUI/Services/WinUIAdapterTraceLogger.cs new file mode 100644 index 0000000000..2eabfcec33 --- /dev/null +++ b/src/Adapter/PlatformServices.WinUI/Services/WinUIAdapterTraceLogger.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +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. + /// + public class AdapterTraceLogger : IAdapterTraceLogger + { + /// + /// Log an error in a given format. + /// + /// The format. + /// The args. + public void LogError(string format, params object[] args) + { + EqtTrace.ErrorIf(EqtTrace.IsErrorEnabled, format, args); + } + + /// + /// Log a warning in a given format. + /// + /// The format. + /// The args. + public void LogWarning(string format, params object[] args) + { + EqtTrace.WarningIf(EqtTrace.IsWarningEnabled, format, args); + } + + /// + /// Log an information message in a given format. + /// + /// The format. + /// The args. + public void LogInfo(string format, params object[] args) + { + EqtTrace.InfoIf(EqtTrace.IsInfoEnabled, format, args); + } + } + +#pragma warning restore SA1649 // SA1649FileNameMustMatchTypeName +} diff --git a/src/Adapter/PlatformServices.WinUI/Services/WinUIFileOperations.cs b/src/Adapter/PlatformServices.WinUI/Services/WinUIFileOperations.cs new file mode 100644 index 0000000000..6c68de2a33 --- /dev/null +++ b/src/Adapter/PlatformServices.WinUI/Services/WinUIFileOperations.cs @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices +{ + using global::System; + using global::System.IO; + using global::System.Reflection; + using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface; + using Microsoft.VisualStudio.TestPlatform.ObjectModel; + +#pragma warning disable SA1649 // SA1649FileNameMustMatchTypeName + + /// + /// The file operations. + /// + public class FileOperations : IFileOperations + { + /// + /// Loads an assembly. + /// + /// The assembly name. + /// + /// Indicates whether this should be a reflection only load. + /// + /// The . + public Assembly LoadAssembly(string assemblyName, bool isReflectionOnly) + { + string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(assemblyName); + return Assembly.Load(new AssemblyName(fileNameWithoutExtension)); + } + + /// + /// Gets the path to the .DLL of the assembly. + /// + /// The assembly. + /// Path to the .DLL of the assembly. + public string GetAssemblyPath(Assembly assembly) + { + return assembly.Location; + } + + /// + /// Verifies if file exists in context. + /// + /// The assembly file name. + /// The . + public bool DoesFileExist(string assemblyFileName) + { + var fileExists = false; + + try + { + var fileNameWithoutPath = Path.GetFileName(assemblyFileName); + var searchTask = Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(fileNameWithoutPath).AsTask(); + searchTask.Wait(); + fileExists = searchTask.Result != null; + } + catch (Exception) + { + // ignore + } + + return fileExists; + } + + /// + /// Creates a Navigation session for the source file. + /// This is used to get file path and line number information for its components. + /// + /// The source file. + /// A Navigation session instance for the current platform. + /// . + /// + public object CreateNavigationSession(string source) + { + return DiaSessionOperations.CreateNavigationSession(source); + } + + /// + /// Get's the navigation data for a navigation session. + /// + /// The navigation session. + /// The class name. + /// The method name. + /// The min line number. + /// The file name. + public void GetNavigationData(object navigationSession, string className, string methodName, out int minLineNumber, out string fileName) + { + DiaSessionOperations.GetNavigationData(navigationSession, className, methodName, out minLineNumber, out fileName); + } + + /// + /// Dispose's the navigation session instance. + /// + /// The navigation session. + public void DisposeNavigationSession(object navigationSession) + { + DiaSessionOperations.DisposeNavigationSession(navigationSession); + } + + /// + /// Gets the full file path of an assembly file. + /// + /// The assembly file name. + /// The full file path + /// . + /// + public string GetFullFilePath(string assemblyFileName) + { + return (SafeInvoke(() => Path.GetFullPath(assemblyFileName)) as string) ?? assemblyFileName; + } + + private static object SafeInvoke(Func action, string messageFormatOnException = null) + { + try + { + return action.Invoke(); + } + catch (Exception exception) + { + if (string.IsNullOrEmpty(messageFormatOnException)) + { + messageFormatOnException = "{0}"; + } + + EqtTrace.ErrorIf(EqtTrace.IsErrorEnabled, messageFormatOnException, exception.Message); + } + + return null; + } + } + +#pragma warning restore SA1649 // SA1649FileNameMustMatchTypeName +} diff --git a/src/Adapter/PlatformServices.WinUI/Services/WinUITestSource.cs b/src/Adapter/PlatformServices.WinUI/Services/WinUITestSource.cs new file mode 100644 index 0000000000..4b201042fa --- /dev/null +++ b/src/Adapter/PlatformServices.WinUI/Services/WinUITestSource.cs @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices +{ + using global::System; + using global::System.Collections.Generic; + using global::System.IO; + using global::System.Linq; + using global::System.Reflection; + + using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface; + +#pragma warning disable SA1649 // SA1649FileNameMustMatchTypeName + + /// + /// This platform service is responsible for any data or operations to validate + /// the test sources provided to the adapter. + /// + public class TestSource : ITestSource + { + private const string SystemAssembliesPrefix = "system."; + + private static IEnumerable executableExtensions = new HashSet() + { + Constants.ExeExtension + }; + + private static HashSet systemAssemblies = new HashSet(new string[] + { + "MICROSOFT.CSHARP.DLL", + "MICROSOFT.VISUALBASIC.DLL", + "CLRCOMPRESSION.DLL", + }); + + // Well known platform assemblies. + private static HashSet platformAssemblies = new HashSet(new string[] + { + "MICROSOFT.VISUALSTUDIO.TESTPLATFORM.TESTFRAMEWORK.DLL", + "MICROSOFT.VISUALSTUDIO.TESTPLATFORM.TESTFRAMEWORK.EXTENSIONS.CORE.DLL", + "MICROSOFT.VISUALSTUDIO.TESTPLATFORM.CORE.DLL", + "MICROSOFT.VISUALSTUDIO.TESTPLATFORM.COMMON.DLL", + "MICROSOFT.VISUALSTUDIO.TESTPLATFORM.TESTEXECUTOR.CORE.DLL", + "MICROSOFT.VISUALSTUDIO.TESTPLATFORM.EXTENSIONS.MSAPPCONTAINERADAPTER.DLL", + "MICROSOFT.VISUALSTUDIO.TESTPLATFORM.EXTENSIONS.MSPHONEADAPTER.DLL", + "MICROSOFT.VISUALSTUDIO.TESTPLATFORM.OBJECTMODEL.DLL", + "VSTEST_EXECUTIONENGINE_PLATFORMBRIDGE.DLL", + "VSTEST_EXECUTIONENGINE_PLATFORMBRIDGE.WINMD", + "VSTEST.EXECUTIONENGINE.WINDOWSPHONE.DLL", + }); + + /// + /// Gets the set of valid extensions for sources targeting this platform. + /// + public IEnumerable ValidSourceExtensions => new List { Constants.DllExtension, Constants.ExeExtension, Constants.AppxPackageExtension }; + + /// + /// Verifies if the assembly provided is referenced by the source. + /// + /// The assembly name. + /// The source. + /// True if the assembly is referenced. + public bool IsAssemblyReferenced(AssemblyName assemblyName, string source) + { + // This code will get hit when Discovery happens during Run Tests. + // Since Discovery during Discover Tests would have validated the presence of Unit Test Framework as reference, + // no need to do validation again. + // Simply return true. + return true; + } + + /// + /// Gets the set of sources (dll's/exe's) that contain tests. If a source is a package(appx), return the file(dll/exe) that contains tests from it. + /// + /// Sources given to the adapter. + /// Sources that contains tests. . + public IEnumerable GetTestSources(IEnumerable sources) + { + string appxSource; + if ((appxSource = this.FindAppxSource(sources)) != null) + { + var appxSourceDirectory = Path.GetDirectoryName(appxSource); + + List newSources = new List(); + + var fileSearchTask = Windows.ApplicationModel.Package.Current.InstalledLocation.GetFilesAsync().AsTask(); + fileSearchTask.Wait(); + foreach (var filePath in fileSearchTask.Result) + { + var fileName = filePath.Name; + var isExtSupported = + executableExtensions.Any(ext => fileName.EndsWith(ext, StringComparison.OrdinalIgnoreCase)); + + if (isExtSupported && !fileName.StartsWith(SystemAssembliesPrefix, StringComparison.OrdinalIgnoreCase) + && !platformAssemblies.Contains(fileName.ToUpperInvariant()) + && !systemAssemblies.Contains(fileName.ToUpperInvariant())) + { + // WinUI Desktop uses .net 5, which builds both a .dll and an .exe. + // The manifest will provide the .exe, but the tests are inside the .dll, so we replace the name here. + newSources.Add(Path.Combine(appxSourceDirectory, Path.ChangeExtension(fileName, Constants.DllExtension))); + } + } + + return newSources; + } + + return sources; + } + + /// + /// Checks if given list of sources contains any ".appx" source. + /// + /// The list of sources. + /// True if there is an appx source. + private string FindAppxSource(IEnumerable sources) + { + foreach (string source in sources) + { + if (string.Compare(Path.GetExtension(source), Constants.AppxPackageExtension, StringComparison.OrdinalIgnoreCase) == 0) + { + return source; + } + } + + return null; + } + } + +#pragma warning restore SA1649 // SA1649FileNameMustMatchTypeName +} diff --git a/src/Package/MSTest.TestAdapter.Enu.nuspec b/src/Package/MSTest.TestAdapter.Enu.nuspec index b11801ed8a..0ba0e7ed02 100644 --- a/src/Package/MSTest.TestAdapter.Enu.nuspec +++ b/src/Package/MSTest.TestAdapter.Enu.nuspec @@ -8,12 +8,13 @@ Microsoft Microsoft - The adapter to discover and execute MSTest Framework based tests. + The adapter to discover and execute MSTest Framework based tests. - Supported platforms: - - .NET 4.5.0+ - - .NET Core 1.0+ (Universal Windows Apps 10+) (Visual Studio 2017) - - ASP.NET Core 1.0+ (Visual Studio 2017) + Supported platforms: + - .NET 4.5.0+ + - .NET Core 1.0+ (Universal Windows Apps 10+) (Visual Studio 2017) + - .NET 5.0 Windows.17763+ (WinUI Desktop Apps) (Visual Studio 2019) + - ASP.NET Core 1.0+ (Visual Studio 2017) https://github.com/microsoft/testfx LICENSE @@ -27,7 +28,7 @@ - + @@ -37,7 +38,9 @@ - + + + @@ -63,6 +66,12 @@ + + + + + + diff --git a/src/Package/MSTest.TestAdapter.nuspec b/src/Package/MSTest.TestAdapter.nuspec index 6f00113747..dadee52f24 100644 --- a/src/Package/MSTest.TestAdapter.nuspec +++ b/src/Package/MSTest.TestAdapter.nuspec @@ -13,6 +13,7 @@ Supported platforms: - .NET 4.5.0+ - .NET Core 1.0+ (Universal Windows Apps 10+) (Visual Studio 2017) + - .NET 5.0 Windows.17763+ (WinUI Desktop Apps) (Visual Studio 2019) - ASP.NET Core 1.0+ (Visual Studio 2017) https://github.com/microsoft/testfx @@ -37,7 +38,9 @@ - + + + @@ -63,6 +66,12 @@ + + + + + + diff --git a/src/Package/MSTest.TestAdapter.symbols.nuspec b/src/Package/MSTest.TestAdapter.symbols.nuspec index 697c607c1b..014399ba0e 100644 --- a/src/Package/MSTest.TestAdapter.symbols.nuspec +++ b/src/Package/MSTest.TestAdapter.symbols.nuspec @@ -8,12 +8,13 @@ Microsoft Microsoft - The adapter to discover and execute MSTest Framework based tests. + The adapter to discover and execute MSTest Framework based tests. - Supported platforms: - - .NET 4.5.0+ - - .NET Core 1.0+ (Universal Windows Apps 10+) (Visual Studio 2017) - - ASP.NET Core 1.0+ (Visual Studio 2017) + Supported platforms: + - .NET 4.5.0+ + - .NET Core 1.0+ (Universal Windows Apps 10+) (Visual Studio 2017) + - .NET 5.0 Windows.17763+ (WinUI Desktop Apps) (Visual Studio 2019) + - ASP.NET Core 1.0+ (Visual Studio 2017) https://github.com/microsoft/testfx LICENSE @@ -36,7 +37,9 @@ - + + + @@ -62,6 +65,12 @@ + + + + + + @@ -79,6 +88,9 @@ + + + diff --git a/src/Package/MSTest.TestFramework.enu.nuspec b/src/Package/MSTest.TestFramework.enu.nuspec index ea3bc49682..5d52d6f4e3 100644 --- a/src/Package/MSTest.TestFramework.enu.nuspec +++ b/src/Package/MSTest.TestFramework.enu.nuspec @@ -14,9 +14,10 @@ Supported platforms: - .NET 4.5.0+ - .NET Core 1.0+ (Universal Windows Apps 10+) + - .NET 5.0 Windows.17763+ (WinUI Desktop Apps) (Visual Studio 2019) - ASP.NET Core 1.0+ - To discover and execute tests install MSTest.TestAdapter. + To discover and execute tests install MSTest.TestAdapter. To discover and execute tests for project.json based projects install dotnet-test-mstest. diff --git a/src/Package/MSTest.TestFramework.nuspec b/src/Package/MSTest.TestFramework.nuspec index d7698b58f9..e485a1bb5a 100644 --- a/src/Package/MSTest.TestFramework.nuspec +++ b/src/Package/MSTest.TestFramework.nuspec @@ -14,6 +14,7 @@ Supported platforms: - .NET 4.5.0+ - .NET Core 1.0+ (Universal Windows Apps 10+, DNX Core 5+) + - .NET 5.0 Windows.17763+ (WinUI Desktop Apps) (Visual Studio 2019) - ASP.NET Core 1.0+ To discover and execute tests install MSTest.TestAdapter. diff --git a/src/Package/MSTest.TestFramework.symbols.nuspec b/src/Package/MSTest.TestFramework.symbols.nuspec index 86d6927aac..07606c4dd3 100644 --- a/src/Package/MSTest.TestFramework.symbols.nuspec +++ b/src/Package/MSTest.TestFramework.symbols.nuspec @@ -13,9 +13,10 @@ Supported platforms: - .NET 4.5.0+ - .NET Core 1.0+ (Universal Windows Apps 10+) + - .NET 5.0 Windows.17763+ (WinUI Desktop Apps) (Visual Studio 2019) - ASP.NET Core 1.0+ - To discover and execute tests install MSTest.TestAdapter. + To discover and execute tests install MSTest.TestAdapter. To discover and execute tests for project.json based projects install dotnet-test-mstest. diff --git a/src/TestFramework/Extension.WinUI/Extension.WinUI.csproj b/src/TestFramework/Extension.WinUI/Extension.WinUI.csproj index 58aa6b4c42..c95ab1e3e5 100644 --- a/src/TestFramework/Extension.WinUI/Extension.WinUI.csproj +++ b/src/TestFramework/Extension.WinUI/Extension.WinUI.csproj @@ -10,8 +10,8 @@ net5.0-windows10.0.18362.0 10.0.18362.0 - 10.0.18362.0 - 10.0.18362.0 + 10.0.17763.0 + 10.0.17763.0 false win10-x86;win10-x64;win10-arm64