public bool TryOpenCoverageReport(string reportPath) { try { _report = GenericExtensions.ParseXml <CoverageSession>(reportPath); CoverageUpdated?.Invoke(this, EventArgs.Empty); return(true); } catch { return(false); } }
private void OnTestsFinished(object sender, EventArgs <TestReport> e) { if (e.Value.CoverageReport != null) { _report = e.Value.CoverageReport; var testMethods = e.Value.TestResults .Select(p => p.Method) .GroupBy(p => (p.Kind == CodeItemKind.Data ? p.Parent.FullName : p.FullName).CleanPath(true)) .ToDictionary(p => p.Key, p => p.ToArray()); _trackedMethods = _report.Modules .SelectMany(p => p.TrackedMethods) .Select(p => new { Id = p.Id, NameMatch = _visitorNameRegex.Match(p.Name), Name = p.Name }) .DoIf(p => !p.NameMatch.Success, p => _telemetryManager.UploadExceptionAsync(new Exception("Could not parse tracked method name: " + p.Name))) .Where(p => p.NameMatch.Success) .ToDictionary(p => p.Id, p => testMethods.TryGetValue(p.NameMatch.Groups["visitorName"].Value.Replace("::", ".")) ?? new TestMethod[0]); CoverageUpdated?.Invoke(this, EventArgs.Empty); } }