public MethodStatistics Concat(MethodStatistics other) { return(new MethodStatistics(Combine(FatLineCount, other.FatLineCount), Combine(MaxParameterCount, other.MaxParameterCount), TotalLines + other.TotalLines, LinesInFatMethods + other.LinesInFatMethods, MethodCount + other.MethodCount, FatMethodCount + other.FatMethodCount, MethodsWithTooManyParameters + other.MethodsWithTooManyParameters, TotalParameters + other.TotalParameters)); }
private void MethodStatisticsGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) { MethodStatistics selected = (MethodStatistics)MethodStatisticsGrid.SelectedItem; if (selected != null) { HistogramFilter.Content = selected.MethodName; } }
public TypeStatistics Concat(TypeStatistics other) { return(new TypeStatistics(MethodStatistics.Combine(FatClassBoundary, other.FatClassBoundary), MethodStatistics.Combine(TooManyFieldsBoundary, other.TooManyFieldsBoundary), TotalLines + other.TotalLines, TotalClasses + other.TotalClasses, TotalFields + other.TotalFields, FatClasses + other.FatClasses, LinesInFatClasses + other.LinesInFatClasses, ClassesWithTooManyFields + other.ClassesWithTooManyFields)); }
public void WritesDataToXml() { // Arrange var methodStats = new MethodStatistics(1, "Method", "Method", new VSCoverageStatistics { BlocksCovered = 1, BlocksNotCovered = 2, LinesCovered = 3, LinesNotCovered = 4, LinesPartiallyCovered = 5 }); methodStats.Class = new ClassStatistics(new NamespaceStatistics(new ModuleStatistics("module", Guid.Empty, 0, 0), "ns"), "clazz"); // Act var xml = TestHelper.GetXml(methodStats.WriteXml); // Assert xml.Should().Be( "<Root><MethodKeyName>module00000000-0000-0000-0000-000000000000nsclazz!Method!1</MethodKeyName><MethodName>Method</MethodName><MethodFullName>Method</MethodFullName>" + "<LinesCovered>3</LinesCovered><LinesPartiallyCovered>5</LinesPartiallyCovered><LinesNotCovered>4</LinesNotCovered><BlocksCovered>1</BlocksCovered>" + "<BlocksNotCovered>2</BlocksNotCovered></Root>"); }
public void CoverageEqualsToStats() { // Arrange var methodStats = new MethodStatistics(1, "Method", "Method", new VSCoverageStatistics { BlocksCovered = 1, BlocksNotCovered = 2, LinesCovered = 3, LinesNotCovered = 4, LinesPartiallyCovered = 5 }); // Act var blocksCovered = methodStats.BlocksCovered; var blocksNotCovered = methodStats.BlocksNotCovered; var linesCovered = methodStats.LinesCovered; var linesNotCovered = methodStats.LinesNotCovered; var linesPartiallyCovered = methodStats.LinesPartiallyCovered; // Assert blocksCovered.Should().Be(1); blocksNotCovered.Should().Be(2); linesCovered.Should().Be(3); linesNotCovered.Should().Be(4); linesPartiallyCovered.Should().Be(5); }
void DrawHistogram(IList <HistogramBar> histogram) { canvas1.Children.Clear(); SortedDictionary <string, MethodStatistics> stats = new SortedDictionary <string, MethodStatistics>(); foreach (HistogramBar h in histogram) { if (!stats.ContainsKey(h.Operation)) { stats.Add(h.Operation, new MethodStatistics { MethodName = h.Operation, TotalCount = 1, TotalDuration = h.Duration }); } else { MethodStatistics ms = stats[h.Operation]; ms.TotalCount += 1; ms.TotalDuration += h.Duration; } if (h.Operation != (string)HistogramFilter.Content) { continue; } Rectangle r = new Rectangle(); r.Fill = new SolidColorBrush(Colors.Red); r.Height = h.Count * canvas1.Height / 10; r.Width = canvas1.Width / 50; Canvas.SetLeft(r, canvas1.Width / 50 * Math.Floor(h.Duration)); Canvas.SetTop(r, 0); canvas1.Children.Insert(0, r); } MethodStatisticsGrid.ItemsSource = stats.Values; }