Пример #1
0
        protected override void DoTest(IProject project)
        {
            var swea = SolutionAnalysisService.GetInstance(Solution);

            #if RIDER
            using (TestPresentationMap.Cookie())
            #else
            using (new TestPresentationMap())
            #endif
                using (TestPsiConfigurationSettings.Instance.PersistCachesCookie())
                    using (swea.RunAnalysisCookie())
                    {
                        Lifetimes.Using(lifetime =>
                        {
                            ChangeSettingsTemporarily(lifetime).BoundStore.SetValue(HighlightingSettingsAccessor.AnalysisEnabled, AnalysisScope.SOLUTION);

                            var files = swea.GetFilesToAnalyze().OrderBy(f => f.Name).ToList();
                            foreach (var file in files)
                            {
                                swea.AnalyzeInvisibleFile(file);
                            }

                            ExecuteWithGold(writer =>
                            {
                                var highlightingSettingsManager = HighlightingSettingsManager.Instance;
                                foreach (var file in files)
                                {
                                    if (file.LanguageType.IsNullOrUnknown())
                                    {
                                        continue;
                                    }
                                    var pf = file.ToProjectFile();
                                    if (pf == null)
                                    {
                                        continue;
                                    }
                                    if (!pf.Location.Name.EndsWith(".cs"))
                                    {
                                        continue;
                                    }

                                    var process = new TestHighlightingDumper(file, writer,
                                                                             DaemonStageManager.GetInstance(Solution).Stages,
                                                                             (highlighting, settingsStore) =>
                                    {
                                        var attribute = highlightingSettingsManager.GetHighlightingAttribute(highlighting);
                                        return(highlightingSettingsManager.GetSeverity(highlighting, settingsStore) !=
                                               Severity.INFO || attribute.OverlapResolve != OverlapResolveKind.NONE);
                                    },
                                                                             CSharpLanguage.Instance);
                                    process.DoHighlighting(DaemonProcessKind.VISIBLE_DOCUMENT);
                                    process.DoHighlighting(DaemonProcessKind.GLOBAL_WARNINGS);
                                    process.Dump();
                                    writer.WriteLine();
                                }
                            });
                        });
                    }
        }
Пример #2
0
        protected override void DoTest(IProject project)
        {
            var swea = SolutionAnalysisService.GetInstance(Solution);

            using (TestPresentationMap.Cookie())
                using (TestPsiConfigurationSettings.Instance.PersistCachesCookie())
                    using (swea.RunAnalysisCookie())
                    {
                        Lifetime.Using(lifetime =>
                        {
                            ChangeSettingsTemporarily(lifetime).BoundStore.SetValue(HighlightingSettingsAccessor.AnalysisEnabled, AnalysisScope.SOLUTION);

                            var files = swea.GetFilesToAnalyze().OrderBy(f => f.Name).ToList();
                            foreach (var file in files)
                            {
                                swea.AnalyzeInvisibleFile(file);
                            }

                            ExecuteWithGold(this.TestMethodName + ".cs", writer =>
                            {
                                foreach (var file in files)
                                {
                                    if (file.LanguageType.IsNullOrUnknown())
                                    {
                                        continue;
                                    }
                                    var pf = file.ToProjectFile();
                                    if (pf == null)
                                    {
                                        continue;
                                    }
                                    if (!pf.Location.Name.EndsWith(".cs"))
                                    {
                                        continue;
                                    }

                                    var process = new TestHighlightingDumper(file, writer,
                                                                             DaemonStageManager.GetInstance(Solution).Stages,
                                                                             (highlighting, psiSourceFile, settingsStore) =>
                                    {
                                        return(highlighting is PerformanceHighlightingBase);
                                    },
                                                                             CSharpLanguage.Instance);
                                    process.DoHighlighting(DaemonProcessKind.VISIBLE_DOCUMENT);
                                    process.DoHighlighting(DaemonProcessKind.GLOBAL_WARNINGS);
                                    process.Dump();
                                }
                            });
                        });
                    }
        }
        protected override void DoTest(IProject project)
        {
            var swea = SolutionAnalysisService.GetInstance(Solution);
            using (new TestPresentationMap())
            using (TestPsiConfigurationSettings.Instance.PersistCachesCookie())
            using (swea.RunAnalysisCookie())
            {
                Lifetimes.Using(lifetime =>
                {
                    ChangeSettingsTemporarily(lifetime).BoundStore.SetValue(HighlightingSettingsAccessor.AnalysisEnabled, AnalysisScope.SOLUTION);

                    var files = swea.GetFilesToAnalyze().OrderBy(f => f.Name).ToList();
                    foreach (var file in files)
                        swea.AnalyzeInvisibleFile(file);

                    ExecuteWithGold(writer =>
                    {
                        var highlightingSettingsManager = HighlightingSettingsManager.Instance;
                        foreach (var file in files)
                        {
                            if (file.LanguageType.IsNullOrUnknown()) continue;
                            var pf = file.ToProjectFile();
                            if (pf == null) continue;
                            if (!pf.Location.Name.EndsWith(".cs")) continue;

                            var process = new TestHighlightingDumper(file, writer,
                                DaemonStageManager.GetInstance(Solution).Stages,
                                (highlighting, settingsStore) =>
                                {
                                    var attribute = highlightingSettingsManager.GetHighlightingAttribute(highlighting);
                                    return highlightingSettingsManager.GetSeverity(highlighting, settingsStore) !=
                                           Severity.INFO || attribute.OverlapResolve != OverlapResolveKind.NONE;
                                },
                                CSharpLanguage.Instance);
                            process.DoHighlighting(DaemonProcessKind.VISIBLE_DOCUMENT);
                            process.DoHighlighting(DaemonProcessKind.GLOBAL_WARNINGS);
                            process.Dump();
                            writer.WriteLine();
                        }
                    });
                });
            }
        }