示例#1
0
        public IRunSettingsTemplateReplacements Create(
            IEnumerable <ITestContainer> testContainers,
            Dictionary <string, IUserRunSettingsProjectDetails> userRunSettingsProjectDetailsLookup,
            string testAdapter)
        {
            var allProjectDetails = testContainers.Select(tc => userRunSettingsProjectDetailsLookup[tc.Source]).ToList();
            var resultsDirectory  = allProjectDetails[0].CoverageOutputFolder;
            var allSettings       = allProjectDetails.Select(pd => pd.Settings);
            var mergedSettings    = new MergedIncludesExcludesOptions(allSettings);


            var additionalModulePathsExclude = allProjectDetails.SelectMany(pd =>
            {
                var additional = pd.ExcludedReferencedProjects.Select(rp => MsCodeCoverageRegex.RegexModuleName(rp)).ToList();
                if (!pd.Settings.IncludeTestAssembly)
                {
                    additional.Add(MsCodeCoverageRegex.RegexEscapePath(pd.TestDllFile));
                }
                return(additional);
            });

            var additionalModulePathsInclude = allProjectDetails.SelectMany(projectDetails => projectDetails.IncludedReferencedProjects.Select(rp => MsCodeCoverageRegex.RegexModuleName(rp)));
            var settings = new CombinedIncludesExcludesOptions(mergedSettings, additionalModulePathsInclude, additionalModulePathsExclude);

            return(new RunSettingsTemplateReplacements(settings, resultsDirectory, "true", testAdapter));
        }
示例#2
0
        public IRunSettingsTemplateReplacements Create(ICoverageProject coverageProject, string testAdapter)
        {
            var projectSettings = coverageProject.Settings;
            var additionalModulePathsExclude = coverageProject.ExcludedReferencedProjects.Select(
                rp => MsCodeCoverageRegex.RegexModuleName(rp)).ToList();

            if (!projectSettings.IncludeTestAssembly)
            {
                additionalModulePathsExclude.Add(MsCodeCoverageRegex.RegexEscapePath(coverageProject.TestDllFile));
            }

            var additionalModulePathsInclude = coverageProject.IncludedReferencedProjects.Select(rp => MsCodeCoverageRegex.RegexModuleName(rp)).ToList();
            var settings = new CombinedIncludesExcludesOptions(projectSettings, additionalModulePathsInclude, additionalModulePathsExclude);

            return(new RunSettingsTemplateReplacements(settings, coverageProject.CoverageOutputFolder, projectSettings.Enabled.ToString(), testAdapter));
        }