Esempio n. 1
0
        public void DiscoverAllTestExtensionsShouldAddToTheExtensionsAlreadyDiscovered()
        {
            // Setup mocks.
            var testableTestPluginCache = SetupMockAdditionalPathExtensions();

            var testExtensions = new TestExtensions();

            testExtensions.TestDiscoverers = new Dictionary <string, TestDiscovererPluginInformation>();
            testExtensions.TestDiscoverers.Add("td", new TestDiscovererPluginInformation(typeof(TestPluginCacheTests)));

            var extensionAssembly = typeof(TestPluginCacheTests).GetTypeInfo().Assembly.Location;

            testableTestPluginCache.TestExtensionsSetter = (IEnumerable <string> extensionAssemblies) =>
            {
                if (extensionAssemblies.Count() == 1 && extensionAssemblies.ToArray()[0] == "foo.dll")
                {
                    return(testExtensions);
                }
                else
                {
                    var discoverer = new TestPluginDiscoverer();
                    return(discoverer.GetTestExtensionsInformation(extensionAssemblies, loadOnlyWellKnownExtensions: false));
                }
            };

            testableTestPluginCache.GetTestExtensions("foo.dll");

            testableTestPluginCache.DiscoverAllTestExtensions();

            CollectionAssert.Contains(testableTestPluginCache.TestExtensions.TestDiscoverers.Keys, "td");
        }
Esempio n. 2
0
        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, loadOnlyWellKnownExtensions: true);

            mockFileHelper.Verify(fh => fh.Exists("Microsoft.VisualStudio.TestPlatform.Extensions.MSAppContainerAdapter.dll"), Times.Once);
        }
        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);
        }
 public TestPluginDiscovererTests()
 {
     this.testPluginDiscoverer = new TestPluginDiscoverer();
 }