public void ResetData()
 {
     lock (lockObject)
     {
         this.activeCoverageReport = null;
     }
 }
예제 #2
0
        private ICoverageData UpdateDataImpl()
        {
            try
            {
                var coverageFile = CoverageEnvironment.coverageFile();

                if (activeCoverageFilename != coverageFile)
                {
                    activeCoverageFilename = coverageFile;
                    activeCoverageReport   = null;
                }

                if (File.Exists(coverageFile))
                {
                    if (activeCoverageReport != null)
                    {
                        var lastWT = new FileInfo(coverageFile).LastWriteTimeUtc;
                        if (lastWT > activeCoverageReport.FileDate)
                        {
                            activeCoverageReport = null;
                        }
                    }

                    if (activeCoverageReport == null)
                    {
                        CoverageEnvironment.console.WriteLine("Updating coverage results from: {0}", coverageFile);
                        activeCoverageReport   = Load(coverageFile);
                        activeCoverageFilename = coverageFile;
                    }
                }
            }
            catch { }

            return(activeCoverageReport);
        }
        private ICoverageData UpdateDataImpl()
        {
            Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();

            try
            {
                string filename     = dte.Solution.FileName;
                string folder       = System.IO.Path.GetDirectoryName(filename);
                string coverageFile = System.IO.Path.Combine(folder, "CodeCoverage.xml");

                if (activeCoverageFilename != coverageFile)
                {
                    activeCoverageFilename = coverageFile;
                    activeCoverageReport   = null;
                }

                if (File.Exists(coverageFile))
                {
                    if (activeCoverageReport != null)
                    {
                        var lastWT = new FileInfo(coverageFile).LastWriteTimeUtc;
                        if (lastWT > activeCoverageReport.FileDate)
                        {
                            activeCoverageReport = null;
                        }
                    }

                    if (activeCoverageReport == null)
                    {
                        output.WriteLine("Updating coverage results from: {0}", coverageFile);
                        activeCoverageReport   = Load(coverageFile);
                        activeCoverageFilename = coverageFile;
                    }
                }
            }
            catch { }

            return(activeCoverageReport);
        }