Exemple #1
0
        /// <summary>
        /// Update the AdapterSourceMap
        /// </summary>
        /// <param name="sources">test sources</param>
        /// <param name="adapterSourceMap">Adapter Source Map</param>
        /// <param name="testRuntimeProvider">testhostmanager which updates the sources</param>
        private void UpdateTestSources(IEnumerable <string> sources, Dictionary <string, IEnumerable <string> > adapterSourceMap, ITestRuntimeProvider testRuntimeProvider)
        {
            var updatedTestSources = testRuntimeProvider.GetTestSources(sources);

            adapterSourceMap.Clear();
            adapterSourceMap.Add(ObjectModel.Constants.UnspecifiedAdapterPath, updatedTestSources);
        }
Exemple #2
0
        private static bool TryCheckTestSourceDifferFromPackage(ITestRuntimeProvider testRuntimeProvider,
                                                                IEnumerable <string> inputPackages, out IEnumerable <string> actualTestSources)
        {
            actualTestSources = testRuntimeProvider.GetTestSources(inputPackages);

            // For netcore/fullclr both packages and sources are same thing,
            // For UWP the actual source(exe) differs from input source(.appxrecipe) which we call package.
            // So in such models we check if they differ, then we pass this info to test host to update TestCase source with package info,
            // since this is needed by IDE's to map a TestCase to project.
            return(inputPackages.Except(actualTestSources).Any());
        }
Exemple #3
0
        public static void UpdateDiscoveryCriteria(this DiscoveryCriteria discoveryCriteria, ITestRuntimeProvider testRuntimeProvider)
        {
            var actualTestSources = testRuntimeProvider.GetTestSources(discoveryCriteria.Sources);

            // If the actual testSources, & input test sources do differ it means that the User(IDE) actually sent a package.
            // We are limiting that only one package can be sent per session, so picking the first entry in sources
            if (discoveryCriteria.Sources.Except(actualTestSources).Any())
            {
                discoveryCriteria.Package = discoveryCriteria.Sources.FirstOrDefault();

                // Allow TestRuntimeProvider to update source map, this is required for remote scenarios.
                // If we run for specific tests, then we expect the test case object to contain correct source path for remote scenario as well
                UpdateTestSources(actualTestSources, discoveryCriteria.AdapterSourceMap);
            }
        }