From 76f0f89086d7ef3fa2c837fa3e40a0464ac069f2 Mon Sep 17 00:00:00 2001 From: Medeni Baykal <433724+Haplois@users.noreply.github.com> Date: Tue, 24 Nov 2020 10:18:03 +0100 Subject: [PATCH] FQN work (#737) * Added support for `ManagedType` and `ManagedMethod`. Added support for `ManagedType` and `ManagedMethod` into various classes. Also centralized TestPlarform version and done some refactoring. --- .gitignore | 2 + Nuget.config | 11 ++- TestFx.sln | 1 + scripts/Build.ps1 | 88 +++++++++++-------- scripts/build/TestFx.Settings.targets | 2 +- scripts/build/TestFx.Versions.targets | 7 ++ scripts/common.lib.ps1 | 58 +++++------- scripts/test.ps1 | 35 ++++---- scripts/toolset/packages.config | 2 +- .../Discovery/TypeEnumerator.cs | 2 +- .../Execution/LogMessageListener.cs | 5 +- .../MSTest.CoreAdapter.csproj | 15 ++-- .../ObjectModel/TestMethod.cs | 28 +++++- .../ObjectModel/UnitTestElement.cs | 15 +++- src/Adapter/MSTest.CoreAdapter/app.config | 11 +++ .../MSTest.CoreAdapter/packages.config | 6 -- .../AssemblyResolver.cs | 15 +++- .../PlatformServices.Desktop.csproj | 30 ++++++- .../DesktopTestContextImplementation.cs | 52 ++++++----- .../PlatformServices.Desktop/app.config | 11 +++ .../PlatformServices.Desktop/packages.config | 11 ++- .../ObjectModel/ITestMethod.cs | 16 ++++ .../PlatformServices.Interface.csproj | 18 +++- .../PlatformServices.Interface/app.config | 11 +++ .../packages.config | 17 +++- .../PlatformServices.NetCore.csproj | 4 +- .../NetCoreTestContextImplementation.cs | 8 +- .../PlatformServices.Portable.csproj | 18 +++- .../PlatformServices.Portable/app.config | 11 +++ .../PlatformServices.Portable/packages.config | 17 +++- .../Services/ns10TestContextImplementation.cs | 8 +- .../ns10TestContextPropertyStrings.cs | 2 + .../Utilities/ns13DeploymentItemUtility.cs | 27 +++++- .../PlatformServices.Universal/project.json | 6 +- src/Package/MSTest.TestAdapter.Dotnet.nuspec | 2 +- .../Extension.Core/NetCoreTestContext.cs | 10 +++ .../Extension.Desktop/DesktopTestContext.cs | 10 +++ .../Extension.Shared/TestContext.cs | 10 +++ .../App.config | 13 ++- ...ormServices.Desktop.Component.Tests.csproj | 22 ++++- .../packages.config | 5 +- .../TestProjectForAssemblyResolution.csproj | 4 +- .../Automation.CLI/Automation.CLI.csproj | 39 ++++---- test/E2ETests/Automation.CLI/CLITestBase.cs | 8 +- test/E2ETests/Automation.CLI/app.config | 11 +++ test/E2ETests/Automation.CLI/packages.config | 11 +-- .../Smoke.E2E.Tests/DeploymentTests.cs | 42 ++++++--- .../Smoke.E2E.Tests/Smoke.E2E.Tests.csproj | 16 ++-- test/E2ETests/Smoke.E2E.Tests/TimeoutTests.cs | 5 +- test/E2ETests/Smoke.E2E.Tests/app.config | 11 +++ .../CompatTestProject.csproj | 3 +- ...{UnitTest1.cs => DeploymentTestProject.cs} | 10 +-- .../DeploymentTestProject.csproj | 29 ++++-- .../DeploymentTestProjectNetCore.csproj | 10 +-- .../TimeoutTestProjectNetCore.csproj | 7 +- .../ActionUtility.cs | 2 +- .../MSTest.CoreAdapter.Unit.Tests/App.config | 8 +- .../MSTest.CoreAdapter.Unit.Tests.csproj | 20 ++++- .../packages.config | 5 +- .../App.config | 15 +++- ...PlatformServices.Desktop.Unit.Tests.csproj | 22 ++++- .../packages.config | 5 +- ...PlatformServices.NetCore.Unit.Tests.csproj | 34 +++---- .../NetCoreTestContextImplementationTests.cs | 2 +- .../NetCoreDeploymentUtilityTests.cs | 2 +- ...latformServices.Portable.Unit.Tests.csproj | 21 ++++- .../app.config | 11 +++ .../packages.config | 5 +- .../Deployment/ns10DeploymentItemTests.cs | 2 +- .../Deployment/ns10TestRunDirectoriesTests.cs | 2 +- .../ns10ExceptionExtensionsTests.cs | 2 +- .../ns10MSTestAdapterSettingsTests.cs | 2 +- .../Utilities/ns10DeploymentUtilityTests.cs | 2 +- .../Utilities/ns10FileUtilityTests.cs | 2 +- .../ns10DiaSessionOperationsTests.cs | 2 +- .../netstandard1.0/ns10FileOperationsTests.cs | 12 ++- .../ns10ReflectionOperationsTests.cs | 2 +- .../netstandard1.0/ns10TestSourceHostTests.cs | 2 +- .../netstandard1.0/ns10TestSourceTests.cs | 2 +- .../ns10ThreadOperationsTests.cs | 2 +- .../ns13MSTestSettingsProviderTests.cs | 2 +- .../Services/ns13TestDeploymentTests.cs | 5 +- .../ns13DeploymentItemUtilityTests.cs | 2 +- .../Utilities/ns13ReflectionUtilityTests.cs | 2 +- .../ns13TraceListenerManagerTests.cs | 2 +- .../netstandard1.3/ns13TraceListenerTests.cs | 2 +- ...atformServices.Universal.Unit.Tests.csproj | 20 ++++- .../app.config | 11 +++ .../packages.config | 5 +- 89 files changed, 777 insertions(+), 308 deletions(-) create mode 100644 scripts/build/TestFx.Versions.targets create mode 100644 src/Adapter/MSTest.CoreAdapter/app.config delete mode 100644 src/Adapter/MSTest.CoreAdapter/packages.config create mode 100644 src/Adapter/PlatformServices.Desktop/app.config create mode 100644 src/Adapter/PlatformServices.Interface/app.config create mode 100644 src/Adapter/PlatformServices.Portable/app.config create mode 100644 test/E2ETests/Automation.CLI/app.config create mode 100644 test/E2ETests/Smoke.E2E.Tests/app.config rename test/E2ETests/TestAssets/DeploymentTestProject/{UnitTest1.cs => DeploymentTestProject.cs} (69%) create mode 100644 test/UnitTests/PlatformServices.Portable.Unit.Tests/app.config create mode 100644 test/UnitTests/PlatformServices.Universal.Unit.Tests/app.config diff --git a/.gitignore b/.gitignore index 1b299adc21..2688b7eb78 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ *.sln.metaproj *.sln.metaproj.tmp .vs/ +.vscode/ *.cache # Build results @@ -29,6 +30,7 @@ msbuild*.err build*.log build*.wrn build*.err +*.binlog # MSTest test Results [Tt]est[Rr]esult*/ diff --git a/Nuget.config b/Nuget.config index a9b6e552e2..29365fc08f 100644 --- a/Nuget.config +++ b/Nuget.config @@ -6,13 +6,15 @@ - - + + + + + - @@ -25,5 +27,8 @@ + + + diff --git a/TestFx.sln b/TestFx.sln index 6441825168..33d02154c5 100644 --- a/TestFx.sln +++ b/TestFx.sln @@ -142,6 +142,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "targets", "targets", "{F60B ProjectSection(SolutionItems) = preProject scripts\build\TestFx.Loc.targets = scripts\build\TestFx.Loc.targets scripts\build\TestFx.Settings.targets = scripts\build\TestFx.Settings.targets + scripts\build\TestFx.Versions.targets = scripts\build\TestFx.Versions.targets scripts\build\TestFx.targets = scripts\build\TestFx.targets EndProjectSection EndProject diff --git a/scripts/Build.ps1 b/scripts/Build.ps1 index f657cda7cb..f5a64a3ab8 100644 --- a/scripts/Build.ps1 +++ b/scripts/Build.ps1 @@ -5,61 +5,49 @@ [CmdletBinding(PositionalBinding=$false)] Param( - [Parameter(Mandatory=$false)] [ValidateSet("Debug", "Release")] [Alias("c")] - [System.String] $Configuration = "Debug", + [string] $Configuration = "Debug", - [Parameter(Mandatory=$false)] [Alias("fv")] - [System.String] $FrameworkVersion = "99.99.99", + [string] $FrameworkVersion = "99.99.99", - [Parameter(Mandatory=$false)] [Alias("av")] - [System.String] $AdapterVersion = "99.99.99", + [string] $AdapterVersion = "99.99.99", - [Parameter(Mandatory=$false)] [Alias("vs")] - [System.String] $VersionSuffix = "dev", + [string] $VersionSuffix = "dev", - [Parameter(Mandatory=$false)] - [System.String] $BuildVersionPrefix = "14.0", + [string] $BuildVersionPrefix = "14.0", - [Parameter(Mandatory=$false)] - [System.String] $BuildVersionSuffix = "9999.99", + [string] $BuildVersionSuffix = "9999.99", - [Parameter(Mandatory=$false)] - [System.String] $Target = "Build", + [string] $Target = "Build", - [Parameter(Mandatory=$false)] [Alias("h")] - [Switch] $Help = $false, + [Switch] $Help, - [Parameter(Mandatory=$false)] [Alias("cl")] - [Switch] $Clean = $false, + [Switch] $Clean, - [Parameter(Mandatory=$false)] [Alias("sr")] - [Switch] $SkipRestore = $false, + [Switch] $SkipRestore, - [Parameter(Mandatory=$false)] [Alias("cache")] - [Switch] $ClearPackageCache = $false, + [Switch] $ClearPackageCache, - [Parameter(Mandatory=$false)] - [Switch] $Official = $false, + [Switch] $Official, - [Parameter(Mandatory=$false)] - [Switch] $Full = $false, + [Switch] $Full, - [Parameter(Mandatory=$false)] [Alias("uxlf")] - [Switch] $UpdateXlf = $false, + [Switch] $UpdateXlf, - [Parameter(Mandatory=$false)] [Alias("loc")] - [Switch] $IsLocalizedBuild = $false + [Switch] $IsLocalizedBuild, + + [Alias("tpv")] + [string] $TestPlatformVersion = $null ) . $PSScriptRoot\common.lib.ps1 @@ -188,10 +176,10 @@ function Perform-Restore { Write-Verbose "Starting restore for NetCore Projects" foreach($project in $TFB_NetCoreProjects) { - $projectPath = Locate-Item -relativePath $project + $projectPath = Locate-Item -relativePath $project - Write-Verbose "$msbuild /t:restore -verbosity:minimal $projectPath" - & $msbuild /t:restore -verbosity:minimal $projectPath + Write-Verbose "$msbuild /t:restore -verbosity:minimal $projectPath /m" + & $msbuild /t:restore -verbosity:minimal $projectPath /m } if ($lastExitCode -ne 0) { @@ -240,8 +228,8 @@ function Invoke-Build([string] $solution, $hasVsixExtension = "false") $solutionFailureLog = Join-Path -path $solutionDir -childPath "msbuild.err" Write-Log " Building $solution..." - Write-Verbose "$msbuild /t:$Target /p:Configuration=$configuration /v:m /flp1:Summary`;Verbosity=diagnostic`;Encoding=UTF-8`;LogFile=$solutionSummaryLog /flp2:WarningsOnly`;Verbosity=diagnostic`;Encoding=UTF-8`;LogFile=$solutionWarningLog /flp3:ErrorsOnly`;Verbosity=diagnostic`;Encoding=UTF-8`;LogFile=$solutionFailureLog /p:IsLocalizedBuild=$TFB_IsLocalizedBuild /p:UpdateXlf=$TFB_UpdateXlf /p:BuildVersion=$TFB_BuildVersion $solutionPath" - & $msbuild /t:$Target /p:Configuration=$configuration /v:m /flp1:Summary`;Verbosity=diagnostic`;Encoding=UTF-8`;LogFile=$solutionSummaryLog /flp2:WarningsOnly`;Verbosity=diagnostic`;Encoding=UTF-8`;LogFile=$solutionWarningLog /flp3:ErrorsOnly`;Verbosity=diagnostic`;Encoding=UTF-8`;LogFile=$solutionFailureLog /p:IsLocalizedBuild=$TFB_IsLocalizedBuild /p:UpdateXlf=$TFB_UpdateXlf /p:BuildVersion=$TFB_BuildVersion $solutionPath + Write-Verbose "$msbuild /t:$Target /p:Configuration=$configuration /v:m /flp1:Summary`;Verbosity=diagnostic`;Encoding=UTF-8`;LogFile=$solutionSummaryLog /flp2:WarningsOnly`;Verbosity=diagnostic`;Encoding=UTF-8`;LogFile=$solutionWarningLog /flp3:ErrorsOnly`;Verbosity=diagnostic`;Encoding=UTF-8`;LogFile=$solutionFailureLog /p:IsLocalizedBuild=$TFB_IsLocalizedBuild /p:UpdateXlf=$TFB_UpdateXlf /p:BuildVersion=$TFB_BuildVersion $solutionPath /bl /m" + & $msbuild /t:$Target /p:Configuration=$configuration /v:m /flp1:Summary`;Verbosity=diagnostic`;Encoding=UTF-8`;LogFile=$solutionSummaryLog /flp2:WarningsOnly`;Verbosity=diagnostic`;Encoding=UTF-8`;LogFile=$solutionWarningLog /flp3:ErrorsOnly`;Verbosity=diagnostic`;Encoding=UTF-8`;LogFile=$solutionFailureLog /p:IsLocalizedBuild=$TFB_IsLocalizedBuild /p:UpdateXlf=$TFB_UpdateXlf /p:BuildVersion=$TFB_BuildVersion $solutionPath /bl /m if ($lastExitCode -ne 0) { throw "Build failed with an exit code of '$lastExitCode'." @@ -307,7 +295,37 @@ function Create-NugetPackages Write-Log "Create-NugetPackages: Complete. {$(Get-ElapsedTime($timer))}" } +function Replace-InFile($File, $RegEx, $ReplaceWith) { + $content = Get-Content -Raw -Encoding utf8 $File + $newContent = ($content -replace $RegEx,$ReplaceWith) + if(-not $content.Equals($newContent)) { + Write-Log "Updating TestPlatform version in $File" + $newContent | Set-Content -Encoding utf8 $File -NoNewline + } +} + +function Sync-PackageVersions { + $versionsFile = "$PSScriptRoot\build\TestFx.Versions.targets" + + $versionsRegex = '(?mi)<(TestPlatformVersion.*?)>(.*?)<\/TestPlatformVersion>' + $packageRegex = '(?mi)$TestPlatformVersion" + } + + (Get-ChildItem "$PSScriptRoot\..\src\*packages.config","$PSScriptRoot\..\test\*packages.config" -Recurse) | ForEach-Object { + Replace-InFile -File $_ -RegEx $packageRegex -ReplaceWith (' + - 11.0 Debug AnyCPU en-US diff --git a/scripts/build/TestFx.Versions.targets b/scripts/build/TestFx.Versions.targets new file mode 100644 index 0000000000..7a7cf40eb3 --- /dev/null +++ b/scripts/build/TestFx.Versions.targets @@ -0,0 +1,7 @@ + + + + 16.9.0-preview-20201123-04 + 11.0 + + \ No newline at end of file diff --git a/scripts/common.lib.ps1 b/scripts/common.lib.ps1 index 4afb5e8a21..0e68a493ce 100644 --- a/scripts/common.lib.ps1 +++ b/scripts/common.lib.ps1 @@ -122,34 +122,29 @@ function Locate-VsWhere { return $vswhere } -function Locate-VsInstallPath($hasVsixExtension ="false"){ +function Locate-VsInstallPath($hasVsixExtension = "false") { $vswhere = Locate-VsWhere $requiredPackageIds = @() $requiredPackageIds += "Microsoft.Component.MSBuild" - $requiredPackageIds += "Microsoft.Net.Component.4.6.TargetingPack" + $requiredPackageIds += "Microsoft.Net.Component.4.5.2.TargetingPack" $requiredPackageIds += "Microsoft.VisualStudio.Windows.Build" - if($hasVsixExtension -eq 'true') - { + if ($hasVsixExtension -eq 'true') { $requiredPackageIds += "Microsoft.VisualStudio.Component.VSSDK" } Write-Verbose "$vswhere -latest -products * -requires $requiredPackageIds -property installationPath" - try - { - if ($Official) - { - $vsInstallPath = & $vswhere -latest -products * -requires $requiredPackageIds -property installationPath - } - else - { - # Allow using pre release versions of VS for dev builds - $vsInstallPath = & $vswhere -latest -prerelease -products * -requires $requiredPackageIds -property installationPath - } + try { + if ($Official) { + $vsInstallPath = & $vswhere -latest -products * -requires $requiredPackageIds -property installationPath + } + else { + # Allow using pre release versions of VS for dev builds + $vsInstallPath = & $vswhere -latest -prerelease -products * -requires $requiredPackageIds -property installationPath + } } - catch [System.Management.Automation.MethodInvocationException] - { + catch [System.Management.Automation.MethodInvocationException] { Write-Error "Failed to find VS installation with requirements : $requiredPackageIds." } @@ -157,31 +152,26 @@ function Locate-VsInstallPath($hasVsixExtension ="false"){ return Resolve-Path -path $vsInstallPath } - function Locate-Item([string] $relativePath) { $rootPath = $env:TF_ROOT_DIR $itemPath = Join-Path -path $rootPath -childPath $relativePath return Resolve-Path -path $itemPath } -function Start-Timer -{ - return [System.Diagnostics.Stopwatch]::StartNew() +function Start-Timer { + return [System.Diagnostics.Stopwatch]::StartNew() } -function Get-ElapsedTime([System.Diagnostics.Stopwatch] $timer) -{ - $timer.Stop() - return $timer.Elapsed +function Get-ElapsedTime([System.Diagnostics.Stopwatch] $timer) { + $timer.Stop() + return $timer.Elapsed } -function Write-Log ([string] $message, $messageColor = "Green") -{ - $currentColor = $Host.UI.RawUI.ForegroundColor - $Host.UI.RawUI.ForegroundColor = $messageColor - if ($message) - { - Write-Output "... $message" - } - $Host.UI.RawUI.ForegroundColor = $currentColor +function Write-Log ([string] $message, $messageColor = "Green") { + $currentColor = $Host.UI.RawUI.ForegroundColor + $Host.UI.RawUI.ForegroundColor = $messageColor + if ($message) { + Write-Output "... $message" + } + $Host.UI.RawUI.ForegroundColor = $currentColor } diff --git a/scripts/test.ps1 b/scripts/test.ps1 index 1fbaccee9b..5892c3031c 100644 --- a/scripts/test.ps1 +++ b/scripts/test.ps1 @@ -49,8 +49,7 @@ $TFT_Configuration = $Configuration $TFT_Pattern = $Pattern $TFT_Parallel = $Parallel $TFT_All = $All -$TestFramework = ".NETCoreApp,Version=v1.0" -$VSTestConsoleRelativePath = "Microsoft.TestPlatform.15.0.1\tools\net46\vstest.console.exe" +$TestFramework = ".NETCoreApp,Version=v2.1" # # Prints help text for the switches this script supports. @@ -148,28 +147,28 @@ function Run-Test([string[]] $testContainers, [string[]] $netCoreTestContainers) $additionalArguments += "/parallel" } - if($testContainers.Count -gt 0) - { - if(!(Test-Path $vstestPath)) - { - Write-Error "Unable to find vstest.console.exe at $vstestPath. Test aborted." - } + if($testContainers.Count -gt 0) + { + if(!(Test-Path $vstestPath)) + { + Write-Error "Unable to find vstest.console.exe at $vstestPath. Test aborted." + } - Write-Verbose "$vstestPath $testContainers $additionalArguments /logger:trx" - & $vstestPath $testContainers $additionalArguments /logger:trx - - if ($lastExitCode -ne 0) - { - throw "Tests failed." - } - } + Write-Verbose "$vstestPath $testContainers $additionalArguments /logger:trx" + & $vstestPath $testContainers $additionalArguments /logger:trx + + if ($lastExitCode -ne 0) + { + throw "Tests failed." + } + } if($netCoreTestContainers.Count -gt 0) { Try { - Write-Verbose "dotnet vstest $netCoreTestContainers /framework:$TestFramework $additionalArguments /logger:trx" - & dotnet vstest $netCoreTestContainers /framework:$TestFramework $additionalArguments /logger:trx + Write-Verbose "dotnet test $netCoreTestContainers /framework:$TestFramework $additionalArguments /logger:trx" + & dotnet test $netCoreTestContainers /framework:$TestFramework $additionalArguments /logger:trx } Catch [System.Management.Automation.CommandNotFoundException] diff --git a/scripts/toolset/packages.config b/scripts/toolset/packages.config index fb85da1e92..80eecf6fa2 100644 --- a/scripts/toolset/packages.config +++ b/scripts/toolset/packages.config @@ -1,7 +1,7 @@  - + diff --git a/src/Adapter/MSTest.CoreAdapter/Discovery/TypeEnumerator.cs b/src/Adapter/MSTest.CoreAdapter/Discovery/TypeEnumerator.cs index 11e6e30f83..3a5e9c61dd 100644 --- a/src/Adapter/MSTest.CoreAdapter/Discovery/TypeEnumerator.cs +++ b/src/Adapter/MSTest.CoreAdapter/Discovery/TypeEnumerator.cs @@ -132,7 +132,7 @@ internal UnitTestElement GetTestFromMethod(MethodInfo method, bool isDeclaredInT // This allows void returning async test method to be valid test method. Though they will be executed similar to non-async test method. var isAsync = ReflectHelper.MatchReturnType(method, typeof(Task)); - var testMethod = new TestMethod(method.Name, this.type.FullName, this.assemblyName, isAsync); + var testMethod = new TestMethod(method, method.Name, this.type.FullName, this.assemblyName, isAsync); if (!method.DeclaringType.FullName.Equals(this.type.FullName)) { diff --git a/src/Adapter/MSTest.CoreAdapter/Execution/LogMessageListener.cs b/src/Adapter/MSTest.CoreAdapter/Execution/LogMessageListener.cs index cca0500513..fa1f36ae15 100644 --- a/src/Adapter/MSTest.CoreAdapter/Execution/LogMessageListener.cs +++ b/src/Adapter/MSTest.CoreAdapter/Execution/LogMessageListener.cs @@ -114,7 +114,10 @@ private void Dispose(bool disposing) { try { - this.traceListenerManager.Remove(this.traceListener); + if (this.traceListener != null) + { + this.traceListenerManager.Remove(this.traceListener); + } // Restore the previous LogMessageListener's TraceListener (if there was one) if (this.previousRedirector != null && this.previousRedirector.traceListener != null) diff --git a/src/Adapter/MSTest.CoreAdapter/MSTest.CoreAdapter.csproj b/src/Adapter/MSTest.CoreAdapter/MSTest.CoreAdapter.csproj index 33567b9e2f..7fb134cd0e 100644 --- a/src/Adapter/MSTest.CoreAdapter/MSTest.CoreAdapter.csproj +++ b/src/Adapter/MSTest.CoreAdapter/MSTest.CoreAdapter.csproj @@ -110,13 +110,9 @@ - + - - ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.11.0.0\lib\portable-net45+win8+wpa81+wp8\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll - False - C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\System.Collections.Concurrent.dll @@ -128,6 +124,15 @@ Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + + + runtime; build; native; contentfiles; analyzers; buildtransitive + + $(ProjectDir)..\Build diff --git a/src/Adapter/MSTest.CoreAdapter/ObjectModel/TestMethod.cs b/src/Adapter/MSTest.CoreAdapter/ObjectModel/TestMethod.cs index 2af0ef2b98..e6cd73b54f 100644 --- a/src/Adapter/MSTest.CoreAdapter/ObjectModel/TestMethod.cs +++ b/src/Adapter/MSTest.CoreAdapter/ObjectModel/TestMethod.cs @@ -5,6 +5,9 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.ObjectModel { using System; using System.Diagnostics; + using System.Reflection; + + using Microsoft.VisualStudio.TestPlatform.ObjectModel.ManagedNameUtilities; using MSTestAdapter.PlatformServices.Interface.ObjectModel; @@ -28,7 +31,7 @@ public sealed class TestMethod : ITestMethod #endregion - public TestMethod(string name, string fullClassName, string assemblyName, bool isAsync) + public TestMethod(string name, string fullClassName, string assemblyName, bool isAsync) { if (string.IsNullOrEmpty(assemblyName)) { @@ -44,6 +47,20 @@ public TestMethod(string name, string fullClassName, string assemblyName, bool this.IsAsync = isAsync; } + public TestMethod(MethodBase method, string name, string fullClassName, string assemblyName, bool isAsync) + : this(name, fullClassName, assemblyName, isAsync) + { + if (method == null) + { + throw new ArgumentNullException(nameof(method)); + } + + ManagedNameHelper.GetManagedName(method, out var managedType, out var managedMethod); + + this.ManagedType = managedType; + this.ManagedMethod = managedMethod; + } + /// /// Gets the name of the test method /// @@ -102,5 +119,14 @@ public string DeclaringClassFullName /// Gets a value indicating whether specifies test method is async /// public bool IsAsync { get; private set; } + + public string ManagedType { get; } + + public string ManagedMethod { get; } + + /// + /// Gets a value indicating whether both and are not null or whitespace. + /// + public bool HasManagedMethodAndType => !string.IsNullOrWhiteSpace(this.ManagedType) && !string.IsNullOrWhiteSpace(this.ManagedMethod); } } diff --git a/src/Adapter/MSTest.CoreAdapter/ObjectModel/UnitTestElement.cs b/src/Adapter/MSTest.CoreAdapter/ObjectModel/UnitTestElement.cs index b39abe7763..fc0a104424 100644 --- a/src/Adapter/MSTest.CoreAdapter/ObjectModel/UnitTestElement.cs +++ b/src/Adapter/MSTest.CoreAdapter/ObjectModel/UnitTestElement.cs @@ -114,10 +114,21 @@ internal TestCase ToTestCase() this.TestMethod.FullClassName, this.TestMethod.Name); - TestCase testCase = new TestCase(fullName, TestAdapter.Constants.ExecutorUri, this.TestMethod.AssemblyName); - testCase.DisplayName = string.IsNullOrEmpty(this.DisplayName) ? this.TestMethod.Name : this.DisplayName; + TestCase testCase; + if (this.TestMethod.HasManagedMethodAndType) + { + testCase = new TestCase(fullName, this.TestMethod.ManagedType, this.TestMethod.ManagedMethod, TestAdapter.Constants.ExecutorUri, this.TestMethod.AssemblyName); + } + else + { + testCase = new TestCase(fullName, TestAdapter.Constants.ExecutorUri, this.TestMethod.AssemblyName); + } + + testCase.DisplayName = string.IsNullOrEmpty(this.DisplayName) ? this.TestMethod.Name : this.DisplayName; testCase.SetPropertyValue(TestAdapter.Constants.TestClassNameProperty, this.TestMethod.FullClassName); + testCase.SetPropertyValue(TestCaseProperties.ManagedType, this.TestMethod.ManagedType); + testCase.SetPropertyValue(TestCaseProperties.ManagedMethod, this.TestMethod.ManagedMethod); // Set declaring type if present so the correct method info can be retrieved if (this.TestMethod.DeclaringClassFullName != null) diff --git a/src/Adapter/MSTest.CoreAdapter/app.config b/src/Adapter/MSTest.CoreAdapter/app.config new file mode 100644 index 0000000000..33d949fb5d --- /dev/null +++ b/src/Adapter/MSTest.CoreAdapter/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/Adapter/MSTest.CoreAdapter/packages.config b/src/Adapter/MSTest.CoreAdapter/packages.config deleted file mode 100644 index 1703f0c32f..0000000000 --- a/src/Adapter/MSTest.CoreAdapter/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/Adapter/PlatformServices.Desktop/AssemblyResolver.cs b/src/Adapter/PlatformServices.Desktop/AssemblyResolver.cs index 26b489c009..96c6262c50 100644 --- a/src/Adapter/PlatformServices.Desktop/AssemblyResolver.cs +++ b/src/Adapter/PlatformServices.Desktop/AssemblyResolver.cs @@ -12,6 +12,7 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices using System.Runtime.InteropServices.WindowsRuntime; using System.Security; using System.Security.Permissions; + using Microsoft.VisualStudio.TestPlatform.ObjectModel; /// @@ -28,7 +29,16 @@ public class AssemblyResolver : MarshalByRefObject, IDisposable /// The reason we have this is because the AssemblyResolver itself logs information during resolution. /// If the resolver is called for the assembly containing the logger APIs, we do not log so as to prevent a stack overflow. /// - private const string LoggerAssemblyName = "Microsoft.VisualStudio.TestPlatform.ObjectModel"; + private const string LoggerAssemblyNameLegacy = "Microsoft.VisualStudio.TestPlatform.ObjectModel"; + + /// + /// The assembly name of the dll containing logger APIs(EqtTrace) from the TestPlatform. + /// + /// + /// The reason we have this is because the AssemblyResolver itself logs information during resolution. + /// If the resolver is called for the assembly containing the logger APIs, we do not log so as to prevent a stack overflow. + /// + private const string LoggerAssemblyName = "Microsoft.TestPlatform.CoreUtilities"; /// /// This will have the list of all directories read from runsettings. @@ -577,7 +587,8 @@ private bool TryLoadFromCache(string assemblyName, bool isReflectionOnly, out As /// The logger function. private void SafeLog(string assemblyName, Action loggerAction) { - if (!string.IsNullOrEmpty(assemblyName) && !assemblyName.StartsWith(LoggerAssemblyName)) + // Logger assembly was in `Microsoft.VisualStudio.TestPlatform.ObjectModel` assembly in legacy versions and we need to omit it as well. + if (!string.IsNullOrEmpty(assemblyName) && !assemblyName.StartsWith(LoggerAssemblyName) && !assemblyName.StartsWith(LoggerAssemblyNameLegacy)) { loggerAction.Invoke(); } diff --git a/src/Adapter/PlatformServices.Desktop/PlatformServices.Desktop.csproj b/src/Adapter/PlatformServices.Desktop/PlatformServices.Desktop.csproj index a1a9891c44..0c04867a71 100644 --- a/src/Adapter/PlatformServices.Desktop/PlatformServices.Desktop.csproj +++ b/src/Adapter/PlatformServices.Desktop/PlatformServices.Desktop.csproj @@ -30,20 +30,41 @@ true - - ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.11.0.0\lib\net35\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll - True + + ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatformVersion)\lib\net45\Microsoft.TestPlatform.CoreUtilities.dll + + + ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatformVersion)\lib\net45\Microsoft.TestPlatform.PlatformAbstractions.dll + + + ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatformVersion)\lib\net45\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll + + + ..\..\..\packages\NuGet.Frameworks.5.0.0\lib\net40\NuGet.Frameworks.dll + + ..\..\..\packages\System.Collections.Immutable.1.5.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll + + + + ..\..\..\packages\System.ComponentModel.Primitives.4.3.0\lib\net45\System.ComponentModel.Primitives.dll + + + ..\..\..\packages\System.ComponentModel.TypeConverter.4.3.0\lib\net45\System.ComponentModel.TypeConverter.dll + + + ..\..\..\packages\System.Reflection.Metadata.1.6.0\lib\portable-net45+win8\System.Reflection.Metadata.dll + + - @@ -143,6 +164,7 @@ + diff --git a/src/Adapter/PlatformServices.Desktop/Services/DesktopTestContextImplementation.cs b/src/Adapter/PlatformServices.Desktop/Services/DesktopTestContextImplementation.cs index 8b36dae876..30fe477db1 100644 --- a/src/Adapter/PlatformServices.Desktop/Services/DesktopTestContextImplementation.cs +++ b/src/Adapter/PlatformServices.Desktop/Services/DesktopTestContextImplementation.cs @@ -14,8 +14,10 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices using System.IO; using System.Linq; using System.Threading; + using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface; using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.ObjectModel; + using UTF = Microsoft.VisualStudio.TestTools.UnitTesting; /// @@ -208,6 +210,24 @@ public override string FullyQualifiedTestClassName } } + /// + public override string ManagedType + { + get + { + return this.GetStringPropertyValue(TestContextPropertyStrings.ManagedType); + } + } + + /// + public override string ManagedMethod + { + get + { + return this.GetStringPropertyValue(TestContextPropertyStrings.ManagedMethod); + } + } + /// public override string TestName { @@ -450,40 +470,16 @@ private static UTF.UnitTestOutcome ToUTF(UTF.UnitTestOutcome outcome) switch (outcome) { case UTF.UnitTestOutcome.Error: - { - return UTF.UnitTestOutcome.Error; - } - case UTF.UnitTestOutcome.Failed: - { - return UTF.UnitTestOutcome.Failed; - } - case UTF.UnitTestOutcome.Inconclusive: - { - return UTF.UnitTestOutcome.Inconclusive; - } - case UTF.UnitTestOutcome.Passed: - { - return UTF.UnitTestOutcome.Passed; - } - case UTF.UnitTestOutcome.Timeout: - { - return UTF.UnitTestOutcome.Timeout; - } - case UTF.UnitTestOutcome.InProgress: - { - return UTF.UnitTestOutcome.InProgress; - } + return outcome; default: - { - Debug.Fail("Unknown outcome " + outcome); - return UTF.UnitTestOutcome.Unknown; - } + Debug.Fail("Unknown outcome " + outcome); + return UTF.UnitTestOutcome.Unknown; } } @@ -505,6 +501,8 @@ private string GetStringPropertyValue(string propertyName) private void InitializeProperties() { this.properties[TestContextPropertyStrings.FullyQualifiedTestClassName] = this.testMethod.FullClassName; + this.properties[TestContextPropertyStrings.ManagedType] = this.testMethod.ManagedType; + this.properties[TestContextPropertyStrings.ManagedMethod] = this.testMethod.ManagedMethod; this.properties[TestContextPropertyStrings.TestName] = this.testMethod.Name; } } diff --git a/src/Adapter/PlatformServices.Desktop/app.config b/src/Adapter/PlatformServices.Desktop/app.config new file mode 100644 index 0000000000..33d949fb5d --- /dev/null +++ b/src/Adapter/PlatformServices.Desktop/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/Adapter/PlatformServices.Desktop/packages.config b/src/Adapter/PlatformServices.Desktop/packages.config index f6c0e00afb..45aa76f5b2 100644 --- a/src/Adapter/PlatformServices.Desktop/packages.config +++ b/src/Adapter/PlatformServices.Desktop/packages.config @@ -1,6 +1,15 @@  - + + + + + + + + + + \ No newline at end of file diff --git a/src/Adapter/PlatformServices.Interface/ObjectModel/ITestMethod.cs b/src/Adapter/PlatformServices.Interface/ObjectModel/ITestMethod.cs index 5d3abe84dd..7a270973f7 100644 --- a/src/Adapter/PlatformServices.Interface/ObjectModel/ITestMethod.cs +++ b/src/Adapter/PlatformServices.Interface/ObjectModel/ITestMethod.cs @@ -33,5 +33,21 @@ public interface ITestMethod /// Gets a value indicating whether test method is async /// bool IsAsync { get; } + + /// + /// Gets the fully specified type name metadata format. + /// + /// + /// NamespaceA.NamespaceB.ClassName`1+InnerClass`2 + /// + string ManagedType { get; } + + /// + /// Gets the fully specified method name metadata format. + /// + /// + /// MethodName`2(ParamTypeA,ParamTypeB,…) + /// + string ManagedMethod { get; } } } diff --git a/src/Adapter/PlatformServices.Interface/PlatformServices.Interface.csproj b/src/Adapter/PlatformServices.Interface/PlatformServices.Interface.csproj index 7c9c3c153c..b7a861970b 100644 --- a/src/Adapter/PlatformServices.Interface/PlatformServices.Interface.csproj +++ b/src/Adapter/PlatformServices.Interface/PlatformServices.Interface.csproj @@ -47,6 +47,7 @@ + @@ -62,9 +63,20 @@ - - ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.11.0.0\lib\portable-net45+win8+wpa81+wp8\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll - True + + ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatformVersion)\lib\netstandard1.0\Microsoft.TestPlatform.CoreUtilities.dll + + + ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatformVersion)\lib\netstandard1.0\Microsoft.TestPlatform.PlatformAbstractions.dll + + + ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatformVersion)\lib\netstandard1.0\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll + + + ..\..\..\packages\System.ComponentModel.Primitives.4.3.0\lib\netstandard1.0\System.ComponentModel.Primitives.dll + + + ..\..\..\packages\System.ComponentModel.TypeConverter.4.3.0\lib\netstandard1.0\System.ComponentModel.TypeConverter.dll diff --git a/src/Adapter/PlatformServices.Interface/app.config b/src/Adapter/PlatformServices.Interface/app.config new file mode 100644 index 0000000000..33d949fb5d --- /dev/null +++ b/src/Adapter/PlatformServices.Interface/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/Adapter/PlatformServices.Interface/packages.config b/src/Adapter/PlatformServices.Interface/packages.config index 1703f0c32f..91a17d3603 100644 --- a/src/Adapter/PlatformServices.Interface/packages.config +++ b/src/Adapter/PlatformServices.Interface/packages.config @@ -1,6 +1,21 @@  - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Adapter/PlatformServices.NetCore/PlatformServices.NetCore.csproj b/src/Adapter/PlatformServices.NetCore/PlatformServices.NetCore.csproj index 04d7d17955..fe1ba4baa9 100644 --- a/src/Adapter/PlatformServices.NetCore/PlatformServices.NetCore.csproj +++ b/src/Adapter/PlatformServices.NetCore/PlatformServices.NetCore.csproj @@ -66,11 +66,13 @@ - + + + diff --git a/src/Adapter/PlatformServices.NetCore/Services/NetCoreTestContextImplementation.cs b/src/Adapter/PlatformServices.NetCore/Services/NetCoreTestContextImplementation.cs index 40595a6bee..0f69e66124 100644 --- a/src/Adapter/PlatformServices.NetCore/Services/NetCoreTestContextImplementation.cs +++ b/src/Adapter/PlatformServices.NetCore/Services/NetCoreTestContextImplementation.cs @@ -26,8 +26,10 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices /// public class TestContextImplementation : UTF.TestContext, ITestContext { - private static readonly string FullyQualifiedTestClassNameLabel = "FullyQualifiedTestClassName"; - private static readonly string TestNameLabel = "TestName"; + private static readonly string FullyQualifiedTestClassNameLabel = nameof(FullyQualifiedTestClassName); + private static readonly string ManagedTypeLabel = nameof(ManagedType); + private static readonly string ManagedMethodLabel = nameof(ManagedMethod); + private static readonly string TestNameLabel = nameof(TestName); /// /// List of result files associated with the test @@ -444,6 +446,8 @@ private string GetStringPropertyValue(string propertyName) private void InitializeProperties() { this.properties[FullyQualifiedTestClassNameLabel] = this.testMethod.FullClassName; + this.properties[ManagedTypeLabel] = this.testMethod.ManagedType; + this.properties[ManagedMethodLabel] = this.testMethod.ManagedMethod; this.properties[TestNameLabel] = this.testMethod.Name; } } diff --git a/src/Adapter/PlatformServices.Portable/PlatformServices.Portable.csproj b/src/Adapter/PlatformServices.Portable/PlatformServices.Portable.csproj index 9e1e3c98f7..103ddb3173 100644 --- a/src/Adapter/PlatformServices.Portable/PlatformServices.Portable.csproj +++ b/src/Adapter/PlatformServices.Portable/PlatformServices.Portable.csproj @@ -100,12 +100,24 @@ + - - $(TestFxRoot)packages\Microsoft.TestPlatform.ObjectModel.11.0.0\lib\portable-net45+win8+wpa81+wp8\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll - False + + ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatformVersion)\lib\netstandard1.0\Microsoft.TestPlatform.CoreUtilities.dll + + + ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatformVersion)\lib\netstandard1.0\Microsoft.TestPlatform.PlatformAbstractions.dll + + + ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatformVersion)\lib\netstandard1.0\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll + + + ..\..\..\packages\System.ComponentModel.Primitives.4.3.0\lib\netstandard1.0\System.ComponentModel.Primitives.dll + + + ..\..\..\packages\System.ComponentModel.TypeConverter.4.3.0\lib\netstandard1.0\System.ComponentModel.TypeConverter.dll diff --git a/src/Adapter/PlatformServices.Portable/app.config b/src/Adapter/PlatformServices.Portable/app.config new file mode 100644 index 0000000000..33d949fb5d --- /dev/null +++ b/src/Adapter/PlatformServices.Portable/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/Adapter/PlatformServices.Portable/packages.config b/src/Adapter/PlatformServices.Portable/packages.config index 1703f0c32f..91a17d3603 100644 --- a/src/Adapter/PlatformServices.Portable/packages.config +++ b/src/Adapter/PlatformServices.Portable/packages.config @@ -1,6 +1,21 @@  - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestContextImplementation.cs b/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestContextImplementation.cs index acdc11a496..ebae8a2e0f 100644 --- a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestContextImplementation.cs +++ b/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestContextImplementation.cs @@ -26,8 +26,10 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices /// public class TestContextImplementation : UTF.TestContext, ITestContext { - private static readonly string FullyQualifiedTestClassNameLabel = "FullyQualifiedTestClassName"; - private static readonly string TestNameLabel = "TestName"; + private static readonly string FullyQualifiedTestClassNameLabel = nameof(FullyQualifiedTestClassName); + private static readonly string ManagedTypeLabel = nameof(ManagedType); + private static readonly string ManagedMethodLabel = nameof(ManagedMethod); + private static readonly string TestNameLabel = nameof(TestName); /// /// Properties @@ -339,6 +341,8 @@ private object GetPropertyValue(string propertyName) private void InitializeProperties() { this.properties[FullyQualifiedTestClassNameLabel] = this.testMethod.FullClassName; + this.properties[ManagedTypeLabel] = this.testMethod.ManagedType; + this.properties[ManagedMethodLabel] = this.testMethod.ManagedMethod; this.properties[TestNameLabel] = this.testMethod.Name; } } diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestContextPropertyStrings.cs b/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestContextPropertyStrings.cs index 1a17f1759a..456641657c 100644 --- a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestContextPropertyStrings.cs +++ b/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestContextPropertyStrings.cs @@ -18,6 +18,8 @@ internal static class TestContextPropertyStrings public static readonly string TestLogsDir = "TestLogsDir"; public static readonly string FullyQualifiedTestClassName = "FullyQualifiedTestClassName"; + public static readonly string ManagedType = "ManagedType"; + public static readonly string ManagedMethod = "ManagedMethod"; public static readonly string TestName = "TestName"; } } diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.3/Utilities/ns13DeploymentItemUtility.cs b/src/Adapter/PlatformServices.Shared/netstandard1.3/Utilities/ns13DeploymentItemUtility.cs index ad06769007..ce37f29a42 100644 --- a/src/Adapter/PlatformServices.Shared/netstandard1.3/Utilities/ns13DeploymentItemUtility.cs +++ b/src/Adapter/PlatformServices.Shared/netstandard1.3/Utilities/ns13DeploymentItemUtility.cs @@ -91,8 +91,7 @@ internal bool IsValidDeploymentItem(string sourcePath, string relativeOutputDire return false; } - if (sourcePath.IndexOfAny(Path.GetInvalidPathChars()) != -1 || - relativeOutputDirectory.IndexOfAny(Path.GetInvalidPathChars()) != -1) + if (this.IsInvalidPath(sourcePath) || this.IsInvalidPath(relativeOutputDirectory)) { warning = string.Format(CultureInfo.CurrentCulture, Resource.DeploymentItemContainsInvalidCharacters, sourcePath, relativeOutputDirectory); return false; @@ -152,6 +151,30 @@ internal void AddDeploymentItem(IList deploymentItemList, Deploy } } + private bool IsInvalidPath(string path) + { + if (path.IndexOfAny(Path.GetInvalidPathChars()) != -1) + { + return true; + } + + try + { + var fileName = Path.GetFileName(path); + + if (fileName.IndexOfAny(Path.GetInvalidFileNameChars()) != -1) + { + return true; + } + } + catch + { + return true; + } + + return false; + } + private IList GetDeploymentItems(object[] deploymentItemAttributes, ICollection warnings) { var deploymentItems = new List(); diff --git a/src/Adapter/PlatformServices.Universal/project.json b/src/Adapter/PlatformServices.Universal/project.json index 3b2a0c90df..2fbf5e1835 100644 --- a/src/Adapter/PlatformServices.Universal/project.json +++ b/src/Adapter/PlatformServices.Universal/project.json @@ -1,12 +1,12 @@ { "dependencies": { "MicroBuild.Core": "0.2.0", - "Microsoft.Internal.TestPlatform.ObjectModel": "14.0.0", - "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0", + "Microsoft.NETCore.UniversalWindowsPlatform": "5.3.0", + "Microsoft.TestPlatform.ObjectModel": "16.9.0-preview-20201021-10", "StyleCop.Analyzers": "1.0.0" }, "frameworks": { - "uap10.0": {} + "uap10.0.10240": {} }, "runtimes": { "win10-arm": {}, diff --git a/src/Package/MSTest.TestAdapter.Dotnet.nuspec b/src/Package/MSTest.TestAdapter.Dotnet.nuspec index 4acad8dd4b..5754ebc06d 100644 --- a/src/Package/MSTest.TestAdapter.Dotnet.nuspec +++ b/src/Package/MSTest.TestAdapter.Dotnet.nuspec @@ -23,7 +23,7 @@ - + diff --git a/src/TestFramework/Extension.Core/NetCoreTestContext.cs b/src/TestFramework/Extension.Core/NetCoreTestContext.cs index 140116e780..2ef0757f87 100644 --- a/src/TestFramework/Extension.Core/NetCoreTestContext.cs +++ b/src/TestFramework/Extension.Core/NetCoreTestContext.cs @@ -87,6 +87,16 @@ public abstract class TestContext /// public virtual string FullyQualifiedTestClassName => this.GetProperty("FullyQualifiedTestClassName"); + /// + /// Gets the fully specified type name metadata format. + /// + public virtual string ManagedType => this.GetProperty(nameof(this.ManagedType)); + + /// + /// Gets the fully specified method name metadata format. + /// + public virtual string ManagedMethod => this.GetProperty(nameof(this.ManagedMethod)); + /// /// Gets the name of the test method currently being executed /// diff --git a/src/TestFramework/Extension.Desktop/DesktopTestContext.cs b/src/TestFramework/Extension.Desktop/DesktopTestContext.cs index 9e7a4d9299..a7781f8aa8 100644 --- a/src/TestFramework/Extension.Desktop/DesktopTestContext.cs +++ b/src/TestFramework/Extension.Desktop/DesktopTestContext.cs @@ -100,6 +100,16 @@ public abstract class TestContext /// public virtual string FullyQualifiedTestClassName => this.GetProperty("FullyQualifiedTestClassName"); + /// + /// Gets the fully specified type name metadata format. + /// + public virtual string ManagedType => this.GetProperty(nameof(this.ManagedType)); + + /// + /// Gets the fully specified method name metadata format. + /// + public virtual string ManagedMethod => this.GetProperty(nameof(this.ManagedMethod)); + /// /// Gets the name of the test method currently being executed /// diff --git a/src/TestFramework/Extension.Shared/TestContext.cs b/src/TestFramework/Extension.Shared/TestContext.cs index b8f5a7089a..1db99d2f27 100644 --- a/src/TestFramework/Extension.Shared/TestContext.cs +++ b/src/TestFramework/Extension.Shared/TestContext.cs @@ -37,6 +37,16 @@ public abstract class TestContext /// public virtual string FullyQualifiedTestClassName => this.GetProperty("FullyQualifiedTestClassName"); + /// + /// Gets the fully specified type name metadata format. + /// + public virtual string ManagedType => this.GetProperty(nameof(this.ManagedType)); + + /// + /// Gets the fully specified method name metadata format. + /// + public virtual string ManagedMethod => this.GetProperty(nameof(this.ManagedMethod)); + /// /// Gets the Name of the test method currently being executed /// diff --git a/test/ComponentTests/PlatformServices.Desktop.Component.Tests/App.config b/test/ComponentTests/PlatformServices.Desktop.Component.Tests/App.config index 2d1bdf9d41..046966f135 100644 --- a/test/ComponentTests/PlatformServices.Desktop.Component.Tests/App.config +++ b/test/ComponentTests/PlatformServices.Desktop.Component.Tests/App.config @@ -1,11 +1,18 @@ - + - - + + + + + + + + + \ No newline at end of file diff --git a/test/ComponentTests/PlatformServices.Desktop.Component.Tests/PlatformServices.Desktop.Component.Tests.csproj b/test/ComponentTests/PlatformServices.Desktop.Component.Tests/PlatformServices.Desktop.Component.Tests.csproj index 9a3f8b42cc..05dbabd7e8 100644 --- a/test/ComponentTests/PlatformServices.Desktop.Component.Tests/PlatformServices.Desktop.Component.Tests.csproj +++ b/test/ComponentTests/PlatformServices.Desktop.Component.Tests/PlatformServices.Desktop.Component.Tests.csproj @@ -12,7 +12,7 @@ Properties MSTestAdapter.PlatformServices.Desktop.ComponentTests PlatformServices.Desktop.ComponentTests - v4.5.1 + v4.5.2 512 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 10.0 @@ -41,18 +41,32 @@ ..\..\..\packages\Castle.Core.4.2.1\lib\net45\Castle.Core.dll - - ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.11.0.0\lib\net35\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll - True + + ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatformVersion)\lib\net451\Microsoft.TestPlatform.CoreUtilities.dll + + + ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatformVersion)\lib\net451\Microsoft.TestPlatform.PlatformAbstractions.dll + + + ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatformVersion)\lib\net451\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll ..\..\..\packages\Moq.4.8.2\lib\net45\Moq.dll + + ..\..\..\packages\NuGet.Frameworks.5.0.0\lib\net40\NuGet.Frameworks.dll + FrameworkV1 + + ..\..\..\packages\System.Collections.Immutable.1.5.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll + + + ..\..\..\packages\System.Reflection.Metadata.1.6.0\lib\portable-net45+win8\System.Reflection.Metadata.dll + ..\..\..\packages\System.Threading.Tasks.Extensions.4.3.0\lib\portable-net45+win8+wp8+wpa81\System.Threading.Tasks.Extensions.dll diff --git a/test/ComponentTests/PlatformServices.Desktop.Component.Tests/packages.config b/test/ComponentTests/PlatformServices.Desktop.Component.Tests/packages.config index d7e211d3bf..9abc69ce65 100644 --- a/test/ComponentTests/PlatformServices.Desktop.Component.Tests/packages.config +++ b/test/ComponentTests/PlatformServices.Desktop.Component.Tests/packages.config @@ -1,9 +1,12 @@  - + + + + \ No newline at end of file diff --git a/test/ComponentTests/TestAssets/TestProjectForAssemblyResolution/TestProjectForAssemblyResolution.csproj b/test/ComponentTests/TestAssets/TestProjectForAssemblyResolution/TestProjectForAssemblyResolution.csproj index 052e8878de..2cef981320 100644 --- a/test/ComponentTests/TestAssets/TestProjectForAssemblyResolution/TestProjectForAssemblyResolution.csproj +++ b/test/ComponentTests/TestAssets/TestProjectForAssemblyResolution/TestProjectForAssemblyResolution.csproj @@ -1,11 +1,10 @@ - ..\..\..\..\ - net451 + net452 false false $(TestFxRoot)artifacts\TestAssets\ComponentTests @@ -19,5 +18,4 @@ - diff --git a/test/E2ETests/Automation.CLI/Automation.CLI.csproj b/test/E2ETests/Automation.CLI/Automation.CLI.csproj index f72792ac61..cdfce14d48 100644 --- a/test/E2ETests/Automation.CLI/Automation.CLI.csproj +++ b/test/E2ETests/Automation.CLI/Automation.CLI.csproj @@ -12,7 +12,7 @@ Properties Automation.CLI Automation.CLI - v4.6 + v4.5.2 512 @@ -33,34 +33,37 @@ - ..\..\..\packages\Microsoft.TestPlatform.TranslationLayer.15.5.0\lib\net451\Microsoft.TestPlatform.CommunicationUtilities.dll + ..\..\..\packages\Microsoft.TestPlatform.TranslationLayer.$(TestPlatformVersion)\lib\net451\Microsoft.TestPlatform.CommunicationUtilities.dll - ..\..\..\packages\Microsoft.TestPlatform.TranslationLayer.15.5.0\lib\net451\Microsoft.TestPlatform.CoreUtilities.dll + ..\..\..\packages\Microsoft.TestPlatform.TranslationLayer.$(TestPlatformVersion)\lib\net451\Microsoft.TestPlatform.CoreUtilities.dll - ..\..\..\packages\Microsoft.TestPlatform.TranslationLayer.15.5.0\lib\net451\Microsoft.TestPlatform.PlatformAbstractions.dll + ..\..\..\packages\Microsoft.TestPlatform.TranslationLayer.$(TestPlatformVersion)\lib\net451\Microsoft.TestPlatform.PlatformAbstractions.dll - ..\..\..\packages\Microsoft.TestPlatform.TranslationLayer.15.5.0\lib\net451\Microsoft.TestPlatform.VsTestConsole.TranslationLayer.dll + ..\..\..\packages\Microsoft.TestPlatform.TranslationLayer.$(TestPlatformVersion)\lib\net451\Microsoft.TestPlatform.VsTestConsole.TranslationLayer.dll - ..\..\..\packages\Microsoft.TestPlatform.TranslationLayer.15.5.0\lib\net451\Microsoft.VisualStudio.TestPlatform.Common.dll + ..\..\..\packages\Microsoft.TestPlatform.TranslationLayer.$(TestPlatformVersion)\lib\net451\Microsoft.VisualStudio.TestPlatform.Common.dll - ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.15.5.0\lib\net451\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll + ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatformVersion)\lib\net451\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll ..\..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll + + ..\..\..\packages\NuGet.Frameworks.5.0.0\lib\net40\NuGet.Frameworks.dll + - - ..\..\..\packages\System.Collections.Immutable.1.2.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll + + ..\..\..\packages\System.Collections.Immutable.1.5.0\lib\netstandard1.3\System.Collections.Immutable.dll - - ..\..\..\packages\System.Reflection.Metadata.1.3.0\lib\portable-net45+win8\System.Reflection.Metadata.dll + + ..\..\..\packages\System.Reflection.Metadata.1.6.0\lib\portable-net45+win8\System.Reflection.Metadata.dll @@ -90,6 +93,7 @@ + @@ -107,6 +111,12 @@ xcopy /Y /I "$(SourcePath)PlatformServices.NetCore\netstandard1.5\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.pdb" "$(DestinationPath)\netcoreapp1.1\" xcopy /Y /I "$(SourcePath)PlatformServices.NetCore\netstandard1.5\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.dll" "$(DestinationPath)\netcoreapp1.1\" xcopy /Y /I "$(SourcePath)PlatformServices.NetCore\netstandard1.5\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.pdb" "$(DestinationPath)\netcoreapp1.1\" + xcopy /Y /I "$(SourcePath)MSTest.CoreAdapter\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll" "$(DestinationPath)\netcoreapp2.1\" + xcopy /Y /I "$(SourcePath)MSTest.CoreAdapter\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.pdb" "$(DestinationPath)\netcoreapp2.1\" + xcopy /Y /I "$(SourcePath)PlatformServices.NetCore\netstandard1.5\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll" "$(DestinationPath)\netcoreapp2.1\" + xcopy /Y /I "$(SourcePath)PlatformServices.NetCore\netstandard1.5\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.pdb" "$(DestinationPath)\netcoreapp2.1\" + xcopy /Y /I "$(SourcePath)PlatformServices.NetCore\netstandard1.5\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.dll" "$(DestinationPath)\netcoreapp2.1\" + xcopy /Y /I "$(SourcePath)PlatformServices.NetCore\netstandard1.5\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.pdb" "$(DestinationPath)\netcoreapp2.1\" xcopy /Y /I "$(SourcePath)PlatformServices.Interface\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.dll" "$(DestinationPath)" xcopy /Y /I "$(SourcePath)PlatformServices.Interface\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.pdb" "$(DestinationPath)" xcopy /Y /I "$(SourcePath)MSTest.Core\Microsoft.VisualStudio.TestPlatform.TestFramework.dll" "$(DestinationPath)" @@ -115,11 +125,4 @@ xcopy /Y /I "$(SourcePath)Extension.Desktop\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.pdb" "$(DestinationPath)" - \ No newline at end of file diff --git a/test/E2ETests/Automation.CLI/CLITestBase.cs b/test/E2ETests/Automation.CLI/CLITestBase.cs index 206b76b60c..769ec3b9cf 100644 --- a/test/E2ETests/Automation.CLI/CLITestBase.cs +++ b/test/E2ETests/Automation.CLI/CLITestBase.cs @@ -17,8 +17,10 @@ public class CLITestBase private const string TestAssetsFolder = "TestAssets"; private const string ArtifactsFolder = "artifacts"; private const string PackagesFolder = "packages"; - private const string TestPlatformCLIPackage = @"Microsoft.TestPlatform.15.5.0"; - private const string VstestConsoleRelativePath = @"tools\net451\vstest.console.exe"; + + // This value is automatically updated by "build.ps1" script. + private const string TestPlatformCLIPackage = @"Microsoft.TestPlatform.16.9.0-preview-20201123-04"; + private const string VstestConsoleRelativePath = @"tools\net451\Common7\IDE\Extensions\TestPlatform\vstest.console.exe"; private static VsTestConsoleWrapper vsTestConsoleWrapper; private DiscoveryEventsHandler discoveryEventsHandler; @@ -209,7 +211,7 @@ public void ValidateFailedTestsContain(string source, bool validateStackTraceInf { if (string.IsNullOrWhiteSpace(testFound.ErrorStackTrace)) { - Assert.Fail($"The test failure {testFound.DisplayName} with message {testFound.ErrorMessage} lacks stacktrace"); + Assert.Fail($@"The test failure {testFound.DisplayName ?? testFound.TestCase.FullyQualifiedName} with message {testFound.ErrorMessage} lacks stacktrace."); } // Verify stack information as well. diff --git a/test/E2ETests/Automation.CLI/app.config b/test/E2ETests/Automation.CLI/app.config new file mode 100644 index 0000000000..e4fbd2afdb --- /dev/null +++ b/test/E2ETests/Automation.CLI/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/test/E2ETests/Automation.CLI/packages.config b/test/E2ETests/Automation.CLI/packages.config index 532c80579e..ce2e569b5f 100644 --- a/test/E2ETests/Automation.CLI/packages.config +++ b/test/E2ETests/Automation.CLI/packages.config @@ -1,11 +1,12 @@  - - - + + + + - - + + \ No newline at end of file diff --git a/test/E2ETests/Smoke.E2E.Tests/DeploymentTests.cs b/test/E2ETests/Smoke.E2E.Tests/DeploymentTests.cs index c2295d8b7c..58f463296f 100644 --- a/test/E2ETests/Smoke.E2E.Tests/DeploymentTests.cs +++ b/test/E2ETests/Smoke.E2E.Tests/DeploymentTests.cs @@ -9,8 +9,10 @@ namespace MSTestAdapter.Smoke.E2ETests [TestClass] public class DeploymentTests : CLITestBase { - private const string TestAssembly = "DesktopDeployment\\DeploymentTestProject.dll"; - private const string TestAssemblyNetCore = "netcoreapp1.1\\DeploymentTestProjectNetCore.dll"; + private const string TestAssemblyDependency = "DesktopDeployment\\Never\\DeploymentTestProject.dll"; + private const string TestAssemblyMSBuild = "DesktopDeployment\\PreserveNewest\\DeploymentTestProject.dll"; + private const string TestAssemblyNetCore10 = "netcoreapp1.0\\DeploymentTestProjectNetCore.dll"; + private const string TestAssemblyNetCore21 = "netcoreapp2.1\\DeploymentTestProjectNetCore.dll"; private const string RunSetting = @" @@ -21,25 +23,45 @@ public class DeploymentTests : CLITestBase [TestMethod] public void ValidateTestSourceDependencyDeployment() { - this.InvokeVsTestForExecution(new string[] { TestAssembly }); - this.ValidatePassedTestsContain("DeploymentTestProject.UnitTest1.FailIfFilePresent", "DeploymentTestProject.UnitTest1.PassIfDeclaredFilesPresent"); - this.ValidateFailedTestsContain("DeploymentTestProject.dll", true, "DeploymentTestProject.UnitTest1.PassIfFilePresent"); + this.InvokeVsTestForExecution(new string[] { TestAssemblyDependency }); + this.ValidatePassedTestsContain("DeploymentTestProject.DeploymentTestProject.FailIfFilePresent", "DeploymentTestProject.DeploymentTestProject.PassIfDeclaredFilesPresent"); + this.ValidateFailedTestsContain(TestAssemblyMSBuild, true, "DeploymentTestProject.DeploymentTestProject.PassIfFilePresent"); } [TestMethod] public void ValidateTestSourceLocationDeployment() { - this.InvokeVsTestForExecution(new string[] { TestAssembly }, RunSetting); - this.ValidatePassedTestsContain("DeploymentTestProject.UnitTest1.PassIfFilePresent", "DeploymentTestProject.UnitTest1.PassIfDeclaredFilesPresent"); - this.ValidateFailedTestsContain("DeploymentTestProject.dll", true, "DeploymentTestProject.UnitTest1.FailIfFilePresent"); + this.InvokeVsTestForExecution(new string[] { TestAssemblyMSBuild }, RunSetting); + this.ValidatePassedTestsContain("DeploymentTestProject.DeploymentTestProject.PassIfFilePresent", "DeploymentTestProject.DeploymentTestProject.PassIfDeclaredFilesPresent"); + this.ValidateFailedTestsContain(TestAssemblyMSBuild, true, "DeploymentTestProject.DeploymentTestProject.FailIfFilePresent"); } + /* + * This test is disabled because testhost in netcoreapp1.0 is broken for now. + [TestMethod] - public void ValidateTestSourceLocationDeploymentNetCore() + public void ValidateTestSourceLocationDeploymentNetCore1_0() { - this.InvokeVsTestForExecution(new string[] { TestAssemblyNetCore }, null); + this.InvokeVsTestForExecution(new string[] { TestAssemblyNetCore10 }, null); this.ValidatePassedTestsContain("DeploymentTestProjectNetCore.DeploymentTestProjectNetCore.FailIfFilePresent", "DeploymentTestProjectNetCore.DeploymentTestProjectNetCore.PassIfDeclaredFilesPresent"); this.ValidateFailedTestsContain("DeploymentTestProjectNetCore.dll", true, "DeploymentTestProjectNetCore.DeploymentTestProjectNetCore.PassIfFilePresent"); } + */ + + [TestMethod] + public void ValidateTestSourceLocationDeploymentNetCore2_1() + { + // StackTrace isn't included in release builds with netcoreapp2.1. + const bool validateStackTrace = +#if DEBUG + true; +#else + false; +#endif + + this.InvokeVsTestForExecution(new string[] { TestAssemblyNetCore21 }, null); + this.ValidatePassedTestsContain("DeploymentTestProjectNetCore.DeploymentTestProjectNetCore.FailIfFilePresent", "DeploymentTestProjectNetCore.DeploymentTestProjectNetCore.PassIfDeclaredFilesPresent"); + this.ValidateFailedTestsContain(TestAssemblyMSBuild, validateStackTrace, "DeploymentTestProjectNetCore.DeploymentTestProjectNetCore.PassIfFilePresent"); + } } } diff --git a/test/E2ETests/Smoke.E2E.Tests/Smoke.E2E.Tests.csproj b/test/E2ETests/Smoke.E2E.Tests/Smoke.E2E.Tests.csproj index bc5ac4b3c6..a23c2786d5 100644 --- a/test/E2ETests/Smoke.E2E.Tests/Smoke.E2E.Tests.csproj +++ b/test/E2ETests/Smoke.E2E.Tests/Smoke.E2E.Tests.csproj @@ -12,7 +12,7 @@ Properties MSTestAdapter.Smoke.E2ETests MSTestAdapter.Smoke.E2ETests - v4.6 + v4.5.2 512 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} UnitTest @@ -22,17 +22,19 @@ true full false - DEBUG;TRACE prompt 4 pdbonly true - TRACE prompt 4 + + DEBUG;TRACE + TRACE + @@ -53,6 +55,7 @@ + @@ -63,11 +66,4 @@ - \ No newline at end of file diff --git a/test/E2ETests/Smoke.E2E.Tests/TimeoutTests.cs b/test/E2ETests/Smoke.E2E.Tests/TimeoutTests.cs index b325537948..8f7076d7fa 100644 --- a/test/E2ETests/Smoke.E2E.Tests/TimeoutTests.cs +++ b/test/E2ETests/Smoke.E2E.Tests/TimeoutTests.cs @@ -4,6 +4,7 @@ namespace MSTestAdapter.Smoke.E2ETests { using System.IO; + using Microsoft.MSTestV2.CLIAutomation; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -11,10 +12,10 @@ namespace MSTestAdapter.Smoke.E2ETests public class TimeoutTests : CLITestBase { private const string TimeoutTestAssembly = "TimeoutTestProject.dll"; - private const string TimeoutTestAssemblyNetCore = "netcoreapp1.1\\TimeoutTestProjectNetCore.dll"; + private const string TimeoutTestAssemblyNetCore = "netcoreapp2.1\\TimeoutTestProjectNetCore.dll"; private const int TestMethodWaitTimeInMs = 6000; private const int OverheadTimeInMs = 2500; - private const string TimeoutFileToValidateNetCore = "netcoreapp1.1\\TimeoutTestOutputNetCore.txt"; + private const string TimeoutFileToValidateNetCore = "netcoreapp2.1\\TimeoutTestOutputNetCore.txt"; private const string TimeoutFileToValidate = "TimeoutTestOutput.txt"; [TestMethod] diff --git a/test/E2ETests/Smoke.E2E.Tests/app.config b/test/E2ETests/Smoke.E2E.Tests/app.config new file mode 100644 index 0000000000..e4fbd2afdb --- /dev/null +++ b/test/E2ETests/Smoke.E2E.Tests/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/test/E2ETests/TestAssets/CompatTestProject/CompatTestProject.csproj b/test/E2ETests/TestAssets/CompatTestProject/CompatTestProject.csproj index b71b63339d..5f88101c04 100644 --- a/test/E2ETests/TestAssets/CompatTestProject/CompatTestProject.csproj +++ b/test/E2ETests/TestAssets/CompatTestProject/CompatTestProject.csproj @@ -1,5 +1,4 @@ - ..\..\..\..\ @@ -13,7 +12,7 @@ - + diff --git a/test/E2ETests/TestAssets/DeploymentTestProject/UnitTest1.cs b/test/E2ETests/TestAssets/DeploymentTestProject/DeploymentTestProject.cs similarity index 69% rename from test/E2ETests/TestAssets/DeploymentTestProject/UnitTest1.cs rename to test/E2ETests/TestAssets/DeploymentTestProject/DeploymentTestProject.cs index 8109354496..b40ddd45a1 100644 --- a/test/E2ETests/TestAssets/DeploymentTestProject/UnitTest1.cs +++ b/test/E2ETests/TestAssets/DeploymentTestProject/DeploymentTestProject.cs @@ -1,12 +1,12 @@ -using System; -using System.IO; +using System.IO; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace DeploymentTestProject { - [DeploymentItem("DeploymentFile.xml")] + + [DeploymentItem(@"..\..\..\..\test\E2ETests\TestAssets\DeploymentTestProject\DeploymentFile.xml")] [TestClass] - public class UnitTest1 + public class DeploymentTestProject { [TestMethod] public void PassIfFilePresent() @@ -20,7 +20,7 @@ public void FailIfFilePresent() Assert.IsFalse(File.Exists("EmptyDataFile.xml")); } - [DeploymentItem("TestCaseDeploymentFile.xml")] + [DeploymentItem(@"..\..\..\..\test\E2ETests\TestAssets\DeploymentTestProject\TestCaseDeploymentFile.xml")] [TestMethod] public void PassIfDeclaredFilesPresent() { diff --git a/test/E2ETests/TestAssets/DeploymentTestProject/DeploymentTestProject.csproj b/test/E2ETests/TestAssets/DeploymentTestProject/DeploymentTestProject.csproj index 8f587e1cdb..7052a2f2f4 100644 --- a/test/E2ETests/TestAssets/DeploymentTestProject/DeploymentTestProject.csproj +++ b/test/E2ETests/TestAssets/DeploymentTestProject/DeploymentTestProject.csproj @@ -1,20 +1,24 @@  - ..\..\..\..\ + Never - + + net452 false false - $(TestFxRoot)artifacts\TestAssets\\DesktopDeployment\ - + $(TestFxRoot)artifacts\TestAssets\DesktopDeployment\$(DependencyCopyBehavior)\ - - + + + + + + @@ -23,13 +27,20 @@ - PreserveNewest + $(DependencyCopyBehavior) - PreserveNewest + $(DependencyCopyBehavior) - PreserveNewest + $(DependencyCopyBehavior) + + + + + + + diff --git a/test/E2ETests/TestAssets/DeploymentTestProjectNetCore/DeploymentTestProjectNetCore.csproj b/test/E2ETests/TestAssets/DeploymentTestProjectNetCore/DeploymentTestProjectNetCore.csproj index 524acc71f0..4227314bef 100644 --- a/test/E2ETests/TestAssets/DeploymentTestProjectNetCore/DeploymentTestProjectNetCore.csproj +++ b/test/E2ETests/TestAssets/DeploymentTestProjectNetCore/DeploymentTestProjectNetCore.csproj @@ -1,19 +1,19 @@  ..\..\..\..\ + false + - netcoreapp1.1 + netcoreapp2.1 NetCore false - false - $(PackageTargetFallback);portable-net45+win8+wpa81+wp8 - $(TestFxRoot)artifacts\TestAssets\netcoreapp1.1\ + $(TestFxRoot)artifacts\TestAssets\ - + diff --git a/test/E2ETests/TestAssets/TimeoutTestProjectNetCore/TimeoutTestProjectNetCore.csproj b/test/E2ETests/TestAssets/TimeoutTestProjectNetCore/TimeoutTestProjectNetCore.csproj index a46dff5b28..d4cee39ff3 100644 --- a/test/E2ETests/TestAssets/TimeoutTestProjectNetCore/TimeoutTestProjectNetCore.csproj +++ b/test/E2ETests/TestAssets/TimeoutTestProjectNetCore/TimeoutTestProjectNetCore.csproj @@ -2,17 +2,18 @@ ..\..\..\..\ + - netcoreapp1.1 + netcoreapp2.1 NetCore false false - $(TestFxRoot)artifacts\TestAssets\netcoreapp1.1\ + $(TestFxRoot)artifacts\TestAssets\netcoreapp2.1\ - + diff --git a/test/UnitTests/MSTest.CoreAdapter.TestUtilities/ActionUtility.cs b/test/UnitTests/MSTest.CoreAdapter.TestUtilities/ActionUtility.cs index c971d622f9..aae4c02058 100644 --- a/test/UnitTests/MSTest.CoreAdapter.TestUtilities/ActionUtility.cs +++ b/test/UnitTests/MSTest.CoreAdapter.TestUtilities/ActionUtility.cs @@ -3,7 +3,7 @@ namespace MSTestAdapter.TestUtilities { -#if NETCOREAPP1_1 +#if NETCOREAPP using TestFramework = Microsoft.VisualStudio.TestTools.UnitTesting; #else extern alias FrameworkV1; diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/App.config b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/App.config index 2d1bdf9d41..900d5a111d 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/App.config +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/App.config @@ -1,10 +1,14 @@ - + - + + + + + diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTest.CoreAdapter.Unit.Tests.csproj b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTest.CoreAdapter.Unit.Tests.csproj index fb289533c4..6369eb6a35 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTest.CoreAdapter.Unit.Tests.csproj +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTest.CoreAdapter.Unit.Tests.csproj @@ -39,15 +39,29 @@ $(TestFxRoot)packages\Castle.Core.3.3.3\lib\net45\Castle.Core.dll True - - ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.11.0.0\lib\net35\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll - True + + ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatformVersion)\lib\net451\Microsoft.TestPlatform.CoreUtilities.dll + + + ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatformVersion)\lib\net451\Microsoft.TestPlatform.PlatformAbstractions.dll + + + ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatformVersion)\lib\net451\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll $(TestFxRoot)packages\Moq.4.5.21\lib\net45\Moq.dll True + + ..\..\..\packages\NuGet.Frameworks.5.0.0\lib\net40\NuGet.Frameworks.dll + + + ..\..\..\packages\System.Collections.Immutable.1.5.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll + + + ..\..\..\packages\System.Reflection.Metadata.1.6.0\lib\portable-net45+win8\System.Reflection.Metadata.dll + diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/packages.config b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/packages.config index a7492e000b..dd7f1019b0 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/packages.config +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/packages.config @@ -1,7 +1,10 @@  - + + + + \ No newline at end of file diff --git a/test/UnitTests/PlatformServices.Desktop.Unit.Tests/App.config b/test/UnitTests/PlatformServices.Desktop.Unit.Tests/App.config index 2d1bdf9d41..d477166232 100644 --- a/test/UnitTests/PlatformServices.Desktop.Unit.Tests/App.config +++ b/test/UnitTests/PlatformServices.Desktop.Unit.Tests/App.config @@ -1,11 +1,18 @@ - + - - + + + + + + - \ No newline at end of file + + + + diff --git a/test/UnitTests/PlatformServices.Desktop.Unit.Tests/PlatformServices.Desktop.Unit.Tests.csproj b/test/UnitTests/PlatformServices.Desktop.Unit.Tests/PlatformServices.Desktop.Unit.Tests.csproj index cb0fca9577..2eec8729e3 100644 --- a/test/UnitTests/PlatformServices.Desktop.Unit.Tests/PlatformServices.Desktop.Unit.Tests.csproj +++ b/test/UnitTests/PlatformServices.Desktop.Unit.Tests/PlatformServices.Desktop.Unit.Tests.csproj @@ -10,7 +10,7 @@ Properties MSTestAdapter.PlatformServices.Desktop.UnitTests MSTestAdapter.PlatformServices.Desktop.UnitTests - v4.5.1 + v4.5.2 512 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 10.0 @@ -39,19 +39,33 @@ ..\..\..\packages\Castle.Core.3.3.3\lib\net45\Castle.Core.dll - - ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.11.0.0\lib\net35\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll - True + + ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatformVersion)\lib\net451\Microsoft.TestPlatform.CoreUtilities.dll + + + ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatformVersion)\lib\net451\Microsoft.TestPlatform.PlatformAbstractions.dll + + + ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatformVersion)\lib\net451\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll ..\..\..\packages\Moq.4.5.21\lib\net45\Moq.dll True + + ..\..\..\packages\NuGet.Frameworks.5.0.0\lib\net40\NuGet.Frameworks.dll + FrameworkV1 + + ..\..\..\packages\System.Collections.Immutable.1.5.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll + + + ..\..\..\packages\System.Reflection.Metadata.1.6.0\lib\portable-net45+win8\System.Reflection.Metadata.dll + diff --git a/test/UnitTests/PlatformServices.Desktop.Unit.Tests/packages.config b/test/UnitTests/PlatformServices.Desktop.Unit.Tests/packages.config index 3f7cddfcb7..f0bfa4a3b3 100644 --- a/test/UnitTests/PlatformServices.Desktop.Unit.Tests/packages.config +++ b/test/UnitTests/PlatformServices.Desktop.Unit.Tests/packages.config @@ -1,7 +1,10 @@  - + + + + \ No newline at end of file diff --git a/test/UnitTests/PlatformServices.NetCore.Unit.Tests/PlatformServices.NetCore.Unit.Tests.csproj b/test/UnitTests/PlatformServices.NetCore.Unit.Tests/PlatformServices.NetCore.Unit.Tests.csproj index d705d108b6..120fe67680 100644 --- a/test/UnitTests/PlatformServices.NetCore.Unit.Tests/PlatformServices.NetCore.Unit.Tests.csproj +++ b/test/UnitTests/PlatformServices.NetCore.Unit.Tests/PlatformServices.NetCore.Unit.Tests.csproj @@ -1,17 +1,20 @@  ..\..\..\ - NetCore - + false + + netcoreapp2.1 + NetCore + false MSTestAdapter.PlatformServices.NetCore.UnitTests MSTestAdapter.PlatformServices.NetCore.UnitTests - netcoreapp1.1 true - $(PackageTargetFallback);portable-net45+win8+wpa81+wp8 + CS1685 + @@ -35,20 +38,16 @@ - + - - - - FrameworkV2Extension - - - - - + + + + + @@ -65,11 +64,6 @@ - - - - - + diff --git a/test/UnitTests/PlatformServices.NetCore.Unit.Tests/Services/NetCoreTestContextImplementationTests.cs b/test/UnitTests/PlatformServices.NetCore.Unit.Tests/Services/NetCoreTestContextImplementationTests.cs index 4c06dfba8f..19e01619db 100644 --- a/test/UnitTests/PlatformServices.NetCore.Unit.Tests/Services/NetCoreTestContextImplementationTests.cs +++ b/test/UnitTests/PlatformServices.NetCore.Unit.Tests/Services/NetCoreTestContextImplementationTests.cs @@ -3,7 +3,7 @@ namespace MSTestAdapter.PlatformServices.Tests.Services { -#if NETCOREAPP1_1 +#if NETCOREAPP using Microsoft.VisualStudio.TestTools.UnitTesting; #else extern alias FrameworkV1; diff --git a/test/UnitTests/PlatformServices.NetCore.Unit.Tests/Utilities/NetCoreDeploymentUtilityTests.cs b/test/UnitTests/PlatformServices.NetCore.Unit.Tests/Utilities/NetCoreDeploymentUtilityTests.cs index 1f4f9624e5..f048a99ca6 100644 --- a/test/UnitTests/PlatformServices.NetCore.Unit.Tests/Utilities/NetCoreDeploymentUtilityTests.cs +++ b/test/UnitTests/PlatformServices.NetCore.Unit.Tests/Utilities/NetCoreDeploymentUtilityTests.cs @@ -13,8 +13,8 @@ namespace MSTestAdapter.PlatformServices.Tests.Utilities using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; - using Moq; using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; [TestClass] public class NetCoreDeploymentUtilityTests diff --git a/test/UnitTests/PlatformServices.Portable.Unit.Tests/PlatformServices.Portable.Unit.Tests.csproj b/test/UnitTests/PlatformServices.Portable.Unit.Tests/PlatformServices.Portable.Unit.Tests.csproj index ec65ae6837..0e00c1f40d 100644 --- a/test/UnitTests/PlatformServices.Portable.Unit.Tests/PlatformServices.Portable.Unit.Tests.csproj +++ b/test/UnitTests/PlatformServices.Portable.Unit.Tests/PlatformServices.Portable.Unit.Tests.csproj @@ -38,18 +38,32 @@ ..\..\..\packages\Castle.Core.3.3.3\lib\net45\Castle.Core.dll True + + ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatformVersion)\lib\net451\Microsoft.TestPlatform.CoreUtilities.dll + + + ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatformVersion)\lib\net451\Microsoft.TestPlatform.PlatformAbstractions.dll + FrameworkV1 - - ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.11.0.0\lib\net35\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll - True + + ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatformVersion)\lib\net451\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll ..\..\..\packages\Moq.4.5.21\lib\net45\Moq.dll True + + ..\..\..\packages\NuGet.Frameworks.5.0.0\lib\net40\NuGet.Frameworks.dll + + + ..\..\..\packages\System.Collections.Immutable.1.5.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll + + + ..\..\..\packages\System.Reflection.Metadata.1.6.0\lib\portable-net45+win8\System.Reflection.Metadata.dll + @@ -82,6 +96,7 @@ + diff --git a/test/UnitTests/PlatformServices.Portable.Unit.Tests/app.config b/test/UnitTests/PlatformServices.Portable.Unit.Tests/app.config new file mode 100644 index 0000000000..33d949fb5d --- /dev/null +++ b/test/UnitTests/PlatformServices.Portable.Unit.Tests/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/test/UnitTests/PlatformServices.Portable.Unit.Tests/packages.config b/test/UnitTests/PlatformServices.Portable.Unit.Tests/packages.config index a7492e000b..dd7f1019b0 100644 --- a/test/UnitTests/PlatformServices.Portable.Unit.Tests/packages.config +++ b/test/UnitTests/PlatformServices.Portable.Unit.Tests/packages.config @@ -1,7 +1,10 @@  - + + + + \ No newline at end of file diff --git a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Deployment/ns10DeploymentItemTests.cs b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Deployment/ns10DeploymentItemTests.cs index f3e59eba8c..8b173b888e 100644 --- a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Deployment/ns10DeploymentItemTests.cs +++ b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Deployment/ns10DeploymentItemTests.cs @@ -3,7 +3,7 @@ namespace MSTestAdapter.PlatformServices.Tests.Deployment { -#if NETCOREAPP1_1 +#if NETCOREAPP using Microsoft.VisualStudio.TestTools.UnitTesting; #else extern alias FrameworkV1; diff --git a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Deployment/ns10TestRunDirectoriesTests.cs b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Deployment/ns10TestRunDirectoriesTests.cs index cc2f4b6739..7f2c8e983d 100644 --- a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Deployment/ns10TestRunDirectoriesTests.cs +++ b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Deployment/ns10TestRunDirectoriesTests.cs @@ -3,7 +3,7 @@ namespace MSTestAdapter.PlatformServices.Tests.Deployment { -#if NETCOREAPP1_1 +#if NETCOREAPP using Microsoft.VisualStudio.TestTools.UnitTesting; #else extern alias FrameworkV1; diff --git a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Extensions/ns10ExceptionExtensionsTests.cs b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Extensions/ns10ExceptionExtensionsTests.cs index 088217afaa..df377d7e23 100644 --- a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Extensions/ns10ExceptionExtensionsTests.cs +++ b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Extensions/ns10ExceptionExtensionsTests.cs @@ -3,7 +3,7 @@ namespace MSTestAdapter.PlatformServices.Tests.Extensions { -#if NETCOREAPP1_1 +#if NETCOREAPP using Microsoft.VisualStudio.TestTools.UnitTesting; #else extern alias FrameworkV1; diff --git a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Services/ns10MSTestAdapterSettingsTests.cs b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Services/ns10MSTestAdapterSettingsTests.cs index c14a614824..f897f83f98 100644 --- a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Services/ns10MSTestAdapterSettingsTests.cs +++ b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Services/ns10MSTestAdapterSettingsTests.cs @@ -3,7 +3,7 @@ namespace MSTestAdapter.PlatformServices.Desktop.UnitTests { -#if NETCOREAPP1_1 +#if NETCOREAPP using Microsoft.VisualStudio.TestTools.UnitTesting; #else extern alias FrameworkV1; diff --git a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Utilities/ns10DeploymentUtilityTests.cs b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Utilities/ns10DeploymentUtilityTests.cs index 1bb7e23fac..c2250c70da 100644 --- a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Utilities/ns10DeploymentUtilityTests.cs +++ b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Utilities/ns10DeploymentUtilityTests.cs @@ -3,7 +3,7 @@ namespace MSTestAdapter.PlatformServices.Tests.Utilities { -#if NETCOREAPP1_1 +#if NETCOREAPP using Microsoft.VisualStudio.TestTools.UnitTesting; #else extern alias FrameworkV1; diff --git a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Utilities/ns10FileUtilityTests.cs b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Utilities/ns10FileUtilityTests.cs index ad9a367823..8f26814d47 100644 --- a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Utilities/ns10FileUtilityTests.cs +++ b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/Utilities/ns10FileUtilityTests.cs @@ -3,7 +3,7 @@ namespace MSTestAdapter.PlatformServices.Tests.Utilities { -#if NETCOREAPP1_1 +#if NETCOREAPP using Microsoft.VisualStudio.TestTools.UnitTesting; #else extern alias FrameworkV1; diff --git a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/ns10DiaSessionOperationsTests.cs b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/ns10DiaSessionOperationsTests.cs index 82171ed0b4..d118f202d5 100644 --- a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/ns10DiaSessionOperationsTests.cs +++ b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/ns10DiaSessionOperationsTests.cs @@ -3,7 +3,7 @@ namespace MSTestAdapter.PlatformServices.Tests.Services { -#if NETCOREAPP1_1 +#if NETCOREAPP using Microsoft.VisualStudio.TestTools.UnitTesting; #else extern alias FrameworkV1; diff --git a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/ns10FileOperationsTests.cs b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/ns10FileOperationsTests.cs index e9e1d18832..3ef163b05d 100644 --- a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/ns10FileOperationsTests.cs +++ b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/ns10FileOperationsTests.cs @@ -3,7 +3,7 @@ namespace MSTestAdapter.PlatformServices.Tests.Services { -#if NETCOREAPP1_1 +#if NETCOREAPP using Microsoft.VisualStudio.TestTools.UnitTesting; #else extern alias FrameworkV1; @@ -36,7 +36,15 @@ public void LoadAssemblyShouldThrowExceptionIfTheFileNameHasInvalidCharacters() { var filePath = "temp<>txt"; Action a = () => this.fileOperations.LoadAssembly(filePath, false); - ActionUtility.ActionShouldThrowExceptionOfType(a, typeof(ArgumentException)); + + Type expectedException; +#if NETCOREAPP + expectedException = typeof(FileNotFoundException); +#else + expectedException = typeof(ArgumentException); +#endif + + ActionUtility.ActionShouldThrowExceptionOfType(a, expectedException); } [TestMethod] diff --git a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/ns10ReflectionOperationsTests.cs b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/ns10ReflectionOperationsTests.cs index 4c9bdd038c..dcff19ad57 100644 --- a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/ns10ReflectionOperationsTests.cs +++ b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/ns10ReflectionOperationsTests.cs @@ -3,7 +3,7 @@ namespace MSTestAdapter.PlatformServices.Tests.Services { -#if NETCOREAPP1_1 +#if NETCOREAPP using Microsoft.VisualStudio.TestTools.UnitTesting; #else extern alias FrameworkV1; diff --git a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/ns10TestSourceHostTests.cs b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/ns10TestSourceHostTests.cs index 6d8685f1db..3d0185f886 100644 --- a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/ns10TestSourceHostTests.cs +++ b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/ns10TestSourceHostTests.cs @@ -3,7 +3,7 @@ namespace MSTestAdapter.PlatformServices.Tests.Services { -#if NETCOREAPP1_1 +#if NETCOREAPP using Microsoft.VisualStudio.TestTools.UnitTesting; #else extern alias FrameworkV1; diff --git a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/ns10TestSourceTests.cs b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/ns10TestSourceTests.cs index 66657e8e60..cc167d8591 100644 --- a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/ns10TestSourceTests.cs +++ b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/ns10TestSourceTests.cs @@ -3,7 +3,7 @@ namespace MSTestAdapter.PlatformServices.Tests.Services { -#if NETCOREAPP1_1 +#if NETCOREAPP using Microsoft.VisualStudio.TestTools.UnitTesting; #else extern alias FrameworkV1; diff --git a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/ns10ThreadOperationsTests.cs b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/ns10ThreadOperationsTests.cs index 0dd15d28c7..d12e65f51b 100644 --- a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/ns10ThreadOperationsTests.cs +++ b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.0/ns10ThreadOperationsTests.cs @@ -3,7 +3,7 @@ namespace MSTestAdapter.PlatformServices.Tests.Services { -#if NETCOREAPP1_1 +#if NETCOREAPP using Microsoft.VisualStudio.TestTools.UnitTesting; #else extern alias FrameworkV1; diff --git a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/Services/ns13MSTestSettingsProviderTests.cs b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/Services/ns13MSTestSettingsProviderTests.cs index 01bc1b1cf7..068072644d 100644 --- a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/Services/ns13MSTestSettingsProviderTests.cs +++ b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/Services/ns13MSTestSettingsProviderTests.cs @@ -3,7 +3,7 @@ namespace MSTestAdapter.PlatformServices.Desktop.UnitTests.Services { -#if NETCOREAPP1_1 +#if NETCOREAPP using Microsoft.VisualStudio.TestTools.UnitTesting; #else extern alias FrameworkV1; diff --git a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/Services/ns13TestDeploymentTests.cs b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/Services/ns13TestDeploymentTests.cs index 1e589d701b..82eef2e92f 100644 --- a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/Services/ns13TestDeploymentTests.cs +++ b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/Services/ns13TestDeploymentTests.cs @@ -4,7 +4,8 @@ namespace MSTestAdapter.PlatformServices.Tests.Services { extern alias FrameworkV2Extension; -#if NETCOREAPP1_1 + +#if NETCOREAPP using Microsoft.VisualStudio.TestTools.UnitTesting; #else extern alias FrameworkV1; @@ -529,7 +530,7 @@ private TestDeployment CreateAndSetupDeploymentRelatedUtilities(out TestRunDirec this.mockFileUtility.Setup(fu => fu.DoesDirectoryExist(It.Is(s => !s.EndsWith(".dll")))).Returns(true); this.mockFileUtility.Setup(fu => fu.DoesFileExist(It.IsAny())).Returns(true); var mockAssemblyUtility = new Mock(); -#if !NETCOREAPP1_1 +#if !NETCOREAPP mockAssemblyUtility.Setup( au => au.GetFullPathToDependentAssemblies(It.IsAny(), It.IsAny(), out this.warnings)) .Returns(new string[] { }); diff --git a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/Utilities/ns13DeploymentItemUtilityTests.cs b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/Utilities/ns13DeploymentItemUtilityTests.cs index 83f29aac3f..dd038907f6 100644 --- a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/Utilities/ns13DeploymentItemUtilityTests.cs +++ b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/Utilities/ns13DeploymentItemUtilityTests.cs @@ -5,7 +5,7 @@ namespace MSTestAdapter.PlatformServices.Tests.Utilities { extern alias FrameworkV2Extension; -#if NETCOREAPP1_1 +#if NETCOREAPP using Microsoft.VisualStudio.TestTools.UnitTesting; #else extern alias FrameworkV1; diff --git a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/Utilities/ns13ReflectionUtilityTests.cs b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/Utilities/ns13ReflectionUtilityTests.cs index 918214b735..b8dc9107d6 100644 --- a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/Utilities/ns13ReflectionUtilityTests.cs +++ b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/Utilities/ns13ReflectionUtilityTests.cs @@ -3,7 +3,7 @@ namespace MSTestAdapter.PlatformServices.Tests.Utilities { -#if NETCOREAPP1_1 +#if NETCOREAPP using Microsoft.VisualStudio.TestTools.UnitTesting; #else extern alias FrameworkV1; diff --git a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/ns13TraceListenerManagerTests.cs b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/ns13TraceListenerManagerTests.cs index 3a69ab0e52..c9131f5fac 100644 --- a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/ns13TraceListenerManagerTests.cs +++ b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/ns13TraceListenerManagerTests.cs @@ -3,7 +3,7 @@ namespace MSTestAdapter.PlatformServices.UnitTests.Services { -#if NETCOREAPP1_1 +#if NETCOREAPP using Microsoft.VisualStudio.TestTools.UnitTesting; #else extern alias FrameworkV1; diff --git a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/ns13TraceListenerTests.cs b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/ns13TraceListenerTests.cs index afde60ffdf..35f751aeee 100644 --- a/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/ns13TraceListenerTests.cs +++ b/test/UnitTests/PlatformServices.Shared.Unit.Tests/netstandard1.3/ns13TraceListenerTests.cs @@ -3,7 +3,7 @@ namespace MSTestAdapter.PlatformServices.UnitTests.Services { -#if NETCOREAPP1_1 +#if NETCOREAPP using Microsoft.VisualStudio.TestTools.UnitTesting; #else extern alias FrameworkV1; diff --git a/test/UnitTests/PlatformServices.Universal.Unit.Tests/PlatformServices.Universal.Unit.Tests.csproj b/test/UnitTests/PlatformServices.Universal.Unit.Tests/PlatformServices.Universal.Unit.Tests.csproj index 40b5040ad5..90b2cc525c 100644 --- a/test/UnitTests/PlatformServices.Universal.Unit.Tests/PlatformServices.Universal.Unit.Tests.csproj +++ b/test/UnitTests/PlatformServices.Universal.Unit.Tests/PlatformServices.Universal.Unit.Tests.csproj @@ -39,19 +39,37 @@ ..\..\..\packages\Castle.Core.4.0.0\lib\net45\Castle.Core.dll True + + ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatformVersion)\lib\net451\Microsoft.TestPlatform.CoreUtilities.dll + + + ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatformVersion)\lib\net451\Microsoft.TestPlatform.PlatformAbstractions.dll + FrameworkV1 + + ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatformVersion)\lib\net451\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll + ..\..\..\packages\Moq.4.7.8\lib\net45\Moq.dll True + + ..\..\..\packages\NuGet.Frameworks.5.0.0\lib\net40\NuGet.Frameworks.dll + + + ..\..\..\packages\System.Collections.Immutable.1.5.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll + + + ..\..\..\packages\System.Reflection.Metadata.1.6.0\lib\portable-net45+win8\System.Reflection.Metadata.dll + - + Designer diff --git a/test/UnitTests/PlatformServices.Universal.Unit.Tests/app.config b/test/UnitTests/PlatformServices.Universal.Unit.Tests/app.config new file mode 100644 index 0000000000..33d949fb5d --- /dev/null +++ b/test/UnitTests/PlatformServices.Universal.Unit.Tests/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/test/UnitTests/PlatformServices.Universal.Unit.Tests/packages.config b/test/UnitTests/PlatformServices.Universal.Unit.Tests/packages.config index fbe44e0b8a..dd2ccb4f40 100644 --- a/test/UnitTests/PlatformServices.Universal.Unit.Tests/packages.config +++ b/test/UnitTests/PlatformServices.Universal.Unit.Tests/packages.config @@ -1,7 +1,10 @@  + - + + + \ No newline at end of file