Skip to content

Commit

Permalink
Load C++, & Old Mstest adapter for UWP (microsoft#1275)
Browse files Browse the repository at this point in the history
  • Loading branch information
mayankbansal018 authored Nov 21, 2017
1 parent 9f8ae85 commit 052e310
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,10 @@ public Dictionary<string, TPluginInfo> GetTestExtensionsInformation<TPluginInfo,

private void AddKnownExtensions(ref IEnumerable<string> extensionPaths)
{
// For C++ UWP adatper
if(this.fileHelper.Exists("Microsoft.VisualStudio.TestTools.CppUnitTestFramework.CppUnitTestExtension.dll"))
{
extensionPaths = extensionPaths.Concat(new[] { "Microsoft.VisualStudio.TestTools.CppUnitTestFramework.CppUnitTestExtension.dll" });
}

// For OLD C# UWP(MSTest V1) adatper
if (this.fileHelper.Exists("Microsoft.VisualStudio.TestPlatform.Extensions.MSAppContainerAdapter.dll"))
{
extensionPaths = extensionPaths.Concat(new[]{ "Microsoft.VisualStudio.TestPlatform.Extensions.MSAppContainerAdapter.dll" });
}
// For C++ UWP adatper, & OLD C# UWP(MSTest V1) adatper
// In UWP .Net Native Compilation mode managed dll's are packaged differently, & File.Exists() fails.
// Include these two dll's if so far no adapters(extensions) were found, & let Assembly.Load() fail if they are not present.
extensionPaths = extensionPaths.Concat(new[] { "Microsoft.VisualStudio.TestTools.CppUnitTestFramework.CppUnitTestExtension.dll", "Microsoft.VisualStudio.TestPlatform.Extensions.MSAppContainerAdapter.dll" });
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,36 +144,6 @@ public void GetTestExtensionsInformationShouldNotAbortOnFaultyExtensions()
Assert.That.DoesNotThrow(() =>this.testPluginDiscoverer.GetTestExtensionsInformation<FaultyTestExecutorPluginInformation, ITestExecutor>(pathToExtensions));
}

[TestMethod]
public void GetTestExtensionsInformationShouldAddUWPCppAdatersIfTheyExists()
{
var pathToExtensions = new List<string>();

Mock<IFileHelper> mockFileHelper = new Mock<IFileHelper>();
mockFileHelper.Setup(fh => fh.Exists("Microsoft.VisualStudio.TestTools.CppUnitTestFramework.CppUnitTestExtension.dll")).Returns(true);

this.testPluginDiscoverer = new TestPluginDiscoverer(mockFileHelper.Object);

var testExtensions = this.testPluginDiscoverer.GetTestExtensionsInformation<FaultyTestExecutorPluginInformation, ITestExecutor>(pathToExtensions);

mockFileHelper.Verify(fh => fh.Exists("Microsoft.VisualStudio.TestTools.CppUnitTestFramework.CppUnitTestExtension.dll"), Times.Once);
}

[TestMethod]
public void GetTestExtensionsInformationShouldAddMSTestV1UWPAdaptersIfTheyExists()
{
var pathToExtensions = new List<string>();

Mock<IFileHelper> mockFileHelper = new Mock<IFileHelper>();
mockFileHelper.Setup(fh => fh.Exists("Microsoft.VisualStudio.TestPlatform.Extensions.MSAppContainerAdapter.dll")).Returns(true);

this.testPluginDiscoverer = new TestPluginDiscoverer(mockFileHelper.Object);

var testExtensions = this.testPluginDiscoverer.GetTestExtensionsInformation<FaultyTestExecutorPluginInformation, ITestExecutor>(pathToExtensions);

mockFileHelper.Verify(fh => fh.Exists("Microsoft.VisualStudio.TestPlatform.Extensions.MSAppContainerAdapter.dll"), Times.Once);
}

#region implementations

#region Discoverers
Expand Down

0 comments on commit 052e310

Please sign in to comment.