Skip to content

Commit

Permalink
Load specific types from adapter (#746)
Browse files Browse the repository at this point in the history
* Added types to load from adapter

* Updated test.ps1 to use internal TestPlatform

* Using internal up-to-date version of TestPlatfrom instead of one shipped with Visual Studio

* Fixed failing test

Co-authored-by: Medeni Baykal
  • Loading branch information
Sanan07 authored Nov 24, 2020
1 parent 76f0f89 commit cd19947
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
9 changes: 6 additions & 3 deletions scripts/test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,13 @@ function Run-Test([string[]] $testContainers, [string[]] $netCoreTestContainers)

function Get-VSTestPath
{
$vsInstallPath = Locate-VsInstallPath
$vstestPath = Join-Path -path $vsInstallPath "Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe"
$versionsFile = "$PSScriptRoot\build\TestFx.Versions.targets"
$TestPlatformVersion = (([XML](Get-Content $versionsFile)).Project.PropertyGroup.TestPlatformVersion).InnerText

$vsInstallPath = "$PSScriptRoot\..\packages\Microsoft.TestPlatform.$TestPlatformVersion\"
$vstestPath = Join-Path -path $vsInstallPath "tools\net451\Common7\IDE\Extensions\TestPlatform\vstest.console.exe"
return Resolve-Path -path $vstestPath
}

Print-Help
Invoke-Test
3 changes: 3 additions & 0 deletions src/Adapter/MSTest.CoreAdapter/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

using System.Reflection;
using System.Resources;
using Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
Expand All @@ -16,6 +18,7 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: TypesToLoad(typeof(MSTestDiscoverer), typeof(MSTestExecutor))]

// Version information for an assembly consists of the following four values:
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,15 @@ public void GetResolutionPathsShouldAddPublicAndPrivateAssemblyPath()
List<string> result = sut.GetResolutionPaths("DummyAssembly.dll", isPortableMode: false);

// Assert
Assert.IsTrue(result.Contains(VSInstallationUtilities.PathToPublicAssemblies));
Assert.IsTrue(result.Contains(VSInstallationUtilities.PathToPrivateAssemblies));
if (!string.IsNullOrWhiteSpace(VSInstallationUtilities.PathToPublicAssemblies))
{
Assert.IsTrue(result.Contains(VSInstallationUtilities.PathToPublicAssemblies));
}

if (!string.IsNullOrWhiteSpace(VSInstallationUtilities.PathToPrivateAssemblies))
{
Assert.IsTrue(result.Contains(VSInstallationUtilities.PathToPrivateAssemblies));
}
}

[TestMethod]
Expand Down

0 comments on commit cd19947

Please sign in to comment.