diff --git a/.gitignore b/.gitignore index 9523d94f87..845632e36a 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,7 @@ build*.log build*.wrn build*.err *.binlog +*.svclog # MSTest test Results [Tt]est[Rr]esult*/ diff --git a/TestPlatform.sln b/TestPlatform.sln index 9d14b72dc8..321f401295 100644 --- a/TestPlatform.sln +++ b/TestPlatform.sln @@ -65,6 +65,20 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "vstest.console.UnitTests", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests", "test\Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests\Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests.csproj", "{BFF7714C-E5A3-4EEB-B04B-5FA47F29AD03}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "perf", "perf", "{0D4DF78D-7E5F-4516-B19F-E6AA71A1DBF4}" + ProjectSection(SolutionItems) = preProject + scripts\perf\perf.ps1 = scripts\perf\perf.ps1 + scripts\perf\perfconfig.csv = scripts\perf\perfconfig.csv + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{DED1590A-ED25-413B-8590-006A4DD5B2FD}" + ProjectSection(SolutionItems) = preProject + scripts\build\TestPlatform.Dependencies.props = scripts\build\TestPlatform.Dependencies.props + scripts\build\TestPlatform.Localization.targets = scripts\build\TestPlatform.Localization.targets + scripts\build\TestPlatform.Settings.targets = scripts\build\TestPlatform.Settings.targets + scripts\build\TestPlatform.targets = scripts\build\TestPlatform.targets + EndProjectSection +EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{EE49F5DC-5835-4AE3-B3BA-8BDE0AD56330}" ProjectSection(SolutionItems) = preProject scripts\build.ps1 = scripts\build.ps1 @@ -73,6 +87,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{EE49 scripts\stylecop.test.ruleset = scripts\stylecop.test.ruleset scripts\test.ps1 = scripts\test.ps1 scripts\verify-sign.ps1 = scripts\verify-sign.ps1 + scripts\verify-nupkgs.ps1 = scripts\verify-nupkgs.ps1 + scripts\PortableToFullPdb.ps1 = scripts\PortableToFullPdb.ps1 + scripts\vsts-prebuild.ps1 = scripts\vsts-prebuild.ps1 + scripts\write-release-notes.ps1 = scripts\write-release-notes.ps1 + scripts\build.sh = scripts\build.sh + scripts\test.sh = scripts\test.sh EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{E344E0A2-7715-4C7F-BAF7-D64EA94CB19B}" @@ -100,14 +120,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "datacollector.PlatformTests EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Platform", "Platform", "{7D4082EA-7AC9-4DFB-98E8-C5E08BDC0EC3}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{DED1590A-ED25-413B-8590-006A4DD5B2FD}" - ProjectSection(SolutionItems) = preProject - scripts\build\TestPlatform.Dependencies.props = scripts\build\TestPlatform.Dependencies.props - scripts\build\TestPlatform.Localization.targets = scripts\build\TestPlatform.Localization.targets - scripts\build\TestPlatform.Settings.targets = scripts\build\TestPlatform.Settings.targets - scripts\build\TestPlatform.targets = scripts\build\TestPlatform.targets - EndProjectSection -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "package", "src\package\package\package.csproj", "{E141A226-CC0A-4F26-BD17-4AE427D81C3B}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Platform", "Platform", "{376C19DE-31E2-4FF6-88FC-0D0D6233C999}" @@ -132,12 +144,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DataCollectors", "DataColle EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.TestPlatform.Extensions.EventLogCollector.UnitTests", "test\DataCollectors\Microsoft.TestPlatform.Extensions.EventLogCollector.UnitTests\Microsoft.TestPlatform.Extensions.EventLogCollector.UnitTests.csproj", "{21DB138B-85B7-479E-91FE-01E0F972EC56}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "perf", "perf", "{0D4DF78D-7E5F-4516-B19F-E6AA71A1DBF4}" - ProjectSection(SolutionItems) = preProject - scripts\perf\perf.ps1 = scripts\perf\perf.ps1 - scripts\perf\perfconfig.csv = scripts\perf\perfconfig.csv - EndProjectSection -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "vstest.console.PlatformTests", "test\vstest.console.PlatformTests\vstest.console.PlatformTests.csproj", "{8C068694-23A2-47A2-A0DD-DB82D0AF0142}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.TestPlatform.Common.PlatformTests", "test\Microsoft.TestPlatform.Common.PlatformTests\Microsoft.TestPlatform.Common.PlatformTests.csproj", "{24C7683D-2607-4901-B8EB-83A57E49E93D}" @@ -152,7 +158,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.TestPlatform.Exte EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "coverlet.collector", "test\coverlet.collector\coverlet.collector.csproj", "{074F5BD6-DC05-460B-B78F-044D125FD787}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.TestPlatform.ObjectModel.ManagedNameUtilities.UnitTests", "test\Microsoft.TestPlatform.ObjectModel.ManagedNameUtilities.UnitTests\Microsoft.TestPlatform.ObjectModel.ManagedNameUtilities.UnitTests.csproj", "{DCD0C39E-C78C-4A44-B0BD-7325254A2E97}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.TestPlatform.AdapterUtilities.UnitTests", "test\Microsoft.TestPlatform.AdapterUtilities.UnitTests\Microsoft.TestPlatform.AdapterUtilities.UnitTests.csproj", "{DCD0C39E-C78C-4A44-B0BD-7325254A2E97}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.TestPlatform.AdapterUtilities", "src\Microsoft.TestPlatform.AdapterUtilities\Microsoft.TestPlatform.AdapterUtilities.csproj", "{2DE99835-A3A3-4922-82AD-6D10D284816D}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -764,6 +772,18 @@ Global {DCD0C39E-C78C-4A44-B0BD-7325254A2E97}.Release|x64.Build.0 = Release|Any CPU {DCD0C39E-C78C-4A44-B0BD-7325254A2E97}.Release|x86.ActiveCfg = Release|Any CPU {DCD0C39E-C78C-4A44-B0BD-7325254A2E97}.Release|x86.Build.0 = Release|Any CPU + {2DE99835-A3A3-4922-82AD-6D10D284816D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2DE99835-A3A3-4922-82AD-6D10D284816D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2DE99835-A3A3-4922-82AD-6D10D284816D}.Debug|x64.ActiveCfg = Debug|Any CPU + {2DE99835-A3A3-4922-82AD-6D10D284816D}.Debug|x64.Build.0 = Debug|Any CPU + {2DE99835-A3A3-4922-82AD-6D10D284816D}.Debug|x86.ActiveCfg = Debug|Any CPU + {2DE99835-A3A3-4922-82AD-6D10D284816D}.Debug|x86.Build.0 = Debug|Any CPU + {2DE99835-A3A3-4922-82AD-6D10D284816D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2DE99835-A3A3-4922-82AD-6D10D284816D}.Release|Any CPU.Build.0 = Release|Any CPU + {2DE99835-A3A3-4922-82AD-6D10D284816D}.Release|x64.ActiveCfg = Release|Any CPU + {2DE99835-A3A3-4922-82AD-6D10D284816D}.Release|x64.Build.0 = Release|Any CPU + {2DE99835-A3A3-4922-82AD-6D10D284816D}.Release|x86.ActiveCfg = Release|Any CPU + {2DE99835-A3A3-4922-82AD-6D10D284816D}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -831,6 +851,7 @@ Global {41248B96-6E15-4E5E-A78F-859897676814} = {020E15EA-731F-4667-95AF-226671E0C3AE} {074F5BD6-DC05-460B-B78F-044D125FD787} = {D9A30E32-D466-4EC5-B4F2-62E17562279B} {DCD0C39E-C78C-4A44-B0BD-7325254A2E97} = {B27FAFDF-2DBA-4AB0-BA85-FD5F21D359D6} + {2DE99835-A3A3-4922-82AD-6D10D284816D} = {7D4082EA-7AC9-4DFB-98E8-C5E08BDC0EC3} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {0541B30C-FF51-4E28-B172-83F5F3934BCD} diff --git a/scripts/build.ps1 b/scripts/build.ps1 index fb6ced6651..9a6f5a19e8 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -334,6 +334,9 @@ function Publish-Package $dotnetExe = Get-DotNetPath $fullCLRPackage451Dir = Get-FullCLRPackageDirectory $fullCLRPackage45Dir = Get-FullCLRPackageDirectory45 + $uap100PackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\$TPB_TargetFrameworkUap100"); + $net20PackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\net20"); + $net35PackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\net35"); $netstandard10PackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\$TPB_TargetFrameworkNS10"); $netstandard13PackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\$TPB_TargetFrameworkNS13"); $netstandard20PackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\$TPB_TargetFrameworkNS20"); @@ -478,6 +481,17 @@ function Publish-Package $TPB_TargetFrameworkUap100 = $testhostUapPackageDir # uap10.0 } + ################################################################################ + # Publish Microsoft.TestPlatform.AdapterUtilities + Copy-Bulk -root (Join-Path $env:TP_ROOT_DIR "src\Microsoft.TestPlatform.AdapterUtilities\bin\$TPB_Configuration") ` + -files @{ + # "net20" = $net20PackageDir # net20 \ net20, and net35 isn't supported by the Test Platform + # "net35" = $net35PackageDir # net35 / but this package supports, so adding targets. + $TPB_TargetFrameworkNS10 = $netstandard10PackageDir # netstandard1_0 + $TPB_TargetFrameworkNS20 = $netstandard20PackageDir # netstandard2_0 + $TPB_TargetFrameworkUap100 = $uap100PackageDir # uap10.0 + } + ################################################################################ # Publish msdia $comComponentsDirectory = Join-Path $env:TP_PACKAGES_DIR "Microsoft.Internal.Dia\14.0.0\contentFiles\any\any\ComComponents" @@ -805,16 +819,19 @@ function Create-NugetPackages $tpNuspecDir = Join-Path $env:TP_PACKAGE_PROJ_DIR "nuspec" # Copy over the nuspecs to the staging directory - $nuspecFiles = @("TestPlatform.TranslationLayer.nuspec", - "TestPlatform.ObjectModel.nuspec", - "TestPlatform.TestHost.nuspec", - "TestPlatform.CLI.nuspec", - "TestPlatform.Build.nuspec", - "TestPlatform.Extensions.TrxLogger.nuspec", - "Microsoft.NET.Test.Sdk.nuspec", - "Microsoft.TestPlatform.nuspec", - "Microsoft.TestPlatform.Portable.nuspec", - "Microsoft.CodeCoverage.nuspec") + $nuspecFiles = @( + "Microsoft.CodeCoverage.nuspec", + "Microsoft.NET.Test.Sdk.nuspec", + "Microsoft.TestPlatform.AdapterUtilities.nuspec", + "Microsoft.TestPlatform.nuspec", + "Microsoft.TestPlatform.Portable.nuspec", + "TestPlatform.Build.nuspec", + "TestPlatform.CLI.nuspec", + "TestPlatform.Extensions.TrxLogger.nuspec", + "TestPlatform.ObjectModel.nuspec", + "TestPlatform.TestHost.nuspec", + "TestPlatform.TranslationLayer.nuspec" + ) $targetFiles = @("Microsoft.CodeCoverage.targets") $propFiles = @("Microsoft.NET.Test.Sdk.props", "Microsoft.CodeCoverage.props") diff --git a/scripts/build.sh b/scripts/build.sh index 6325f174ac..e06fb9721b 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -215,18 +215,18 @@ function restore_package() log "restore_package: Start restoring packages to $TP_PACKAGES_DIR." local start=$SECONDS - if [[ $TP_USE_REPO_API = 0 ]]; then - log ".. .. Restore: Source: $TP_ROOT_DIR/src/package/external/external.csproj" - $dotnet restore $TP_ROOT_DIR/src/package/external/external.csproj --packages $TP_PACKAGES_DIR -v:minimal -warnaserror -p:Version=$TPB_Version || failed=true - else - log ".. .. Restore: Source: $TP_ROOT_DIR/src/package/external/external_BuildFromSource.csproj" - $dotnet restore $TP_ROOT_DIR/src/package/external/external.csproj --packages $TP_PACKAGES_DIR -v:minimal -warnaserror -p:Version=$TPB_Version -p:DotNetBuildFromSource=true || failed=true - fi - - if [ "$failed" = true ]; then - error "Failed to restore packages." - return 2 - fi + if [[ $TP_USE_REPO_API = 0 ]]; then + log ".. .. Restore: Source: $TP_ROOT_DIR/src/package/external/external.csproj" + $dotnet restore $TP_ROOT_DIR/src/package/external/external.csproj --packages $TP_PACKAGES_DIR -v:minimal -warnaserror -p:Version=$TPB_Version || failed=true + else + log ".. .. Restore: Source: $TP_ROOT_DIR/src/package/external/external_BuildFromSource.csproj" + $dotnet restore $TP_ROOT_DIR/src/package/external/external.csproj --packages $TP_PACKAGES_DIR -v:minimal -warnaserror -p:Version=$TPB_Version -p:DotNetBuildFromSource=true || failed=true + fi + + if [ "$failed" = true ]; then + error "Failed to restore packages." + return 2 + fi log "restore_package: Complete. Elapsed $(( SECONDS - start ))s." } @@ -245,9 +245,9 @@ function invoke_build() if [ -z "$PROJECT_NAME_PATTERNS" ] then if [[ $TP_USE_REPO_API = 0 ]]; then - $dotnet build $TPB_Solution --configuration $TPB_Configuration -v:minimal -p:Version=$TPB_Version -p:CIBuild=$TPB_CIBuild -p:LocalizedBuild=$TPB_LocalizedBuild || failed=true + $dotnet build $TPB_Solution --configuration $TPB_Configuration -v:minimal -p:Version=$TPB_Version -p:CIBuild=$TPB_CIBuild -p:LocalizedBuild=$TPB_LocalizedBuild -bl:TestPlatform.binlog || failed=true else - $dotnet build $TPB_Build_From_Source_Solution --configuration $TPB_Configuration -v:minimal -p:Version=$TPB_Version -p:CIBuild=$TPB_CIBuild -p:LocalizedBuild=$TPB_LocalizedBuild -p:DotNetBuildFromSource=true || failed=true + $dotnet build $TPB_Build_From_Source_Solution --configuration $TPB_Configuration -v:minimal -p:Version=$TPB_Version -p:CIBuild=$TPB_CIBuild -p:LocalizedBuild=$TPB_LocalizedBuild -p:DotNetBuildFromSource=true -bl:TestPlatform.binlog || failed=true fi else find . -name "$PROJECT_NAME_PATTERNS" | xargs -L 1 $dotnet build --configuration $TPB_Configuration -v:minimal -p:Version=$TPB_Version -p:CIBuild=$TPB_CIBuild -p:LocalizedBuild=$TPB_LocalizedBuild @@ -370,8 +370,9 @@ function create_package() packageOutputDir="$TP_OUT_DIR/$TPB_Configuration/packages" mkdir -p $packageOutputDir - nuspecFiles=("TestPlatform.TranslationLayer.nuspec" "TestPlatform.ObjectModel.nuspec" "TestPlatform.TestHost.nuspec"\ - "Microsoft.TestPlatform.nuspec" "Microsoft.TestPlatform.Portable.nuspec" "TestPlatform.CLI.nuspec" "TestPlatform.Build.nuspec" "Microsoft.NET.Test.Sdk.nuspec") + nuspecFiles=("TestPlatform.TranslationLayer.nuspec" "TestPlatform.ObjectModel.nuspec" "TestPlatform.ObjectModel.nuspec" "TestPlatform.TestHost.nuspec"\ + "Microsoft.TestPlatform.nuspec" "Microsoft.TestPlatform.Portable.nuspec" "TestPlatform.CLI.nuspec" "TestPlatform.Build.nuspec" "Microsoft.NET.Test.Sdk.nuspec"\ + "Microsoft.CodeCoverage.nuspec" "Microsoft.TestPlatform.AdapterUtilities.nuspec" "TestPlatform.Extensions.TrxLogger.nuspec") projectFiles=("Microsoft.TestPlatform.CLI.csproj" "Microsoft.TestPlatform.Build.csproj") binDir="$TP_ROOT_DIR/bin/packages" diff --git a/scripts/verify-nupkgs.ps1 b/scripts/verify-nupkgs.ps1 index 0d0509c070..c660deb065 100644 --- a/scripts/verify-nupkgs.ps1 +++ b/scripts/verify-nupkgs.ps1 @@ -19,6 +19,7 @@ function Verify-Nuget-Packages($packageDirectory, $version) "Microsoft.TestPlatform.CLI" = 380; "Microsoft.TestPlatform.Extensions.TrxLogger" = 34; "Microsoft.TestPlatform.ObjectModel" = 179; + "Microsoft.TestPlatform.AdapterUtilities" = 47; "Microsoft.TestPlatform.Portable" = 569; "Microsoft.TestPlatform.TestHost" = 213; "Microsoft.TestPlatform.TranslationLayer" = 122; diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Extensions/ReflectionExtensions.MethodBase.cs b/src/Microsoft.TestPlatform.AdapterUtilities/Helpers/ReflectionHelpers.MethodBase.cs similarity index 84% rename from src/Microsoft.TestPlatform.CoreUtilities/Extensions/ReflectionExtensions.MethodBase.cs rename to src/Microsoft.TestPlatform.AdapterUtilities/Helpers/ReflectionHelpers.MethodBase.cs index 5e20bad1bd..0eaad1f4ed 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Extensions/ReflectionExtensions.MethodBase.cs +++ b/src/Microsoft.TestPlatform.AdapterUtilities/Helpers/ReflectionHelpers.MethodBase.cs @@ -1,12 +1,12 @@ // 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.PlatformAbstractions.Extensions +namespace Microsoft.TestPlatform.AdapterUtilities.Helpers { using System; using System.Reflection; - public static partial class ReflectionExtensions + internal static partial class ReflectionHelpers { #if NETSTANDARD1_0 || NETSTANDARD1_3 || WINDOWS_UWP private static readonly Type methodBase = typeof(MethodBase); @@ -20,7 +20,7 @@ public static partial class ReflectionExtensions private static readonly PropertyInfo methodHandleProperty = methodBase.GetRuntimeProperty(MethodHandlePropertyName); #endif - public static bool IsMethod(this MethodBase method) + internal static bool IsMethod(MethodBase method) { #if !NETSTANDARD1_0 && !NETSTANDARD1_3 && !WINDOWS_UWP return method.MemberType == MemberTypes.Method; @@ -31,7 +31,7 @@ public static bool IsMethod(this MethodBase method) #endif } - public static Type GetReflectedType(this MethodBase method) + internal static Type GetReflectedType(MethodBase method) { #if !NETSTANDARD1_0 && !NETSTANDARD1_3 && !WINDOWS_UWP return method.ReflectedType; @@ -42,7 +42,7 @@ public static Type GetReflectedType(this MethodBase method) #endif } - public static RuntimeMethodHandle GetMethodHandle(this MethodBase method) + internal static RuntimeMethodHandle GetMethodHandle(MethodBase method) { #if !NETSTANDARD1_0 && !NETSTANDARD1_3 && !WINDOWS_UWP return method.MethodHandle; diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Extensions/ReflectionExtensions.Type.cs b/src/Microsoft.TestPlatform.AdapterUtilities/Helpers/ReflectionHelpers.Type.cs similarity index 69% rename from src/Microsoft.TestPlatform.CoreUtilities/Extensions/ReflectionExtensions.Type.cs rename to src/Microsoft.TestPlatform.AdapterUtilities/Helpers/ReflectionHelpers.Type.cs index 65670afd06..d8e8d23b5c 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Extensions/ReflectionExtensions.Type.cs +++ b/src/Microsoft.TestPlatform.AdapterUtilities/Helpers/ReflectionHelpers.Type.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. -namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Extensions +namespace Microsoft.TestPlatform.AdapterUtilities.Helpers { using System; using System.Reflection; - public static partial class ReflectionExtensions + internal static partial class ReflectionHelpers { - public static bool IsGenericType(this Type type) + internal static bool IsGenericType(Type type) { #if !NETSTANDARD1_0 && !NETSTANDARD1_3 && !WINDOWS_UWP return type.IsGenericType; @@ -17,7 +17,7 @@ public static bool IsGenericType(this Type type) #endif } - public static MethodBase GetDeclaringMethod(this Type type) + internal static MethodBase GetDeclaringMethod(Type type) { #if !NETSTANDARD1_0 && !NETSTANDARD1_3 && !WINDOWS_UWP return type.DeclaringMethod; diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Extensions/ReflectionExtensions.cs b/src/Microsoft.TestPlatform.AdapterUtilities/Helpers/ReflectionHelpers.cs similarity index 68% rename from src/Microsoft.TestPlatform.CoreUtilities/Extensions/ReflectionExtensions.cs rename to src/Microsoft.TestPlatform.AdapterUtilities/Helpers/ReflectionHelpers.cs index 010567f0eb..2b30b8c129 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Extensions/ReflectionExtensions.cs +++ b/src/Microsoft.TestPlatform.AdapterUtilities/Helpers/ReflectionHelpers.cs @@ -1,15 +1,15 @@ // 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.PlatformAbstractions.Extensions +namespace Microsoft.TestPlatform.AdapterUtilities.Helpers { - using Microsoft.VisualStudio.TestPlatform.CoreUtilities.Resources; + using Microsoft.TestPlatform.AdapterUtilities.Resources; using System; - public static partial class ReflectionExtensions + internal static partial class ReflectionHelpers { - private static void AssertSupport(T obj, string methodName, string className) + private static void AssertSupport(T obj, string methodName, string className) where T : class { if (obj == null) diff --git a/src/Microsoft.TestPlatform.AdapterUtilities/ManagedNameUtilities/Contants.cs b/src/Microsoft.TestPlatform.AdapterUtilities/ManagedNameUtilities/Contants.cs new file mode 100644 index 0000000000..77b8c2c2bb --- /dev/null +++ b/src/Microsoft.TestPlatform.AdapterUtilities/ManagedNameUtilities/Contants.cs @@ -0,0 +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. + +namespace Microsoft.TestPlatform.AdapterUtilities.ManagedNameUtilities +{ + public static class Contants + { + public const string ManagedTypeLabel = "ManagedType"; + public const string ManagedMethodLabel = "ManagedMethod"; + + public const string ManagedTypePropertyId = "TestCase." + ManagedTypeLabel; + public const string ManagedMethodPropertyId = "TestCase." + ManagedMethodLabel; + } +} diff --git a/src/Microsoft.TestPlatform.ObjectModel/ManagedNameUtilities/InvalidManagedNameException.cs b/src/Microsoft.TestPlatform.AdapterUtilities/ManagedNameUtilities/InvalidManagedNameException.cs similarity index 80% rename from src/Microsoft.TestPlatform.ObjectModel/ManagedNameUtilities/InvalidManagedNameException.cs rename to src/Microsoft.TestPlatform.AdapterUtilities/ManagedNameUtilities/InvalidManagedNameException.cs index 4a1e2a3a1f..1899e65c96 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/ManagedNameUtilities/InvalidManagedNameException.cs +++ b/src/Microsoft.TestPlatform.AdapterUtilities/ManagedNameUtilities/InvalidManagedNameException.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. -namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.ManagedNameUtilities +namespace Microsoft.TestPlatform.AdapterUtilities.ManagedNameUtilities { using System; diff --git a/src/Microsoft.TestPlatform.ObjectModel/ManagedNameUtilities/ManagedNameHelper.Reflection.cs b/src/Microsoft.TestPlatform.AdapterUtilities/ManagedNameUtilities/ManagedNameHelper.Reflection.cs similarity index 58% rename from src/Microsoft.TestPlatform.ObjectModel/ManagedNameUtilities/ManagedNameHelper.Reflection.cs rename to src/Microsoft.TestPlatform.AdapterUtilities/ManagedNameUtilities/ManagedNameHelper.Reflection.cs index b0d7727995..93a0defca5 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/ManagedNameUtilities/ManagedNameHelper.Reflection.cs +++ b/src/Microsoft.TestPlatform.AdapterUtilities/ManagedNameUtilities/ManagedNameHelper.Reflection.cs @@ -1,52 +1,65 @@ // 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.ObjectModel.ManagedNameUtilities +namespace Microsoft.TestPlatform.AdapterUtilities.ManagedNameUtilities { - using Microsoft.VisualStudio.TestPlatform.ObjectModel.Resources; - using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Extensions; + using Microsoft.TestPlatform.AdapterUtilities.Resources; + using Microsoft.TestPlatform.AdapterUtilities.Helpers; using System; using System.Globalization; - using System.Linq; using System.Reflection; using System.Text; +#if !NET20 + using System.Linq; +#endif + public static partial class ManagedNameHelper { /// - /// Gets fully qualified type and method name from given MethodBase instance. + /// Gets fully qualified managed type and method name from given instance. /// /// - /// A MethodBase instance to get fully qualified type and method name. + /// A instance to get fully qualified managed type and method name. /// - /// - /// When this method returns, contains the fully qualified type name of the . + /// + /// When this method returns, contains the fully qualified managed type name of the . /// This parameter is passed uninitialized; any value originally supplied in result will be overwritten. + /// The format is defined in the RFC. /// - /// - /// When this method returns, contains the fully qualified method name of the . + /// + /// When this method returns, contains the fully qualified managed method name of the . /// This parameter is passed uninitialized; any value originally supplied in result will be overwritten. + /// The format is defined in the RFC. /// - /// is null. - /// must describe a method. + /// + /// is null. + /// + /// + /// must describe a method. + /// /// /// Required functionality on is missing on the current platform. /// - public static void GetManagedName(MethodBase method, out string fullTypeName, out string fullMethodName) + /// + /// More information about and can be found in + /// the RFC. + /// + public static void GetManagedName(MethodBase method, out string managedTypeName, out string managedMethodName) { if (method == null) { throw new ArgumentNullException(nameof(method)); } - if (!method.IsMethod()) + if (!ReflectionHelpers.IsMethod(method)) { throw new NotSupportedException(nameof(method)); } - var semanticType = method.GetReflectedType(); - if (semanticType.IsGenericType()) + var semanticType = ReflectionHelpers.GetReflectedType(method); + if (ReflectionHelpers.IsGenericType(semanticType)) { // The type might have some of its generic parameters specified, so make // sure we are working with the open form of the generic type. @@ -56,7 +69,7 @@ public static void GetManagedName(MethodBase method, out string fullTypeName, ou // declaration. Here we use the method handle (basically metadata token) to create // a new method reference using the open form of the reflected type. The intent is // to strip all generic type parameters. - var methodHandle = method.GetMethodHandle(); + var methodHandle = ReflectionHelpers.GetMethodHandle(method); method = MethodBase.GetMethodFromHandle(methodHandle, semanticType.TypeHandle); } @@ -84,7 +97,7 @@ public static void GetManagedName(MethodBase method, out string fullTypeName, ou // Type Parameters var paramList = method.GetParameters(); - if (paramList.Any()) + if (paramList.Length != 0) { methodBuilder.Append('('); foreach (var p in paramList) @@ -96,40 +109,46 @@ public static void GetManagedName(MethodBase method, out string fullTypeName, ou methodBuilder[methodBuilder.Length - 1] = ')'; } - fullTypeName = typeBuilder.ToString(); - fullMethodName = methodBuilder.ToString(); + managedTypeName = typeBuilder.ToString(); + managedMethodName = methodBuilder.ToString(); } /// - /// Gets the object with the specified - /// and in the instance. + /// Gets the object with the specified + /// and in the instance. /// /// /// An instance to search in. /// - /// - /// The fully qualified name of the type. + /// + /// The fully qualified managed name of the type. + /// The format is defined in the RFC. /// - /// - /// The fully qualified name of the method. + /// + /// The fully qualified managed name of the method. + /// The format is defined in the RFC. /// /// /// A object that represents specified parameters, throws if null. /// /// - /// Values specified with and + /// Values specified with and /// does not correspond to a method in the instance, or malformed. /// - public static MethodBase GetManagedName(Assembly assembly, string fullTypeName, string fullMethodName) + /// + /// More information about and can be found in + /// the RFC. + /// + public static MethodBase GetMethod(Assembly assembly, string managedTypeName, string managedMethodName) { Type type; #if !NETSTANDARD1_0 && !NETSTANDARD1_3 && !WINDOWS_UWP - type = assembly.GetType(fullTypeName, throwOnError: false, ignoreCase: false); + type = assembly.GetType(managedTypeName, throwOnError: false, ignoreCase: false); #else try { - type = assembly.GetType(fullTypeName); + type = assembly.GetType(managedTypeName); } catch { @@ -139,20 +158,25 @@ public static MethodBase GetManagedName(Assembly assembly, string fullTypeName, if (type == null) { - string message = String.Format(CultureInfo.CurrentCulture, ManagedNameMessages.ErrorTypeNotFound, fullTypeName); + string message = string.Format(CultureInfo.CurrentCulture, Resources.ErrorTypeNotFound, managedTypeName); throw new InvalidManagedNameException(message); } MethodInfo method = null; - ManagedNameParser.ParseMethodName(fullMethodName, out var methodName, out var methodArity, out var parameterTypes); + ManagedNameParser.ParseManagedMethodName(managedMethodName, out var methodName, out var methodArity, out var parameterTypes); +#if NET20 || NET35 + + if (!IsNullOrWhiteSpace(methodName)) +#else if (!string.IsNullOrWhiteSpace(methodName)) +#endif { method = FindMethod(type, methodName, methodArity, parameterTypes); } if (method == null) { - string message = String.Format(CultureInfo.CurrentCulture, ManagedNameMessages.ErrorMethodNotFound, methodName, fullTypeName); + string message = string.Format(CultureInfo.CurrentCulture, Resources.ErrorMethodNotFound, methodName, managedTypeName); throw new InvalidManagedNameException(message); } @@ -190,12 +214,20 @@ bool filter(MemberInfo mbr, object param) return true; } + MemberInfo[] methods; + #if !NETSTANDARD1_0 && !NETSTANDARD1_3 && !WINDOWS_UWP var bindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static; - var methods = type.FindMembers(MemberTypes.Method, bindingFlags, filter, null); - return (MethodInfo)methods.SingleOrDefault(); + methods = type.FindMembers(MemberTypes.Method, bindingFlags, filter, null); #else - return type.GetRuntimeMethods().Where(m => filter(m, null)).SingleOrDefault(); + methods = type.GetRuntimeMethods().Where(m => filter(m, null)).ToArray(); +#endif + + +#if NET20 + return (MethodInfo)SingleOrDefault(methods); +#else + return (MethodInfo)methods.SingleOrDefault(); #endif } @@ -213,7 +245,7 @@ private static void AppendTypeString(StringBuilder b, Type type, bool closedType } else if (type.IsGenericParameter) { - if (type.GetDeclaringMethod() != null) + if (ReflectionHelpers.GetDeclaringMethod(type) != null) { b.Append('!'); } @@ -254,7 +286,7 @@ private static void AppendGenericTypeParameters(StringBuilder b, Type type) genargs = type.GetTypeInfo().GenericTypeArguments; #endif - if (genargs.Any()) + if (genargs.Length != 0) { b.Append('<'); foreach (var argType in genargs) @@ -273,5 +305,64 @@ private static string TypeString(Type type, bool closedType) AppendTypeString(builder, type, closedType); return builder.ToString(); } + +#if NET20 + + // the method is mostly copied from + // https://github.com/dotnet/runtime/blob/c0840723b382bcfa67b35839af8572fcd38f1d13/src/libraries/System.Linq/src/System/Linq/Single.cs#L86 + public static TSource SingleOrDefault(System.Collections.Generic.IEnumerable source) + { + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + if (source is System.Collections.Generic.IList list) + { + switch (list.Count) + { + case 0: + return default; + case 1: + return list[0]; + } + } + else + { + using (System.Collections.Generic.IEnumerator e = source.GetEnumerator()) + { + if (!e.MoveNext()) + { + return default; + } + + TSource result = e.Current; + if (!e.MoveNext()) + { + return result; + } + } + } + + throw new InvalidOperationException("MoreThanOneElement"); + } +#endif + +#if NET20 || NET35 + public static bool IsNullOrWhiteSpace(string value) + { + if (value is null) return true; + + for (int i = 0; i < value.Length; i++) + { + if (!char.IsWhiteSpace(value[i])) + { + return false; + } + } + + return true; + } +#endif } } diff --git a/src/Microsoft.TestPlatform.AdapterUtilities/ManagedNameUtilities/ManagedNameParser.cs b/src/Microsoft.TestPlatform.AdapterUtilities/ManagedNameUtilities/ManagedNameParser.cs new file mode 100644 index 0000000000..bf707f74c8 --- /dev/null +++ b/src/Microsoft.TestPlatform.AdapterUtilities/ManagedNameUtilities/ManagedNameParser.cs @@ -0,0 +1,225 @@ +// 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.TestPlatform.AdapterUtilities.ManagedNameUtilities +{ + using Microsoft.TestPlatform.AdapterUtilities.Resources; + + using System.Collections.Generic; + using System.Diagnostics; + using System.Globalization; + + public class ManagedNameParser + { + /// + /// Parses a given fully qualified managed type name into its namespace and type name. + /// + /// + /// The fully qualified managed type name to parse. + /// The format is defined in the RFC. + /// + /// + /// When this method returns, contains the parsed namespace name of the . + /// This parameter is passed uninitialized; any value originally supplied in result will be overwritten. + /// + /// + /// When this method returns, contains the parsed type name of the . + /// This parameter is passed uninitialized; any value originally supplied in result will be overwritten. + /// + public static void ParseManagedTypeName(string managedTypeName, out string namespaceName, out string typeName) + { + int pos = managedTypeName.LastIndexOf('.'); + if (pos == -1) + { + namespaceName = string.Empty; + typeName = managedTypeName; + } + else + { + namespaceName = managedTypeName.Substring(0, pos); + typeName = managedTypeName.Substring(pos + 1); + } + } + + /// + /// Parses a given fully qualified managed method name into its name, arity and parameter types. + /// + /// + /// The fully qualified managed method name to parse. + /// The format is defined in the RFC. + /// + /// + /// When this method returns, contains the parsed method name of the . + /// This parameter is passed uninitialized; any value originally supplied in result will be overwritten. + /// + /// + /// When this method returns, contains the parsed arity of the . + /// This parameter is passed uninitialized; any value originally supplied in result will be overwritten. + /// + /// + /// When this method returns, contains the parsed parameter types of the . + /// If there are no parameter types in , is set to null. + /// This parameter is passed uninitialized; any value originally supplied in result will be overwritten. + /// + /// + /// Thrown if contains spaces, incomplete, or the arity isn't numeric. + /// + public static void ParseManagedMethodName(string managedMethodName, out string methodName, out int arity, out string[] parameterTypes) + { + int pos = ParseMethodName(managedMethodName, 0, out methodName, out arity); + pos = ParseParameterTypeList(managedMethodName, pos, out parameterTypes); + if (pos != managedMethodName.Length) + { + string message = string.Format(CultureInfo.CurrentCulture, Resources.ErrorUnexpectedCharactersAtEnd, pos); + throw new InvalidManagedNameException(message); + } + } + + private static string Capture(string managedMethodName, int start, int end) + => managedMethodName.Substring(start, end - start); + + private static int ParseMethodName(string managedMethodName, int start, out string methodName, out int arity) + { + int i = start; + for (; i < managedMethodName.Length; i++) + { + switch (managedMethodName[i]) + { + case var w when char.IsWhiteSpace(w): + string message = string.Format(CultureInfo.CurrentCulture, Resources.ErrorWhitespaceNotValid, i); + throw new InvalidManagedNameException(message); + case '`': + methodName = Capture(managedMethodName, start, i); + return ParseArity(managedMethodName, i, out arity); + case '(': + methodName = Capture(managedMethodName, start, i); + arity = 0; + return i; + } + } + methodName = Capture(managedMethodName, start, i); + arity = 0; + return i; + } + + // parse arity in the form `nn where nn is an integer value. + private static int ParseArity(string managedMethodName, int start, out int arity) + { + arity = 0; + Debug.Assert(managedMethodName[start] == '`'); + + int i = start + 1; // skip initial '`' char + for (; i < managedMethodName.Length; i++) + { + if (managedMethodName[i] == '(') break; + } + if (!int.TryParse(Capture(managedMethodName, start + 1, i), out arity)) + { + string message = string.Format(CultureInfo.CurrentCulture, Resources.ErrorMethodArityMustBeNumeric); + throw new InvalidManagedNameException(message); + } + return i; + } + + private static int ParseParameterTypeList(string managedMethodName, int start, out string[] parameterTypes) + { + parameterTypes = null; + if (start == managedMethodName.Length) + { + return start; + } + Debug.Assert(managedMethodName[start] == '('); + + var types = new List(); + + int i = start + 1; // skip initial '(' char + for (; i < managedMethodName.Length; i++) + { + switch (managedMethodName[i]) + { + case ')': + if (types.Count != 0) + { + parameterTypes = types.ToArray(); + } + return i + 1; // consume right parens + case ',': + break; + default: + i = ParseParameterType(managedMethodName, i, out var parameterType); + types.Add(parameterType); + break; + } + } + + string message = string.Format(CultureInfo.CurrentCulture, Resources.ErrorIncompleteManagedName); + throw new InvalidManagedNameException(message); + } + + private static int ParseParameterType(string managedMethodName, int start, out string parameterType) + { + parameterType = string.Empty; + + int i = start; + for (; i < managedMethodName.Length; i++) + { + switch (managedMethodName[i]) + { + case '<': + i = ParseGenericBrackets(managedMethodName, i + 1); + break; + case '[': + i = ParseArrayBrackets(managedMethodName, i + 1); + break; + case ',': + case ')': + parameterType = Capture(managedMethodName, start, i); + return i - 1; + case var w when char.IsWhiteSpace(w): + string message = string.Format(CultureInfo.CurrentCulture, Resources.ErrorWhitespaceNotValid, i); + throw new InvalidManagedNameException(message); + } + } + return i; + } + + private static int ParseArrayBrackets(string managedMethodName, int start) + { + for (int i = start; i < managedMethodName.Length; i++) + { + switch (managedMethodName[i]) + { + case ']': + return i; + case var w when char.IsWhiteSpace(w): + string msg = string.Format(CultureInfo.CurrentCulture, Resources.ErrorWhitespaceNotValid, i); + throw new InvalidManagedNameException(msg); + } + } + + string message = string.Format(CultureInfo.CurrentCulture, Resources.ErrorIncompleteManagedName); + throw new InvalidManagedNameException(message); + } + + private static int ParseGenericBrackets(string managedMethodName, int start) + { + for (int i = start; i < managedMethodName.Length; i++) + { + switch (managedMethodName[i]) + { + case '<': + i = ParseGenericBrackets(managedMethodName, i + 1); + break; + case '>': + return i; + case var w when char.IsWhiteSpace(w): + string msg = string.Format(CultureInfo.CurrentCulture, Resources.ErrorWhitespaceNotValid, i); + throw new InvalidManagedNameException(msg); + } + } + + string message = string.Format(CultureInfo.CurrentCulture, Resources.ErrorIncompleteManagedName); + throw new InvalidManagedNameException(message); + } + } +} diff --git a/src/Microsoft.TestPlatform.AdapterUtilities/Microsoft.TestPlatform.AdapterUtilities.csproj b/src/Microsoft.TestPlatform.AdapterUtilities/Microsoft.TestPlatform.AdapterUtilities.csproj new file mode 100644 index 0000000000..aae96bd1d3 --- /dev/null +++ b/src/Microsoft.TestPlatform.AdapterUtilities/Microsoft.TestPlatform.AdapterUtilities.csproj @@ -0,0 +1,51 @@ + + + ..\..\ + + + + + netstandard1.0;netstandard2.0 + $(TargetFrameworks);uap10.0 + true + + Microsoft.TestPlatform.AdapterUtilities + Microsoft.TestPlatform.AdapterUtilities + + + + false + UAP,Version=v10.0 + UAP + 10.0.14393.0 + 10.0.10240.0 + .NETPortable + v4.5 + $(DefineConstants);WINDOWS_UWP + + + .NETFramework + v4.5.1 + + + + + + + + + + + + + diff --git a/src/Microsoft.TestPlatform.ObjectModel/Resources/ManagedNameMessages.Designer.cs b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/Resources.Designer.cs similarity index 57% rename from src/Microsoft.TestPlatform.ObjectModel/Resources/ManagedNameMessages.Designer.cs rename to src/Microsoft.TestPlatform.AdapterUtilities/Resources/Resources.Designer.cs index 266ad299d1..19827c698e 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Resources/ManagedNameMessages.Designer.cs +++ b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/Resources.Designer.cs @@ -1,118 +1,135 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Resources { - using System; +namespace Microsoft.TestPlatform.AdapterUtilities.Resources +{ using System.Reflection; /// /// A strongly-typed resource class, for looking up localized strings, etc. /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class ManagedNameMessages { - + internal class Resources + { + private static global::System.Resources.ResourceManager resourceMan; - + private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal ManagedNameMessages() { + + internal Resources() + { } - + /// /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.VisualStudio.TestPlatform.ObjectModel.Resources.ManagedNameMessages", typeof(ManagedNameMessages).GetTypeInfo().Assembly); + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if (object.ReferenceEquals(resourceMan, null)) + { +#if NET20 || NET35 + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.TestPlatform.AdapterUtilities.Resources.Resources", typeof(Resources).Assembly); +#else + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.TestPlatform.AdapterUtilities.Resources.Resources", typeof(Resources).GetTypeInfo().Assembly); +#endif resourceMan = temp; } return resourceMan; } } - + /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { + internal static global::System.Globalization.CultureInfo Culture + { + get + { return resourceCulture; } - set { + set + { resourceCulture = value; } } - + /// /// Looks up a localized string similar to ManagedName is incomplete. /// - internal static string ErrorIncompleteManagedName { - get { + internal static string ErrorIncompleteManagedName + { + get + { return ResourceManager.GetString("ErrorIncompleteManagedName", resourceCulture); } } - + /// /// Looks up a localized string similar to Method arity must be numeric. /// - internal static string ErrorMethodArityMustBeNumeric { - get { + internal static string ErrorMethodArityMustBeNumeric + { + get + { return ResourceManager.GetString("ErrorMethodArityMustBeNumeric", resourceCulture); } } - + /// /// Looks up a localized string similar to Method '{0}' not found on type '{1}'. /// - internal static string ErrorMethodNotFound { - get { + internal static string ErrorMethodNotFound + { + get + { return ResourceManager.GetString("ErrorMethodNotFound", resourceCulture); } } - + /// /// Looks up a localized string similar to Type '{0}' not found. /// - internal static string ErrorTypeNotFound { - get { + internal static string ErrorTypeNotFound + { + get + { return ResourceManager.GetString("ErrorTypeNotFound", resourceCulture); } } - + /// /// Looks up a localized string similar to Unexpected characters after the end of the ManagedName (pos: {0}). /// - internal static string ErrorUnexpectedCharactersAtEnd { - get { + internal static string ErrorUnexpectedCharactersAtEnd + { + get + { return ResourceManager.GetString("ErrorUnexpectedCharactersAtEnd", resourceCulture); } } - + /// /// Looks up a localized string similar to Whitespace is not valid in a ManagedName (pos: {0}). /// - internal static string ErrorWhitespaceNotValid { - get { + internal static string ErrorWhitespaceNotValid + { + get + { return ResourceManager.GetString("ErrorWhitespaceNotValid", resourceCulture); } } + + /// + /// Looks up a localized string similar to '{0}.{1}' is not implemented on this platform!. + /// + internal static string MethodNotImplementedOnPlatform + { + get + { + return ResourceManager.GetString("MethodNotImplementedOnPlatform", resourceCulture); + } + } } } diff --git a/src/Microsoft.TestPlatform.ObjectModel/Resources/ManagedNameMessages.resx b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/Resources.resx similarity index 95% rename from src/Microsoft.TestPlatform.ObjectModel/Resources/ManagedNameMessages.resx rename to src/Microsoft.TestPlatform.AdapterUtilities/Resources/Resources.resx index 1f24f6db76..da81725acf 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Resources/ManagedNameMessages.resx +++ b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/Resources.resx @@ -139,4 +139,10 @@ Whitespace is not valid in a ManagedName (pos: {0}) {0} is the position of invalid whitespace + + '{0}.{1}' is not implemented on this platform! + '{className}.{methodName}' is not implemented on this platform! + +Example: 'System.Reflection.MethodBase' is not implemented on this platform! + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.cs.xlf b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.cs.xlf similarity index 81% rename from src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.cs.xlf rename to src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.cs.xlf index 269f9a2b0e..77e0cf29b0 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.cs.xlf +++ b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.cs.xlf @@ -1,6 +1,6 @@  - + ManagedName is incomplete @@ -32,6 +32,13 @@ V ManagedName se nepovoluje mezera (pozice: {0}). {0} is the position of invalid whitespace + + '{0}.{1}' is not implemented on this platform! + Metoda {0}.{1} není na této platformě implementována. + '{className}.{methodName}' is not implemented on this platform! + +Example: 'System.Reflection.MethodBase' is not implemented on this platform! + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.de.xlf b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.de.xlf similarity index 81% rename from src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.de.xlf rename to src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.de.xlf index 4f3c097da7..cc3be8f402 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.de.xlf +++ b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.de.xlf @@ -1,6 +1,6 @@  - + ManagedName is incomplete @@ -32,6 +32,13 @@ Leerzeichen sind in einem ManagedName unzulässig (Position: {0}). {0} is the position of invalid whitespace + + '{0}.{1}' is not implemented on this platform! + "{0}.{1}" ist auf dieser Plattform nicht implementiert! + '{className}.{methodName}' is not implemented on this platform! + +Example: 'System.Reflection.MethodBase' is not implemented on this platform! + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.es.xlf b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.es.xlf similarity index 82% rename from src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.es.xlf rename to src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.es.xlf index 39217c3624..111e6b9dd4 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.es.xlf +++ b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.es.xlf @@ -1,6 +1,6 @@  - + ManagedName is incomplete @@ -32,6 +32,13 @@ El espacio en blanco no es válido en un elemento ManagedName (posición: {0}) {0} is the position of invalid whitespace + + '{0}.{1}' is not implemented on this platform! + "{0}.{1}" no se ha implementado en esta plataforma. + '{className}.{methodName}' is not implemented on this platform! + +Example: 'System.Reflection.MethodBase' is not implemented on this platform! + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.fr.xlf b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.fr.xlf similarity index 81% rename from src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.fr.xlf rename to src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.fr.xlf index b666af0782..13be1b762b 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.fr.xlf +++ b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.fr.xlf @@ -1,6 +1,6 @@  - + ManagedName is incomplete @@ -32,6 +32,13 @@ Les espaces blancs ne sont pas valides dans un ManagedName (pos. : {0}) {0} is the position of invalid whitespace + + '{0}.{1}' is not implemented on this platform! + '{0}.{1}' n'est pas implémenté sur cette plateforme ! + '{className}.{methodName}' is not implemented on this platform! + +Example: 'System.Reflection.MethodBase' is not implemented on this platform! + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.it.xlf b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.it.xlf similarity index 82% rename from src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.it.xlf rename to src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.it.xlf index cd33cbb7ea..1602378445 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.it.xlf +++ b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.it.xlf @@ -1,6 +1,6 @@  - + ManagedName is incomplete @@ -32,6 +32,13 @@ Gli spazi vuoti non sono validi in un elemento ManagedName (pos.: {0}) {0} is the position of invalid whitespace + + '{0}.{1}' is not implemented on this platform! + '{0}.{1}' non è implementato in questa piattaforma. + '{className}.{methodName}' is not implemented on this platform! + +Example: 'System.Reflection.MethodBase' is not implemented on this platform! + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.ja.xlf b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.ja.xlf similarity index 81% rename from src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.ja.xlf rename to src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.ja.xlf index 7750e56011..2bc25ce3ae 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.ja.xlf +++ b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.ja.xlf @@ -1,6 +1,6 @@  - + ManagedName is incomplete @@ -32,6 +32,13 @@ ManagedName では空白は無効です (位置: {0}) {0} is the position of invalid whitespace + + '{0}.{1}' is not implemented on this platform! + '{0}.{1}' はこのプラットフォームに実装されていません。 + '{className}.{methodName}' is not implemented on this platform! + +Example: 'System.Reflection.MethodBase' is not implemented on this platform! + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.ko.xlf b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.ko.xlf similarity index 81% rename from src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.ko.xlf rename to src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.ko.xlf index 98db842b50..2ef4e1cdc3 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.ko.xlf +++ b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.ko.xlf @@ -1,6 +1,6 @@  - + ManagedName is incomplete @@ -32,6 +32,13 @@ ManagedName에서 공백은 유효하지 않습니다(pos: {0}). {0} is the position of invalid whitespace + + '{0}.{1}' is not implemented on this platform! + '{0}.{1}'이(가)이 플랫폼에서 구현되지 않았습니다. + '{className}.{methodName}' is not implemented on this platform! + +Example: 'System.Reflection.MethodBase' is not implemented on this platform! + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.pl.xlf b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.pl.xlf similarity index 81% rename from src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.pl.xlf rename to src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.pl.xlf index 16f4f78d95..9f40119244 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.pl.xlf +++ b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.pl.xlf @@ -1,6 +1,6 @@  - + ManagedName is incomplete @@ -32,6 +32,13 @@ Biały znak jest niedozwolony w wartości ManagedName (pozycja: {0}) {0} is the position of invalid whitespace + + '{0}.{1}' is not implemented on this platform! + Element „{0}.{1}” nie jest zaimplementowany na tej platformie. + '{className}.{methodName}' is not implemented on this platform! + +Example: 'System.Reflection.MethodBase' is not implemented on this platform! + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.pt-BR.xlf b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.pt-BR.xlf similarity index 81% rename from src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.pt-BR.xlf rename to src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.pt-BR.xlf index a3cb0cedd0..6e08e8348c 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.pt-BR.xlf +++ b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.pt-BR.xlf @@ -1,6 +1,6 @@  - + ManagedName is incomplete @@ -32,6 +32,13 @@ O espaço em branco não é válido em um ManagedName (posição: {0}) {0} is the position of invalid whitespace + + '{0}.{1}' is not implemented on this platform! + '{0}.{1}' não está implementado nesta plataforma. + '{className}.{methodName}' is not implemented on this platform! + +Example: 'System.Reflection.MethodBase' is not implemented on this platform! + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.ru.xlf b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.ru.xlf similarity index 83% rename from src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.ru.xlf rename to src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.ru.xlf index 53b7d79398..98ab3c94da 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.ru.xlf +++ b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.ru.xlf @@ -1,6 +1,6 @@  - + ManagedName is incomplete @@ -32,6 +32,13 @@ Пробел в ManagedName (позиция: {0}) не допускается. {0} is the position of invalid whitespace + + '{0}.{1}' is not implemented on this platform! + '{0}.{1}' bu platformda uygulanmıyor! + '{className}.{methodName}' is not implemented on this platform! + +Example: 'System.Reflection.MethodBase' is not implemented on this platform! + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.tr.xlf b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.tr.xlf similarity index 82% rename from src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.tr.xlf rename to src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.tr.xlf index b2b390c509..fb6cc464b2 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.tr.xlf +++ b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.tr.xlf @@ -1,6 +1,6 @@  - + ManagedName is incomplete @@ -32,6 +32,13 @@ ManagedName'de boşluk geçersiz (konum: {0}) {0} is the position of invalid whitespace + + '{0}.{1}' is not implemented on this platform! + '{0}.{1}' bu platformda uygulanmıyor! + '{className}.{methodName}' is not implemented on this platform! + +Example: 'System.Reflection.MethodBase' is not implemented on this platform! + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.xlf b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.xlf similarity index 74% rename from src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.xlf rename to src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.xlf index 6b76894923..232d95bf2d 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.xlf +++ b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.xlf @@ -1,6 +1,6 @@  - + ManagedName is incomplete @@ -26,6 +26,13 @@ Whitespace is not valid in a ManagedName (pos: {0}) {0} is the position of invalid whitespace + + '{0}.{1}' is not implemented on this platform! + '{0}.{1}' is not implemented on this platform! + '{className}.{methodName}' is not implemented on this platform! + +Example: 'System.Reflection.MethodBase' is not implemented on this platform! + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.zh-Hans.xlf b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.zh-Hans.xlf similarity index 81% rename from src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.zh-Hans.xlf rename to src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.zh-Hans.xlf index 628b1862f6..2a3e79c29d 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.zh-Hans.xlf +++ b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.zh-Hans.xlf @@ -1,6 +1,6 @@  - + ManagedName is incomplete @@ -32,6 +32,13 @@ ManagedName 中空白无效(位置: {0}) {0} is the position of invalid whitespace + + '{0}.{1}' is not implemented on this platform! + 未在此平台上实现 "{0}.{1}"! + '{className}.{methodName}' is not implemented on this platform! + +Example: 'System.Reflection.MethodBase' is not implemented on this platform! + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.zh-Hant.xlf b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.zh-Hant.xlf similarity index 81% rename from src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.zh-Hant.xlf rename to src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.zh-Hant.xlf index ad7b49f7b0..b722fc446f 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Resources/xlf/ManagedNameMessages.zh-Hant.xlf +++ b/src/Microsoft.TestPlatform.AdapterUtilities/Resources/xlf/Resources.zh-Hant.xlf @@ -1,6 +1,6 @@  - + ManagedName is incomplete @@ -32,6 +32,13 @@ 空白字元在 ManagedName 中無效 (位置: {0}) {0} is the position of invalid whitespace + + '{0}.{1}' is not implemented on this platform! + '{0}.{1}' 未在此平台上實作! + '{className}.{methodName}' is not implemented on this platform! + +Example: 'System.Reflection.MethodBase' is not implemented on this platform! + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Resources/Resources.resx b/src/Microsoft.TestPlatform.CoreUtilities/Resources/Resources.resx index 27a397f0d5..ba520ac0b1 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Resources/Resources.resx +++ b/src/Microsoft.TestPlatform.CoreUtilities/Resources/Resources.resx @@ -165,10 +165,4 @@ Error getting process name. - - '{0}.{1}' is not implemented on this platform! - '{className}.{methodName}' is not implemented on this platform! - -Example: 'System.Reflection.MethodBase' is not implemented on this platform! - \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.cs.xlf b/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.cs.xlf index b02df0a203..d3fcf4893f 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.cs.xlf +++ b/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.cs.xlf @@ -160,13 +160,6 @@ Hostitele {0} nešlo najít. Ujistěte se, jestli je {0} nainstalovaný na počítači a dostupný v cestě určené proměnnou prostředí PATH. - - '{0}.{1}' is not implemented on this platform! - Metoda {0}.{1} není na této platformě implementována. - '{className}.{methodName}' is not implemented on this platform! - -Example: 'System.Reflection.MethodBase' is not implemented on this platform! - \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.de.xlf b/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.de.xlf index 62e6c896ab..e56739c937 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.de.xlf +++ b/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.de.xlf @@ -160,13 +160,6 @@ Der Host "{0}" wurde nicht gefunden. Stellen Sie sicher, dass "{0}" auf dem Computer installiert und in der PATH-Umgebungsvariablen verfügbar ist. - - '{0}.{1}' is not implemented on this platform! - "{0}.{1}" ist auf dieser Plattform nicht implementiert! - '{className}.{methodName}' is not implemented on this platform! - -Example: 'System.Reflection.MethodBase' is not implemented on this platform! - \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.es.xlf b/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.es.xlf index cfc9211a5b..b428568d5f 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.es.xlf +++ b/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.es.xlf @@ -160,13 +160,6 @@ No se pudo encontrar el host "{0}". Asegúrese de que "{0}" está instalado en el equipo y está disponible en la variable de entorno PATH. - - '{0}.{1}' is not implemented on this platform! - "{0}.{1}" no se ha implementado en esta plataforma. - '{className}.{methodName}' is not implemented on this platform! - -Example: 'System.Reflection.MethodBase' is not implemented on this platform! - \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.fr.xlf b/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.fr.xlf index b4d70ebe7f..776258dfeb 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.fr.xlf +++ b/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.fr.xlf @@ -160,13 +160,6 @@ L'hôte '{0}' est introuvable. Vérifiez que '{0}' est installé sur la machine et qu'il est disponible dans la variable d'environnement PATH. - - '{0}.{1}' is not implemented on this platform! - '{0}.{1}' n'est pas implémenté sur cette plateforme ! - '{className}.{methodName}' is not implemented on this platform! - -Example: 'System.Reflection.MethodBase' is not implemented on this platform! - \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.it.xlf b/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.it.xlf index 4a9bd3636f..2a67405108 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.it.xlf +++ b/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.it.xlf @@ -160,13 +160,6 @@ L'host '{0}' non è stato trovato. Assicurarsi che '{0}' sia installato nel computer e che sia disponibile nella variabile di ambiente PATH. - - '{0}.{1}' is not implemented on this platform! - '{0}.{1}' non è implementato in questa piattaforma. - '{className}.{methodName}' is not implemented on this platform! - -Example: 'System.Reflection.MethodBase' is not implemented on this platform! - \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.ja.xlf b/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.ja.xlf index c76e744adb..f7540bc847 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.ja.xlf +++ b/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.ja.xlf @@ -160,13 +160,6 @@ '{0}' ホストが見つかりませんでした。'{0}' がコンピューターにインストールされており、PATH 環境変数で使用できることを確認してください。 - - '{0}.{1}' is not implemented on this platform! - '{0}.{1}' はこのプラットフォームに実装されていません。 - '{className}.{methodName}' is not implemented on this platform! - -Example: 'System.Reflection.MethodBase' is not implemented on this platform! - \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.ko.xlf b/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.ko.xlf index 36facccc77..045f1456c0 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.ko.xlf +++ b/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.ko.xlf @@ -160,13 +160,6 @@ ‘{0}’ 호스트를 찾을 수 없습니다. ‘{0}’이(가) 컴퓨터에 설치되어 있고 PATH 환경 변수에서 사용할 수 있는지 확인하세요. - - '{0}.{1}' is not implemented on this platform! - '{0}.{1}'이(가)이 플랫폼에서 구현되지 않았습니다. - '{className}.{methodName}' is not implemented on this platform! - -Example: 'System.Reflection.MethodBase' is not implemented on this platform! - \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.pl.xlf b/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.pl.xlf index c1a12883ea..1a4f72c7c4 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.pl.xlf +++ b/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.pl.xlf @@ -160,13 +160,6 @@ Nie można znaleźć hosta „{0}”. Upewnij się, że element „{0}” jest zainstalowany na maszynie i jest dostępny w zmiennej środowiskowej PATH. - - '{0}.{1}' is not implemented on this platform! - Element „{0}.{1}” nie jest zaimplementowany na tej platformie. - '{className}.{methodName}' is not implemented on this platform! - -Example: 'System.Reflection.MethodBase' is not implemented on this platform! - \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.pt-BR.xlf b/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.pt-BR.xlf index 73254f2b69..c1ca953991 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.pt-BR.xlf +++ b/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.pt-BR.xlf @@ -160,13 +160,6 @@ Não foi possível encontrar o host '{0}'. Verifique se o '{0}' está instalado no computador e está disponível na variável de ambiente PATH. - - '{0}.{1}' is not implemented on this platform! - '{0}.{1}' não está implementado nesta plataforma. - '{className}.{methodName}' is not implemented on this platform! - -Example: 'System.Reflection.MethodBase' is not implemented on this platform! - \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.ru.xlf b/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.ru.xlf index 40802900c1..439e58c02c 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.ru.xlf +++ b/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.ru.xlf @@ -160,13 +160,6 @@ Не удалось найти хост "{0}". Убедитесь, что "{0}" установлен на компьютере и доступен в переменной среды PATH. - - '{0}.{1}' is not implemented on this platform! - Метод "{0}.{1}" не реализован на этой платформе. - '{className}.{methodName}' is not implemented on this platform! - -Example: 'System.Reflection.MethodBase' is not implemented on this platform! - \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.tr.xlf b/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.tr.xlf index 9aeedcc6b3..e137c740bd 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.tr.xlf +++ b/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.tr.xlf @@ -160,13 +160,6 @@ '{0}' konağı bulunamadı. '{0}' konağının makinede yüklü olduğundan ve PATH ortam değişkeninde bulunduğundan emin olun. - - '{0}.{1}' is not implemented on this platform! - '{0}.{1}' bu platformda uygulanmıyor! - '{className}.{methodName}' is not implemented on this platform! - -Example: 'System.Reflection.MethodBase' is not implemented on this platform! - \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.xlf b/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.xlf index f557a28547..615147279b 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.xlf +++ b/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.xlf @@ -67,13 +67,6 @@ Could not find {0}. Make sure that the dotnet is installed on the machine. - - '{0}.{1}' is not implemented on this platform! - '{0}.{1}' is not implemented on this platform! - '{className}.{methodName}' is not implemented on this platform! - -Example: 'System.Reflection.MethodBase' is not implemented on this platform! - \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.zh-Hans.xlf b/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.zh-Hans.xlf index 1490343772..4d75b26690 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.zh-Hans.xlf @@ -160,13 +160,6 @@ 找不到“{0}”主机。请确保计算机上已安装“{0}”且位于 PATH 环境变量中。 - - '{0}.{1}' is not implemented on this platform! - 未在此平台上实现 "{0}.{1}"! - '{className}.{methodName}' is not implemented on this platform! - -Example: 'System.Reflection.MethodBase' is not implemented on this platform! - \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.zh-Hant.xlf b/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.zh-Hant.xlf index 19fd67d30f..c46a781603 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/Microsoft.TestPlatform.CoreUtilities/Resources/xlf/Resources.zh-Hant.xlf @@ -160,13 +160,6 @@ 找不到 '{0}' 主機。請確認 '{0}' 已安裝在機器上,而且可在 PATH 環境變數中使用。 - - '{0}.{1}' is not implemented on this platform! - '{0}.{1}' 未在此平台上實作! - '{className}.{methodName}' is not implemented on this platform! - -Example: 'System.Reflection.MethodBase' is not implemented on this platform! - \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Microsoft.TestPlatform.CrossPlatEngine.csproj b/src/Microsoft.TestPlatform.CrossPlatEngine/Microsoft.TestPlatform.CrossPlatEngine.csproj index f350f7fd32..72e7d1f777 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Microsoft.TestPlatform.CrossPlatEngine.csproj +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Microsoft.TestPlatform.CrossPlatEngine.csproj @@ -21,7 +21,7 @@ - + true diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Microsoft.TestPlatform.Extensions.BlameDataCollector.csproj b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Microsoft.TestPlatform.Extensions.BlameDataCollector.csproj index e88e26ab36..5ac9c65b5d 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Microsoft.TestPlatform.Extensions.BlameDataCollector.csproj +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Microsoft.TestPlatform.Extensions.BlameDataCollector.csproj @@ -34,9 +34,7 @@ - - 0.2.0-preview.20419.2 - + diff --git a/src/Microsoft.TestPlatform.ObjectModel/ManagedNameUtilities/ManagedNameParser.cs b/src/Microsoft.TestPlatform.ObjectModel/ManagedNameUtilities/ManagedNameParser.cs deleted file mode 100644 index f83eab158c..0000000000 --- a/src/Microsoft.TestPlatform.ObjectModel/ManagedNameUtilities/ManagedNameParser.cs +++ /dev/null @@ -1,188 +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. - -namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.ManagedNameUtilities -{ - using Microsoft.VisualStudio.TestPlatform.ObjectModel.Resources; - - using System.Collections.Generic; - using System.Diagnostics; - using System.Globalization; - using System.Linq; - - public class ManagedNameParser - { - internal static void ParseTypeName(string fullTypeName, out string namespaceName, out string typeName) - { - int pos = fullTypeName.LastIndexOf('.'); - if (pos == -1) - { - namespaceName = string.Empty; - typeName = fullTypeName; - } - else - { - namespaceName = fullTypeName.Substring(0, pos); - typeName = fullTypeName.Substring(pos + 1); - } - } - - internal static void ParseMethodName(string fullMethodName, out string methodName, out int arity, out string[] parameterTypes) - { - int pos = ParseMethodName(fullMethodName, 0, out methodName, out arity); - pos = ParseParameterTypeList(fullMethodName, pos, out parameterTypes); - if (pos != fullMethodName.Length) - { - string message = string.Format(CultureInfo.CurrentCulture, ManagedNameMessages.ErrorUnexpectedCharactersAtEnd, pos); - throw new InvalidManagedNameException(message); - } - } - - private static string Capture(string fullMethodName, int start, int end) - => fullMethodName.Substring(start, end - start); - - private static int ParseMethodName(string fullMethodName, int start, out string methodName, out int arity) - { - int i = start; - for (; i < fullMethodName.Length; i++) - { - switch (fullMethodName[i]) - { - case var w when char.IsWhiteSpace(w): - string message = string.Format(CultureInfo.CurrentCulture, ManagedNameMessages.ErrorWhitespaceNotValid, i); - throw new InvalidManagedNameException(message); - case '`': - methodName = Capture(fullMethodName, start, i); - return ParseArity(fullMethodName, i, out arity); - case '(': - methodName = Capture(fullMethodName, start, i); - arity = 0; - return i; - } - } - methodName = Capture(fullMethodName, start, i); - arity = 0; - return i; - } - - // parse arity in the form `nn where nn is an integer value. - private static int ParseArity(string fullMethodName, int start, out int arity) - { - arity = 0; - Debug.Assert(fullMethodName[start] == '`'); - - int i = start + 1; // skip initial '`' char - for (; i < fullMethodName.Length; i++) - { - if (fullMethodName[i] == '(') break; - } - if (!int.TryParse(Capture(fullMethodName, start + 1, i), out arity)) - { - string message = string.Format(CultureInfo.CurrentCulture, ManagedNameMessages.ErrorMethodArityMustBeNumeric); - throw new InvalidManagedNameException(message); - } - return i; - } - - private static int ParseParameterTypeList(string fullMethodName, int start, out string[] parameterTypes) - { - parameterTypes = null; - if (start == fullMethodName.Length) - { - return start; - } - Debug.Assert(fullMethodName[start] == '('); - - var types = new List(); - - int i = start + 1; // skip initial '(' char - for (; i < fullMethodName.Length; i++) - { - switch (fullMethodName[i]) - { - case ')': - if (types.Any()) - { - parameterTypes = types.ToArray(); - } - return i + 1; // consume right parens - case ',': - break; - default: - i = ParseParameterType(fullMethodName, i, out var parameterType); - types.Add(parameterType); - break; - } - } - - string message = string.Format(CultureInfo.CurrentCulture, ManagedNameMessages.ErrorIncompleteManagedName); - throw new InvalidManagedNameException(message); - } - - private static int ParseParameterType(string fullMethodName, int start, out string parameterType) - { - parameterType = string.Empty; - - int i = start; - for (; i < fullMethodName.Length; i++) - { - switch (fullMethodName[i]) - { - case '<': - i = ParseGenericBrackets(fullMethodName, i + 1); - break; - case '[': - i = ParseArrayBrackets(fullMethodName, i + 1); - break; - case ',': - case ')': - parameterType = Capture(fullMethodName, start, i); - return i - 1; - case var w when char.IsWhiteSpace(w): - string message = string.Format(CultureInfo.CurrentCulture, ManagedNameMessages.ErrorWhitespaceNotValid, i); - throw new InvalidManagedNameException(message); - } - } - return i; - } - - private static int ParseArrayBrackets(string fullMethodName, int start) - { - for (int i = start; i < fullMethodName.Length; i++) - { - switch (fullMethodName[i]) - { - case ']': - return i; - case var w when char.IsWhiteSpace(w): - string msg = string.Format(CultureInfo.CurrentCulture, ManagedNameMessages.ErrorWhitespaceNotValid, i); - throw new InvalidManagedNameException(msg); - } - } - - string message = string.Format(CultureInfo.CurrentCulture, ManagedNameMessages.ErrorIncompleteManagedName); - throw new InvalidManagedNameException(message); - } - - private static int ParseGenericBrackets(string fullMethodName, int start) - { - for (int i = start; i < fullMethodName.Length; i++) - { - switch (fullMethodName[i]) - { - case '<': - i = ParseGenericBrackets(fullMethodName, i + 1); - break; - case '>': - return i; - case var w when char.IsWhiteSpace(w): - string msg = string.Format(CultureInfo.CurrentCulture, ManagedNameMessages.ErrorWhitespaceNotValid, i); - throw new InvalidManagedNameException(msg); - } - } - - string message = string.Format(CultureInfo.CurrentCulture, ManagedNameMessages.ErrorIncompleteManagedName); - throw new InvalidManagedNameException(message); - } - } -} diff --git a/src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj b/src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj index e0bcb43aa0..ac7507c007 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj +++ b/src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj @@ -78,7 +78,6 @@ - TextTemplatingFileGenerator @@ -91,11 +90,6 @@ True CommonResources.resx - - True - True - ManagedNameMessages.resx - True True @@ -108,18 +102,11 @@ Resources\CommonResources.tt CommonResources.Designer.cs - - ResXFileCodeGenerator - ManagedNameMessages.Designer.cs - ResXFileCodeGenerator Resources.Designer.cs - - - Microsoft.VisualStudio.TestPlatform.ObjectModel diff --git a/src/Microsoft.TestPlatform.ObjectModel/TestCase.cs b/src/Microsoft.TestPlatform.ObjectModel/TestCase.cs index 7728529e6b..5dd1f45ded 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/TestCase.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/TestCase.cs @@ -10,7 +10,6 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel using System.Linq; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities; - using System.Reflection; /// /// Stores information about a test case. @@ -29,8 +28,6 @@ public sealed class TestCase : TestObject private string displayName; private string fullyQualifiedName; private string source; - private string managedMethod; - private string managedType; #region Constructor @@ -66,64 +63,6 @@ public TestCase(string fullyQualifiedName, Uri executorUri, string source) this.Source = source; this.LineNumber = -1; } - - /// - /// Initializes a new instance of the class. - /// - /// - /// Fully qualified name of the test case. - /// - /// - /// Managed method to extract the values of and . - /// - /// - /// The Uri of the executor to use for running this test. - /// - /// - /// Test container source from which the test is discovered. - /// - /// - /// If is specified, TestId will be calculated based on that instead of . - /// - public TestCase(string fullyQualifiedName, MethodBase method, Uri executorUri, string source) - : this(fullyQualifiedName, executorUri, source) - { - ValidateArg.NotNull(method, nameof(method)); - - ManagedNameUtilities.ManagedNameHelper.GetManagedName(method, out var managedType, out var managedMethod); - - ManagedType = managedType; - ManagedMethod = managedMethod; - } - - /// - /// Initializes a new instance of the class. - /// - /// - /// Fully qualified name of the test case. - /// - /// - /// Managed method to extract the values of and . - /// - /// - /// The Uri of the executor to use for running this test. - /// - /// - /// Test container source from which the test is discovered. - /// - /// - /// If and are specified, TestId will be calculated based on those instead of . - /// - public TestCase(string fullyQualifiedName, string managedType, string managedMethod, Uri executorUri, string source) - : this(fullyQualifiedName, executorUri, source) - { - ValidateArg.NotNullOrWhiteSpace(managedType, nameof(managedType)); - ValidateArg.NotNullOrWhiteSpace(managedMethod, nameof(managedMethod)); - - ManagedType = managedType; - ManagedMethod = managedMethod; - } - #endregion #region Properties @@ -132,7 +71,7 @@ public TestCase(string fullyQualifiedName, string managedType, string managedMet /// LocalExtensionData which can be used by Adapter developers for local transfer of extended properties. /// Note that this data is available only for in-Proc execution, and may not be available for OutProc executors /// - public Object LocalExtensionData + public object LocalExtensionData { get { return localExtensionData; } set { localExtensionData = value; } @@ -165,34 +104,6 @@ public Guid Id } } - /// - /// Gets or sets the fully specified type name metadata format. - /// - /// - /// NamespaceA.NamespaceB.ClassName`1+InnerClass`2 - /// - [DataMember] - public string ManagedType { - get => managedType; - - // defaultId should be reset as it is based on ManagedType, ManagedMethod and Source. - set => SetVariableAndResetId(ref managedType, value); - } - - /// - /// Gets or sets the fully specified method name metadata format. - /// - /// - /// MethodName`2(ParamTypeA,ParamTypeB,�) - /// - [DataMember] - public string ManagedMethod { - get => managedMethod; - - // defaultId should be reset as it is based on ManagedType, ManagedMethod and Source. - set => SetVariableAndResetId(ref managedMethod, value); - } - /// /// Gets or sets the fully qualified name of the test case. /// @@ -213,14 +124,9 @@ public string DisplayName { get { - if(string.IsNullOrEmpty(this.displayName)) + if (string.IsNullOrEmpty(this.displayName)) { - if (this.HasManagedMethodAndType) - { - return $"{managedType}.{ManagedMethod}"; - } - - return this.FullyQualifiedName; + return this.GetFullyQualifiedName(); } return this.displayName; @@ -288,24 +194,6 @@ public override IEnumerable Properties } } - /// - /// Returns true if both and are not null or whitespace. - /// - public bool HasManagedMethodAndType => !string.IsNullOrWhiteSpace(ManagedType) && !string.IsNullOrWhiteSpace(ManagedMethod); - - /// - public override string ToString() - { - if (this.HasManagedMethodAndType) - { - return $"{ManagedType}.{ManagedMethod}"; - } - else - { - return this.FullyQualifiedName; - } - } - #endregion #region private methods @@ -340,18 +228,11 @@ private Guid GetTestId() // We still need to handle parameters in the case of a Theory or TestGroup of test cases that are only // distinguished by parameters. - var testcaseFullName = this.ExecutorUri + source; - + var testcaseFullName = this.ExecutorUri + source; + // If ManagedType and ManagedMethod properties are filled than TestId should be based on those. - if (this.HasManagedMethodAndType) - { - testcaseFullName += $"{managedType}.{managedMethod}"; - } - else - { - testcaseFullName += this.FullyQualifiedName; - } - + testcaseFullName += this.GetFullyQualifiedName(); + return EqtHash.GuidFromString(testcaseFullName); } @@ -361,6 +242,12 @@ private void SetVariableAndResetId(ref T variable, T value) this.defaultId = Guid.Empty; } + private void SetPropertyAndResetId(TestProperty property, T value) + { + SetPropertyValue(property, value); + this.defaultId = Guid.Empty; + } + #endregion #region Protected Methods @@ -383,10 +270,6 @@ protected override object ProtectedGetPropertyValue(TestProperty property, objec return this.ExecutorUri; case "TestCase.FullyQualifiedName": return this.FullyQualifiedName; - case "TestCase.ManagedType": - return this.ManagedType; - case "TestCase.ManagedMethod": - return this.ManagedMethod; case "TestCase.Id": return this.Id; case "TestCase.LineNumber": @@ -424,14 +307,6 @@ protected override void ProtectedSetPropertyValue(TestProperty property, object this.FullyQualifiedName = value as string; return; - case "TestCase.ManagedType": - this.ManagedType = value as string; - return; - - case "TestCase.ManagedMethod": - this.ManagedMethod = value as string; - return; - case "TestCase.Id": this.Id = value is Guid ? (Guid)value : Guid.Parse(value as string); return; @@ -450,6 +325,32 @@ protected override void ProtectedSetPropertyValue(TestProperty property, object } #endregion + + #region ManagedName and ManagedType implementations + + private static readonly TestProperty ManagedTypeProperty = TestProperty.Register("TestCase.ManagedType", "ManagedType", string.Empty, string.Empty, typeof(string), o => !string.IsNullOrWhiteSpace(o as string), TestPropertyAttributes.Hidden, typeof(TestCase)); + private static readonly TestProperty ManagedMethodProperty = TestProperty.Register("TestCase.ManagedMethod", "ManagedMethod", string.Empty, string.Empty, typeof(string), o => !string.IsNullOrWhiteSpace(o as string), TestPropertyAttributes.Hidden, typeof(TestCase)); + + private bool ContainsManagedMethodAndType => !string.IsNullOrWhiteSpace(ManagedMethod) && !string.IsNullOrWhiteSpace(ManagedType); + + private string ManagedType + { + get => GetPropertyValue(ManagedTypeProperty, null); + set => SetPropertyAndResetId(ManagedTypeProperty, value); + } + + private string ManagedMethod + { + get => GetPropertyValue(ManagedMethodProperty, null); + set => SetPropertyAndResetId(ManagedMethodProperty, value); + } + + private string GetFullyQualifiedName() => ContainsManagedMethodAndType ? $"{ManagedType}.{ManagedMethod}" : FullyQualifiedName; + + #endregion + + /// + public override string ToString() => this.GetFullyQualifiedName(); } /// @@ -465,8 +366,6 @@ public static class TestCaseProperties /// private const string IdLabel = "Id"; private const string FullyQualifiedNameLabel = "FullyQualifiedName"; - private const string ManagedTypeLabel = "ManagedType"; - private const string ManagedMethodLabel = "ManagedMethod"; private const string NameLabel = "Name"; private const string ExecutorUriLabel = "Executor Uri"; private const string SourceLabel = "Source"; @@ -475,31 +374,12 @@ public static class TestCaseProperties #endregion - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] public static readonly TestProperty Id = TestProperty.Register("TestCase.Id", IdLabel, string.Empty, string.Empty, typeof(Guid), ValidateGuid, TestPropertyAttributes.Hidden, typeof(TestCase)); - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] public static readonly TestProperty FullyQualifiedName = TestProperty.Register("TestCase.FullyQualifiedName", FullyQualifiedNameLabel, string.Empty, string.Empty, typeof(string), ValidateName, TestPropertyAttributes.Hidden, typeof(TestCase)); - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] - public static readonly TestProperty ManagedType = TestProperty.Register("TestCase.ManagedType", ManagedTypeLabel, string.Empty, string.Empty, typeof(string), ValidateName, TestPropertyAttributes.Hidden, typeof(TestCase)); - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] - public static readonly TestProperty ManagedMethod = TestProperty.Register("TestCase.ManagedMethod", ManagedMethodLabel, string.Empty, string.Empty, typeof(string), ValidateName, TestPropertyAttributes.Hidden, typeof(TestCase)); - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] public static readonly TestProperty DisplayName = TestProperty.Register("TestCase.DisplayName", NameLabel, string.Empty, string.Empty, typeof(string), ValidateDisplay, TestPropertyAttributes.None, typeof(TestCase)); - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] public static readonly TestProperty ExecutorUri = TestProperty.Register("TestCase.ExecutorUri", ExecutorUriLabel, string.Empty, string.Empty, typeof(Uri), ValidateExecutorUri, TestPropertyAttributes.Hidden, typeof(TestCase)); - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] public static readonly TestProperty Source = TestProperty.Register("TestCase.Source", SourceLabel, typeof(string), typeof(TestCase)); - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] public static readonly TestProperty CodeFilePath = TestProperty.Register("TestCase.CodeFilePath", FilePathLabel, typeof(string), typeof(TestCase)); - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] public static readonly TestProperty LineNumber = TestProperty.Register("TestCase.LineNumber", LineNumberLabel, typeof(int), TestPropertyAttributes.Hidden, typeof(TestCase)); internal static TestProperty[] Properties { get; } = @@ -508,8 +388,6 @@ public static class TestCaseProperties DisplayName, ExecutorUri, FullyQualifiedName, - ManagedType, - ManagedMethod, Id, LineNumber, Source @@ -531,7 +409,6 @@ private static bool ValidateExecutorUri(object value) return value != null; } - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", Justification = "Required to validate the input value.")] private static bool ValidateGuid(object value) { try diff --git a/src/package/nuspec/Microsoft.TestPlatform.AdapterUtilities.nuspec b/src/package/nuspec/Microsoft.TestPlatform.AdapterUtilities.nuspec new file mode 100644 index 0000000000..2dfbe5b36c --- /dev/null +++ b/src/package/nuspec/Microsoft.TestPlatform.AdapterUtilities.nuspec @@ -0,0 +1,51 @@ + + + + Microsoft.TestPlatform.AdapterUtilities + 15.0.0 + Microsoft.TestPlatform.AdapterUtilities + Microsoft + Microsoft + true + + Includes helpers for the Test Platform's modern functionality such as standardized fully qualified names and hierarchical test case names. + + http://www.microsoft.com/web/webpi/eula/net_library_eula_enu.htm + http://go.microsoft.com/fwlink/?LinkID=288859 + Icon.png + https://github.com/microsoft/vstest/ + © Microsoft Corporation. All rights reserved. + vstest visual-studio unittest testplatform mstest microsoft test testing + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/Microsoft.TestPlatform.ObjectModel.ManagedNameUtilities.UnitTests/FindMethodExtensions.cs b/test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/ManagedNameUtilities/FindMethodExtensions.cs similarity index 97% rename from test/Microsoft.TestPlatform.ObjectModel.ManagedNameUtilities.UnitTests/FindMethodExtensions.cs rename to test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/ManagedNameUtilities/FindMethodExtensions.cs index dee213e414..8455bcb5f2 100644 --- a/test/Microsoft.TestPlatform.ObjectModel.ManagedNameUtilities.UnitTests/FindMethodExtensions.cs +++ b/test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/ManagedNameUtilities/FindMethodExtensions.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. -namespace Microsoft.TestPlatform.ObjectModel.ManagedNameUtilities.UnitTests +namespace Microsoft.TestPlatform.AdapterUtilities.ManagedNameUtilities.UnitTests { using Microsoft.CodeAnalysis; diff --git a/test/Microsoft.TestPlatform.ObjectModel.ManagedNameUtilities.UnitTests/ManagedNameParserTests.cs b/test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/ManagedNameUtilities/ManagedNameParserTests.cs similarity index 82% rename from test/Microsoft.TestPlatform.ObjectModel.ManagedNameUtilities.UnitTests/ManagedNameParserTests.cs rename to test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/ManagedNameUtilities/ManagedNameParserTests.cs index b56b54774c..5747d460da 100644 --- a/test/Microsoft.TestPlatform.ObjectModel.ManagedNameUtilities.UnitTests/ManagedNameParserTests.cs +++ b/test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/ManagedNameUtilities/ManagedNameParserTests.cs @@ -1,9 +1,9 @@ // 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.TestPlatform.ObjectModel.ManagedNameUtilities.UnitTests +namespace Microsoft.TestPlatform.AdapterUtilities.ManagedNameUtilities.UnitTests { - using Microsoft.VisualStudio.TestPlatform.ObjectModel.ManagedNameUtilities; + using Microsoft.TestPlatform.AdapterUtilities.ManagedNameUtilities; using Microsoft.VisualStudio.TestTools.UnitTesting; [TestClass] @@ -12,9 +12,9 @@ public class ManagedNameParserTests [TestMethod] public void ParseTypeName() { - (string, string) Parse(string fullTypeName) + (string, string) Parse(string managedTypeName) { - ManagedNameParser.ParseTypeName(fullTypeName, out var namespaceName, out var typeName); + ManagedNameParser.ParseManagedTypeName(managedTypeName, out var namespaceName, out var typeName); return (namespaceName, typeName); }; @@ -29,9 +29,9 @@ public void ParseTypeName() [TestMethod] public void ParseMethodName() { - (string, int, string[]) Parse(string methodName) + (string, int, string[]) Parse(string managedMethodName) { - ManagedNameParser.ParseMethodName(methodName, out var method, out var arity, out var parameterTypes); + ManagedNameParser.ParseManagedMethodName(managedMethodName, out var method, out var arity, out var parameterTypes); return (method, arity, parameterTypes); } @@ -58,7 +58,7 @@ public void ParseInvalidMethodName() { (string, int, string[]) Parse(string methodName) { - ManagedNameParser.ParseMethodName(methodName, out var method, out var arity, out var parameterTypes); + ManagedNameParser.ParseManagedMethodName(methodName, out var method, out var arity, out var parameterTypes); return (method, arity, parameterTypes); } diff --git a/test/Microsoft.TestPlatform.ObjectModel.ManagedNameUtilities.UnitTests/ManagedNameRoundTripTests.cs b/test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/ManagedNameUtilities/ManagedNameRoundTripTests.cs similarity index 80% rename from test/Microsoft.TestPlatform.ObjectModel.ManagedNameUtilities.UnitTests/ManagedNameRoundTripTests.cs rename to test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/ManagedNameUtilities/ManagedNameRoundTripTests.cs index bc69a9dcc1..5ff18ae6ad 100644 --- a/test/Microsoft.TestPlatform.ObjectModel.ManagedNameUtilities.UnitTests/ManagedNameRoundTripTests.cs +++ b/test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/ManagedNameUtilities/ManagedNameRoundTripTests.cs @@ -1,11 +1,11 @@ // 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.TestPlatform.ObjectModel.ManagedNameUtilities.UnitTests +namespace Microsoft.TestPlatform.AdapterUtilities.ManagedNameUtilities.UnitTests { using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; - using Microsoft.VisualStudio.TestPlatform.ObjectModel.ManagedNameUtilities; + using Microsoft.TestPlatform.AdapterUtilities.ManagedNameUtilities; using Microsoft.VisualStudio.TestTools.UnitTesting; using System.IO; @@ -35,8 +35,8 @@ public void Simple1() methodInfo: typeof(TestClasses.Outer).GetMethod("Method0"), containingTypeSymbol: outer, methodSymbol: outer.FindMethod("Method0"), - fullTypeName: "TestClasses.Outer", - fullMethodName: "Method0"); + managedTypeName: "TestClasses.Outer", + managedMethodName: "Method0"); } [TestMethod] @@ -48,8 +48,8 @@ public void Simple2() methodInfo: typeof(TestClasses.Outer).GetMethod("Method1"), containingTypeSymbol: outer, methodSymbol: outer.FindMethod("Method1"), - fullTypeName: "TestClasses.Outer", - fullMethodName: "Method1(System.Int32)"); + managedTypeName: "TestClasses.Outer", + managedMethodName: "Method1(System.Int32)"); } [TestMethod] @@ -61,8 +61,8 @@ public void Simple3() methodInfo: typeof(TestClasses.Outer).GetMethod("Method2"), containingTypeSymbol: outer, methodSymbol: outer.FindMethod("Method2"), - fullTypeName: "TestClasses.Outer", - fullMethodName: "Method2(System.Collections.Generic.List`1)"); + managedTypeName: "TestClasses.Outer", + managedMethodName: "Method2(System.Collections.Generic.List`1)"); } [TestMethod] @@ -74,8 +74,8 @@ public void Simple4() methodInfo: typeof(TestClasses.Outer).GetMethod("Method3"), containingTypeSymbol: outer, methodSymbol: outer.FindMethod("Method3"), - fullTypeName: "TestClasses.Outer", - fullMethodName: "Method3(System.String,System.Int32)"); + managedTypeName: "TestClasses.Outer", + managedMethodName: "Method3(System.String,System.Int32)"); } [TestMethod] @@ -87,8 +87,8 @@ public void Nested1() methodInfo: typeof(TestClasses.Outer.Inner).GetMethod("Method0"), containingTypeSymbol: outerInner, methodSymbol: outerInner.FindMethod("Method0"), - fullTypeName: "TestClasses.Outer+Inner", - fullMethodName: "Method0"); + managedTypeName: "TestClasses.Outer+Inner", + managedMethodName: "Method0"); } [TestMethod] @@ -100,8 +100,8 @@ public void Nested2() methodInfo: typeof(TestClasses.Outer.Inner).GetMethod("Method1"), containingTypeSymbol: outerInner, methodSymbol: outerInner.FindMethod("Method1"), - fullTypeName: "TestClasses.Outer+Inner", - fullMethodName: "Method1(System.Int32)"); + managedTypeName: "TestClasses.Outer+Inner", + managedMethodName: "Method1(System.Int32)"); } [TestMethod] @@ -113,8 +113,8 @@ public void OpenGeneric1() methodInfo: typeof(TestClasses.Outer<>).GetMethod("Method0"), containingTypeSymbol: outerT, methodSymbol: outerT.FindMethod("Method0"), - fullTypeName: "TestClasses.Outer`1", - fullMethodName: "Method0"); + managedTypeName: "TestClasses.Outer`1", + managedMethodName: "Method0"); } [TestMethod] @@ -126,8 +126,8 @@ public void OpenGeneric2() methodInfo: typeof(TestClasses.Outer<>).GetMethod("Method1"), containingTypeSymbol: outerT, methodSymbol: outerT.FindMethod("Method1"), - fullTypeName: "TestClasses.Outer`1", - fullMethodName: "Method1(!0)"); + managedTypeName: "TestClasses.Outer`1", + managedMethodName: "Method1(!0)"); } [TestMethod] @@ -139,8 +139,8 @@ public void OpenGeneric3() methodInfo: typeof(TestClasses.Outer<>).GetMethod("Method2"), containingTypeSymbol: outerT, methodSymbol: outerT.FindMethod("Method2"), - fullTypeName: "TestClasses.Outer`1", - fullMethodName: "Method2`1(!!0[])"); + managedTypeName: "TestClasses.Outer`1", + managedMethodName: "Method2`1(!!0[])"); } [TestMethod] @@ -152,8 +152,8 @@ public void OpenGeneric4() methodInfo: typeof(TestClasses.Outer<>).GetMethod("Method3"), containingTypeSymbol: outerT, methodSymbol: outerT.FindMethod("Method3"), - fullTypeName: "TestClasses.Outer`1", - fullMethodName: "Method3`1(!0,!!0)"); + managedTypeName: "TestClasses.Outer`1", + managedMethodName: "Method3`1(!0,!!0)"); } [TestMethod] @@ -165,8 +165,8 @@ public void OpenGenericNested1() methodInfo: typeof(TestClasses.Outer<>.Inner<>).GetMethod("Method0"), containingTypeSymbol: outerTInnterV, methodSymbol: outerTInnterV.FindMethod("Method0"), - fullTypeName: "TestClasses.Outer`1+Inner`1", - fullMethodName: "Method0"); + managedTypeName: "TestClasses.Outer`1+Inner`1", + managedMethodName: "Method0"); } [TestMethod] @@ -178,8 +178,8 @@ public void OpenGenericNested2() methodInfo: typeof(TestClasses.Outer<>.Inner<>).GetMethod("Method1"), containingTypeSymbol: outerTInnterV, methodSymbol: outerTInnterV.FindMethod("Method1"), - fullTypeName: "TestClasses.Outer`1+Inner`1", - fullMethodName: "Method1(!0)"); + managedTypeName: "TestClasses.Outer`1+Inner`1", + managedMethodName: "Method1(!0)"); } [TestMethod] @@ -191,8 +191,8 @@ public void OpenGenericNested3() methodInfo: typeof(TestClasses.Outer<>.Inner<>).GetMethod("Method2"), containingTypeSymbol: outerTInnterV, methodSymbol: outerTInnterV.FindMethod("Method2"), - fullTypeName: "TestClasses.Outer`1+Inner`1", - fullMethodName: "Method2(!1)"); + managedTypeName: "TestClasses.Outer`1+Inner`1", + managedMethodName: "Method2(!1)"); } [TestMethod] @@ -204,8 +204,8 @@ public void OpenGenericNested4() methodInfo: typeof(TestClasses.Outer<>.Inner<>).GetMethod("Method3"), containingTypeSymbol: outerTInnterV, methodSymbol: outerTInnterV.FindMethod("Method3"), - fullTypeName: "TestClasses.Outer`1+Inner`1", - fullMethodName: "Method3`1(!0,!!0,!1)"); + managedTypeName: "TestClasses.Outer`1+Inner`1", + managedMethodName: "Method3`1(!0,!!0,!1)"); } [TestMethod] @@ -217,8 +217,8 @@ public void OpenGenericNested5() methodInfo: typeof(TestClasses.Outer<>.Inner<>).GetMethod("Method4"), containingTypeSymbol: outerTInnterV, methodSymbol: outerTInnterV.FindMethod("Method4"), - fullTypeName: "TestClasses.Outer`1+Inner`1", - fullMethodName: "Method4`2(!!1,!!0)"); + managedTypeName: "TestClasses.Outer`1+Inner`1", + managedMethodName: "Method4`2(!!1,!!0)"); } [TestMethod] @@ -230,8 +230,8 @@ public void OpenGenericNested6() methodInfo: typeof(TestClasses.Outer<>.Inner<>.MoreInner<>).GetMethod("Method0"), containingTypeSymbol: outerTInnerVMoreInnerI, methodSymbol: outerTInnerVMoreInnerI.FindMethod("Method0"), - fullTypeName: "TestClasses.Outer`1+Inner`1+MoreInner`1", - fullMethodName: "Method0`1(!0,!1,!2,!!0)"); + managedTypeName: "TestClasses.Outer`1+Inner`1+MoreInner`1", + managedMethodName: "Method0`1(!0,!1,!2,!!0)"); } [TestMethod] @@ -244,8 +244,8 @@ public void ClosedGeneric1() methodInfo: typeof(TestClasses.Outer).GetMethod("Method0"), containingTypeSymbol: outerTInt, methodSymbol: outerTInt.FindMethod("Method0"), - fullTypeName: "TestClasses.Outer`1", - fullMethodName: "Method0"); + managedTypeName: "TestClasses.Outer`1", + managedMethodName: "Method0"); } [TestMethod] @@ -258,8 +258,8 @@ public void ClosedGeneric2() methodInfo: typeof(TestClasses.Outer).GetMethod("Method1"), containingTypeSymbol: outerTInt, methodSymbol: outerTInt.FindMethod("Method1"), - fullTypeName: "TestClasses.Outer`1", - fullMethodName: "Method1(!0)"); + managedTypeName: "TestClasses.Outer`1", + managedMethodName: "Method1(!0)"); } [TestMethod] @@ -272,8 +272,8 @@ public void ClosedGeneric3() methodInfo: typeof(TestClasses.Outer).GetMethod("Method2"), containingTypeSymbol: outerTInt, methodSymbol: outerTInt.FindMethod("Method2"), - fullTypeName: "TestClasses.Outer`1", - fullMethodName: "Method2`1(!!0[])"); + managedTypeName: "TestClasses.Outer`1", + managedMethodName: "Method2`1(!!0[])"); } [TestMethod] @@ -286,8 +286,8 @@ public void ClosedGeneric4() methodInfo: typeof(TestClasses.Outer).GetMethod("Method3"), containingTypeSymbol: outerTInt, methodSymbol: outerTInt.FindMethod("Method3"), - fullTypeName: "TestClasses.Outer`1", - fullMethodName: "Method3`1(!0,!!0)"); + managedTypeName: "TestClasses.Outer`1", + managedMethodName: "Method3`1(!0,!!0)"); } [TestMethod] @@ -302,8 +302,8 @@ public void ClosedGenericNested1() methodInfo: typeof(TestClasses.Outer.Inner).GetMethod("Method0"), containingTypeSymbol: outerTIntInnerVString, methodSymbol: outerTIntInnerVString.FindMethod("Method0"), - fullTypeName: "TestClasses.Outer`1+Inner`1", - fullMethodName: "Method0"); + managedTypeName: "TestClasses.Outer`1+Inner`1", + managedMethodName: "Method0"); } [TestMethod] @@ -318,8 +318,8 @@ public void ClosedGenericNested2() methodInfo: typeof(TestClasses.Outer.Inner).GetMethod("Method1"), containingTypeSymbol: outerTIntInnerVString, methodSymbol: outerTIntInnerVString.FindMethod("Method1"), - fullTypeName: "TestClasses.Outer`1+Inner`1", - fullMethodName: "Method1(!0)"); + managedTypeName: "TestClasses.Outer`1+Inner`1", + managedMethodName: "Method1(!0)"); } [TestMethod] @@ -334,8 +334,8 @@ public void ClosedGenericNested3() methodInfo: typeof(TestClasses.Outer.Inner).GetMethod("Method2"), containingTypeSymbol: outerTIntInnerVString, methodSymbol: outerTIntInnerVString.FindMethod("Method2"), - fullTypeName: "TestClasses.Outer`1+Inner`1", - fullMethodName: "Method2(!1)"); + managedTypeName: "TestClasses.Outer`1+Inner`1", + managedMethodName: "Method2(!1)"); } [TestMethod] @@ -350,8 +350,8 @@ public void ClosedGenericNested4() methodInfo: typeof(TestClasses.Outer.Inner).GetMethod("Method3"), containingTypeSymbol: outerTIntInnerVString, methodSymbol: outerTIntInnerVString.FindMethod("Method3"), - fullTypeName: "TestClasses.Outer`1+Inner`1", - fullMethodName: "Method3`1(!0,!!0,!1)"); + managedTypeName: "TestClasses.Outer`1+Inner`1", + managedMethodName: "Method3`1(!0,!!0,!1)"); } [TestMethod] @@ -366,8 +366,8 @@ public void ClosedGenericNested5() methodInfo: typeof(TestClasses.Outer.Inner).GetMethod("Method4"), containingTypeSymbol: outerTIntInnerVString, methodSymbol: outerTIntInnerVString.FindMethod("Method4"), - fullTypeName: "TestClasses.Outer`1+Inner`1", - fullMethodName: "Method4`2(!!1,!!0)"); + managedTypeName: "TestClasses.Outer`1+Inner`1", + managedMethodName: "Method4`2(!!1,!!0)"); } [TestMethod] @@ -381,8 +381,8 @@ public void ClosedGenericMethod1() methodInfo: typeof(TestClasses.Outer).GetMethod("Method3").MakeGenericMethod(typeof(string)), containingTypeSymbol: outerTInt, methodSymbol: outerTInt.FindMethod("Method3").Construct(@string), - fullTypeName: "TestClasses.Outer`1", - fullMethodName: "Method3`1(!0,!!0)"); + managedTypeName: "TestClasses.Outer`1", + managedMethodName: "Method3`1(!0,!!0)"); } [TestMethod] @@ -395,8 +395,8 @@ public void ClosedGenericMethod2() methodInfo: typeof(TestClasses.Outer.Inner).GetMethod("Method2").MakeGenericMethod(typeof(int)), containingTypeSymbol: outerInner, methodSymbol: outerInner.FindMethod("Method2").Construct(@int), - fullTypeName: "TestClasses.Outer+Inner", - fullMethodName: "Method2`1(System.Int32)"); + managedTypeName: "TestClasses.Outer+Inner", + managedMethodName: "Method2`1(System.Int32)"); } [TestMethod] @@ -411,8 +411,8 @@ public void ClosedGenericMethod3() methodInfo: typeof(TestClasses.Outer.Inner).GetMethod("Method3").MakeGenericMethod(typeof(float), typeof(string)), containingTypeSymbol: outerInner, methodSymbol: outerInner.FindMethod("Method3").Construct(@float, @string), - fullTypeName: "TestClasses.Outer+Inner", - fullMethodName: "Method3`2(System.Int32)"); + managedTypeName: "TestClasses.Outer+Inner", + managedMethodName: "Method3`2(System.Int32)"); } [TestMethod] @@ -424,8 +424,8 @@ public void ExplicitInterfaceImplementation1() methodInfo: typeof(TestClasses.Impl).GetMethod("TestClasses.IImplementation.ImplMethod0", PrivateBindingFlags), containingTypeSymbol: impl, methodSymbol: impl.FindMethod("TestClasses.IImplementation.ImplMethod0"), - fullTypeName: "TestClasses.Impl", - fullMethodName: "TestClasses.IImplementation.ImplMethod0"); + managedTypeName: "TestClasses.Impl", + managedMethodName: "TestClasses.IImplementation.ImplMethod0"); } [TestMethod] @@ -437,8 +437,8 @@ public void ExplicitInterfaceImplementation2() methodInfo: typeof(TestClasses.Impl).GetMethod("TestClasses.IImplementation.ImplMethod1", PrivateBindingFlags), containingTypeSymbol: impl, methodSymbol: impl.FindMethod("TestClasses.IImplementation.ImplMethod1"), - fullTypeName: "TestClasses.Impl", - fullMethodName: "TestClasses.IImplementation.ImplMethod1(System.Int32)"); + managedTypeName: "TestClasses.Impl", + managedMethodName: "TestClasses.IImplementation.ImplMethod1(System.Int32)"); } [TestMethod] @@ -450,8 +450,8 @@ public void GenericExplicitInterfaceImplementation1() methodInfo: typeof(TestClasses.Impl<>).GetMethod("TestClasses.IImplementation.ImplMethod0", PrivateBindingFlags), containingTypeSymbol: implT, methodSymbol: implT.FindMethod("TestClasses.IImplementation.ImplMethod0"), - fullTypeName: "TestClasses.Impl`1", - fullMethodName: "TestClasses.IImplementation.ImplMethod0"); + managedTypeName: "TestClasses.Impl`1", + managedMethodName: "TestClasses.IImplementation.ImplMethod0"); } [TestMethod] @@ -463,8 +463,8 @@ public void GenericExplicitInterfaceImplementation2() methodInfo: typeof(TestClasses.Impl<>).GetMethod("TestClasses.IImplementation.ImplMethod1", PrivateBindingFlags), containingTypeSymbol: implT, methodSymbol: implT.FindMethod("TestClasses.IImplementation.ImplMethod1"), - fullTypeName: "TestClasses.Impl`1", - fullMethodName: "TestClasses.IImplementation.ImplMethod1(!0)"); + managedTypeName: "TestClasses.Impl`1", + managedMethodName: "TestClasses.IImplementation.ImplMethod1(!0)"); } [TestMethod] @@ -476,8 +476,8 @@ public void GenericExplicitInterfaceImplementation3() methodInfo: typeof(TestClasses.Impl<>).GetMethod("TestClasses.IImplementation.ImplMethod2", PrivateBindingFlags), containingTypeSymbol: implT, methodSymbol: implT.FindMethod("TestClasses.IImplementation.ImplMethod2"), - fullTypeName: "TestClasses.Impl`1", - fullMethodName: "TestClasses.IImplementation.ImplMethod2`1(!0,!!0,System.String)"); + managedTypeName: "TestClasses.Impl`1", + managedMethodName: "TestClasses.IImplementation.ImplMethod2`1(!0,!!0,System.String)"); } [TestMethod] @@ -489,8 +489,8 @@ public void Inheritance1() methodInfo: typeof(TestClasses.OuterPrime).GetMethod("Method3"), containingTypeSymbol: outerPrime, methodSymbol: outerPrime.FindMethod("Method3"), - fullTypeName: "TestClasses.OuterPrime", - fullMethodName: "Method3(System.String,System.Int32)"); + managedTypeName: "TestClasses.OuterPrime", + managedMethodName: "Method3(System.String,System.Int32)"); } [TestMethod] @@ -502,8 +502,8 @@ public void Inheritance2() methodInfo: typeof(TestClasses.OuterPrime<>).GetMethod("Method3"), containingTypeSymbol: outerPrimeZ, methodSymbol: outerPrimeZ.FindMethod("Method3"), - fullTypeName: "TestClasses.OuterPrime`1", - fullMethodName: "Method3`1(!0,!!0)"); + managedTypeName: "TestClasses.OuterPrime`1", + managedMethodName: "Method3`1(!0,!!0)"); } [TestMethod] @@ -515,8 +515,8 @@ public void Inheritance3() methodInfo: typeof(TestClasses.OuterPrime<,>).GetMethod("Method3"), containingTypeSymbol: outerPrimeYZ, methodSymbol: outerPrimeYZ.FindMethod("Method3"), - fullTypeName: "TestClasses.OuterPrime`2", - fullMethodName: "Method3`1(!1,!!0)"); + managedTypeName: "TestClasses.OuterPrime`2", + managedMethodName: "Method3`1(!1,!!0)"); } [TestMethod] @@ -528,8 +528,8 @@ public void Inheritance4() methodInfo: typeof(TestClasses.OuterString).GetMethod("Method3"), containingTypeSymbol: outerString, methodSymbol: outerString.FindMethod("Method3"), - fullTypeName: "TestClasses.OuterString", - fullMethodName: "Method3`1(System.String,!!0)"); + managedTypeName: "TestClasses.OuterString", + managedMethodName: "Method3`1(System.String,!!0)"); } [TestMethod] @@ -541,8 +541,8 @@ public void Overloads1() methodInfo: typeof(TestClasses.Overloads).FindMethod("Void Overload0()"), containingTypeSymbol: overloads, methodSymbol: overloads.FindMethod("Overload0", 0), - fullTypeName: "TestClasses.Overloads", - fullMethodName: "Overload0"); + managedTypeName: "TestClasses.Overloads", + managedMethodName: "Overload0"); } [TestMethod] @@ -555,8 +555,8 @@ public void Overloads2() methodInfo: typeof(TestClasses.Overloads).FindMethod("Void Overload0(Int32)"), containingTypeSymbol: overloads, methodSymbol: overloads.FindMethod("Overload0", 0, @int), - fullTypeName: "TestClasses.Overloads", - fullMethodName: "Overload0(System.Int32)"); + managedTypeName: "TestClasses.Overloads", + managedMethodName: "Overload0(System.Int32)"); } [TestMethod] @@ -569,8 +569,8 @@ public void Overloads3() methodInfo: typeof(TestClasses.Overloads).FindMethod("Void Overload0(Int32, TestClasses.Overloads)"), containingTypeSymbol: overloads, methodSymbol: overloads.FindMethod("Overload0", 0, @int, overloads), - fullTypeName: "TestClasses.Overloads", - fullMethodName: "Overload0(System.Int32,TestClasses.Overloads)"); + managedTypeName: "TestClasses.Overloads", + managedMethodName: "Overload0(System.Int32,TestClasses.Overloads)"); } [TestMethod] @@ -584,8 +584,8 @@ public void Overloads4() methodInfo: typeof(TestClasses.Overloads).FindMethod("Void Overload0(Int32*)"), containingTypeSymbol: overloads, methodSymbol: overloads.FindMethod("Overload0", 0, intptr), - fullTypeName: "TestClasses.Overloads", - fullMethodName: "Overload0(System.Int32*)"); + managedTypeName: "TestClasses.Overloads", + managedMethodName: "Overload0(System.Int32*)"); } [TestMethod] @@ -598,8 +598,8 @@ public void Overloads5() methodInfo: typeof(TestClasses.Overloads).FindMethod("Void Overload0(System.Object)"), containingTypeSymbol: overloads, methodSymbol: overloads.FindMethod("Overload0", 0, dynamic), - fullTypeName: "TestClasses.Overloads", - fullMethodName: "Overload0(System.Object)"); + managedTypeName: "TestClasses.Overloads", + managedMethodName: "Overload0(System.Object)"); } [TestMethod] @@ -611,8 +611,8 @@ public void Overloads6() methodInfo: typeof(TestClasses.Overloads).FindMethod("Void Overload0[U](U)"), containingTypeSymbol: overloads, methodSymbol: overloads.FindMethod("Overload0", 1, 1, m => m.Parameters.Single().Type == m.TypeParameters.Single()), - fullTypeName: "TestClasses.Overloads", - fullMethodName: "Overload0`1(!!0)"); + managedTypeName: "TestClasses.Overloads", + managedMethodName: "Overload0`1(!!0)"); } [TestMethod] @@ -624,8 +624,8 @@ public void Overloads7() methodInfo: typeof(TestClasses.Overloads).FindMethod("Void Overload0[U]()"), containingTypeSymbol: overloads, methodSymbol: overloads.FindMethod("Overload0", 1), - fullTypeName: "TestClasses.Overloads", - fullMethodName: "Overload0`1"); + managedTypeName: "TestClasses.Overloads", + managedMethodName: "Overload0`1"); } [TestMethod] @@ -637,8 +637,8 @@ public void Overloads8() methodInfo: typeof(TestClasses.Overloads).FindMethod("Void Overload0[U,T]()"), containingTypeSymbol: overloads, methodSymbol: overloads.FindMethod("Overload0", 2), - fullTypeName: "TestClasses.Overloads", - fullMethodName: "Overload0`2"); + managedTypeName: "TestClasses.Overloads", + managedMethodName: "Overload0`2"); } [TestMethod] @@ -653,8 +653,8 @@ public void Overloads9() m => m.Parameters.Single().Type is IArrayTypeSymbol arrayType && arrayType.Rank == 1 && arrayType.ElementType == m.TypeParameters.Single()), - fullTypeName: "TestClasses.Overloads", - fullMethodName: "Overload0`1(!!0[])"); + managedTypeName: "TestClasses.Overloads", + managedMethodName: "Overload0`1(!!0[])"); } [TestMethod] @@ -671,8 +671,8 @@ public void Overloads10() arrayType.ElementType is IArrayTypeSymbol innerArrayType && innerArrayType.Rank == 1 && innerArrayType.ElementType == m.TypeParameters.Single()), - fullTypeName: "TestClasses.Overloads", - fullMethodName: "Overload0`1(!!0[][])"); + managedTypeName: "TestClasses.Overloads", + managedMethodName: "Overload0`1(!!0[][])"); } [TestMethod] @@ -687,8 +687,8 @@ public void Overloads11() m => m.Parameters.Single().Type is IArrayTypeSymbol arrayType && arrayType.Rank == 2 && arrayType.ElementType == m.TypeParameters.Single()), - fullTypeName: "TestClasses.Overloads", - fullMethodName: "Overload0`1(!!0[,])"); + managedTypeName: "TestClasses.Overloads", + managedMethodName: "Overload0`1(!!0[,])"); } [TestMethod] @@ -703,8 +703,8 @@ public void Overloads12() m => m.Parameters.Single().Type is IArrayTypeSymbol arrayType && arrayType.Rank == 3 && arrayType.ElementType == m.TypeParameters.Single()), - fullTypeName: "TestClasses.Overloads", - fullMethodName: "Overload0`1(!!0[,,])"); + managedTypeName: "TestClasses.Overloads", + managedMethodName: "Overload0`1(!!0[,,])"); } [TestMethod] @@ -718,8 +718,8 @@ public void Overloads13() methodInfo: typeof(TestClasses.Overloads).FindMethod("Void Overload0[U](System.Collections.Generic.List`1[System.Int32])"), containingTypeSymbol: overloads, methodSymbol: overloads.FindMethod("Overload0", 1, listInt), - fullTypeName: "TestClasses.Overloads", - fullMethodName: "Overload0`1(System.Collections.Generic.List`1)"); + managedTypeName: "TestClasses.Overloads", + managedMethodName: "Overload0`1(System.Collections.Generic.List`1)"); } [TestMethod] @@ -736,8 +736,8 @@ public void Overloads14() m.Parameters.Single().Type is INamedTypeSymbol p && p.OriginalDefinition == list && p.TypeArguments.Single() == m.TypeParameters.Single()), - fullTypeName: "TestClasses.Overloads", - fullMethodName: "Overload0`1(System.Collections.Generic.List`1)"); + managedTypeName: "TestClasses.Overloads", + managedMethodName: "Overload0`1(System.Collections.Generic.List`1)"); } [TestMethod] @@ -757,8 +757,8 @@ public void Overloads15() m.Parameters.Last() is INamedTypeSymbol p2 && p2.OriginalDefinition == tuple2 && p2.TypeArguments.SequenceEqual(m.TypeParameters.Reverse())), - fullTypeName: "TestClasses.Overloads", - fullMethodName: "Overload0`2(System.Tuple`2,System.Tuple`2)"); + managedTypeName: "TestClasses.Overloads", + managedMethodName: "Overload0`2(System.Tuple`2,System.Tuple`2)"); } [TestMethod] @@ -777,8 +777,8 @@ public void Overloads16() p.OriginalDefinition == tuple1 && p.TypeArguments.Single() is INamedTypeSymbol t && t.OriginalDefinition == tuple2), - fullTypeName: "TestClasses.Overloads", - fullMethodName: "Overload0(System.Tuple`1>)"); + managedTypeName: "TestClasses.Overloads", + managedMethodName: "Overload0(System.Tuple`1>)"); } [TestMethod] @@ -796,8 +796,8 @@ public void Overloads17() m.Parameters.Single().Type is INamedTypeSymbol p && p.OriginalDefinition == tuple2 && p.TypeArguments.All(t => t.OriginalDefinition == tuple1)), - fullTypeName: "TestClasses.Overloads", - fullMethodName: "Overload0(System.Tuple`2,System.Tuple`1>)"); + managedTypeName: "TestClasses.Overloads", + managedMethodName: "Overload0(System.Tuple`2,System.Tuple`1>)"); } [TestMethod] @@ -815,8 +815,8 @@ public void Overloads18() p.OriginalDefinition == tuple1 && p.TypeArguments.Single() is INamedTypeSymbol t && t.OriginalDefinition == tuple1), - fullTypeName: "TestClasses.Overloads", - fullMethodName: "Overload0`1(System.Tuple`1>>)"); + managedTypeName: "TestClasses.Overloads", + managedMethodName: "Overload0`1(System.Tuple`1>>)"); } #region Helpers @@ -824,45 +824,45 @@ private void VerifyRoundTrip( MethodInfo methodInfo, INamedTypeSymbol containingTypeSymbol, IMethodSymbol methodSymbol, - string fullTypeName, - string fullMethodName) + string managedTypeName, + string managedMethodName) { - VerifyRoundTripFromMethodInfo(methodInfo, fullTypeName, fullMethodName); - VerifyRoundTripFromName(fullTypeName, fullMethodName, methodInfo); - // VerifyRoundTripFromMethodSymbol(containingTypeSymbol, methodSymbol, fullTypeName, fullMethodName); - // VerifyRoundTripFromName(fullTypeName, fullMethodName, containingTypeSymbol, methodSymbol); + VerifyRoundTripFromMethodInfo(methodInfo, managedTypeName, managedMethodName); + VerifyRoundTripFromName(managedTypeName, managedMethodName, methodInfo); + // VerifyRoundTripFromMethodSymbol(containingTypeSymbol, methodSymbol, managedTypeName, managedMethodName); + // VerifyRoundTripFromName(managedTypeName, managedMethodName, containingTypeSymbol, methodSymbol); } private void VerifyRoundTripFromMethodInfo( MethodInfo methodInfo, - string expectedFullTypeName, - string expectedFullMethodName) + string expectedManagedTypeName, + string expectedManagedMethodName) { // Generate the fqn for the Reflection MethodInfo - ManagedNameHelper.GetManagedName(methodInfo, out var fullTypeName, out var fullMethodName); + ManagedNameHelper.GetManagedName(methodInfo, out var managedTypeName, out var managedMethodName); - Assert.AreEqual(expectedFullTypeName, fullTypeName); - Assert.AreEqual(expectedFullMethodName, fullMethodName); + Assert.AreEqual(expectedManagedTypeName, managedTypeName); + Assert.AreEqual(expectedManagedMethodName, managedMethodName); // Lookup the Reflection MethodInfo using fullTypeName and fullMethodName - var roundTrippedMethodInfo = ManagedNameHelper.GetManagedName( + var roundTrippedMethodInfo = ManagedNameHelper.GetMethod( Assembly.GetExecutingAssembly(), - fullTypeName, - fullMethodName); + managedTypeName, + managedMethodName); Assert.AreEqual(methodInfo.MetadataToken, roundTrippedMethodInfo.MetadataToken); } private void VerifyRoundTripFromName( - string fullTypeName, - string fullMethodName, + string managedTypeName, + string managedMethodName, MethodInfo expectedMethodInfo) { // Lookup the Reflection MethodInfo using fullTypeName and fullMethodName - var methodInfo = ManagedNameHelper.GetManagedName( + var methodInfo = ManagedNameHelper.GetMethod( Assembly.GetExecutingAssembly(), - fullTypeName, - fullMethodName); + managedTypeName, + managedMethodName); Assert.AreEqual(expectedMethodInfo.MetadataToken, methodInfo.MetadataToken); @@ -872,8 +872,8 @@ private void VerifyRoundTripFromName( out var roundTrippedFullTypeName, out var roundTrippedFullMethodName); - Assert.AreEqual(fullTypeName, roundTrippedFullTypeName); - Assert.AreEqual(fullMethodName, roundTrippedFullMethodName); + Assert.AreEqual(managedTypeName, roundTrippedFullTypeName); + Assert.AreEqual(managedMethodName, roundTrippedFullMethodName); } // private void VerifyRoundTripFromMethodSymbol( diff --git a/test/Microsoft.TestPlatform.ObjectModel.ManagedNameUtilities.UnitTests/Microsoft.TestPlatform.ObjectModel.ManagedNameUtilities.UnitTests.csproj b/test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/Microsoft.TestPlatform.AdapterUtilities.UnitTests.csproj similarity index 81% rename from test/Microsoft.TestPlatform.ObjectModel.ManagedNameUtilities.UnitTests/Microsoft.TestPlatform.ObjectModel.ManagedNameUtilities.UnitTests.csproj rename to test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/Microsoft.TestPlatform.AdapterUtilities.UnitTests.csproj index 87797a50dc..dabed0d2f0 100644 --- a/test/Microsoft.TestPlatform.ObjectModel.ManagedNameUtilities.UnitTests/Microsoft.TestPlatform.ObjectModel.ManagedNameUtilities.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/Microsoft.TestPlatform.AdapterUtilities.UnitTests.csproj @@ -8,7 +8,7 @@ netcoreapp2.1 Exe - Microsoft.TestPlatform.ObjectModel.ManagedNameUtilities.UnitTests + Microsoft.TestPlatform.AdapterUtilities.UnitTests true 3.8.0-3.20427.2 $(NoWarn);RS1024 @@ -19,12 +19,16 @@ - + + + + + PreserveNewest - - + + diff --git a/test/Microsoft.TestPlatform.ObjectModel.ManagedNameUtilities.UnitTests/Program.cs b/test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/Program.cs similarity index 78% rename from test/Microsoft.TestPlatform.ObjectModel.ManagedNameUtilities.UnitTests/Program.cs rename to test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/Program.cs index fbe5689406..e6fb5d296f 100644 --- a/test/Microsoft.TestPlatform.ObjectModel.ManagedNameUtilities.UnitTests/Program.cs +++ b/test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/Program.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. -namespace Microsoft.TestPlatform.ObjectModel.ManagedNameUtilities.UnitTests +namespace Microsoft.TestPlatform.AdapterUtilities.UnitTests { public static class Program { diff --git a/test/Microsoft.TestPlatform.ObjectModel.ManagedNameUtilities.UnitTests/TestClasses.cs b/test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/TestClasses.cs similarity index 100% rename from test/Microsoft.TestPlatform.ObjectModel.ManagedNameUtilities.UnitTests/TestClasses.cs rename to test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/TestClasses.cs diff --git a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/Serialization/TestResultSerializationTests.cs b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/Serialization/TestResultSerializationTests.cs index 7f16a8a11b..f84c978312 100644 --- a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/Serialization/TestResultSerializationTests.cs +++ b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/Serialization/TestResultSerializationTests.cs @@ -238,7 +238,7 @@ public void TestResultObjectShouldSerializeAttachmentsV2(int version) result.StartTime = default(DateTimeOffset); result.EndTime = default(DateTimeOffset); result.Attachments.Add(new AttachmentSet(new Uri("http://dummyUri"), "sampleAttachment")); - var expectedJson = "{\"TestCase\":{\"Id\":\"28e7a7ed-8fb9-05b7-5e90-4a8c52f32b5b\",\"ManagedType\":null,\"ManagedMethod\":null,\"FullyQualifiedName\":\"sampleTestClass.sampleTestCase\",\"DisplayName\":\"sampleTestClass.sampleTestCase\",\"ExecutorUri\":\"executor://sampleTestExecutor\",\"Source\":\"sampleTest.dll\",\"CodeFilePath\":null,\"LineNumber\":-1,\"Properties\":[]},\"Attachments\":[{\"Uri\":\"http://dummyUri\",\"DisplayName\":\"sampleAttachment\",\"Attachments\":[]}],\"Outcome\":0,\"ErrorMessage\":null,\"ErrorStackTrace\":null,\"DisplayName\":null,\"Messages\":[],\"ComputerName\":null,\"Duration\":\"00:00:00\",\"StartTime\":\"0001-01-01T00:00:00+00:00\",\"EndTime\":\"0001-01-01T00:00:00+00:00\",\"Properties\":[]}"; + var expectedJson = "{\"TestCase\":{\"Id\":\"28e7a7ed-8fb9-05b7-5e90-4a8c52f32b5b\",\"FullyQualifiedName\":\"sampleTestClass.sampleTestCase\",\"DisplayName\":\"sampleTestClass.sampleTestCase\",\"ExecutorUri\":\"executor://sampleTestExecutor\",\"Source\":\"sampleTest.dll\",\"CodeFilePath\":null,\"LineNumber\":-1,\"Properties\":[]},\"Attachments\":[{\"Uri\":\"http://dummyUri\",\"DisplayName\":\"sampleAttachment\",\"Attachments\":[]}],\"Outcome\":0,\"ErrorMessage\":null,\"ErrorStackTrace\":null,\"DisplayName\":null,\"Messages\":[],\"ComputerName\":null,\"Duration\":\"00:00:00\",\"StartTime\":\"0001-01-01T00:00:00+00:00\",\"EndTime\":\"0001-01-01T00:00:00+00:00\",\"Properties\":[]}"; var json = Serialize(result, version);