Esempio n. 1
0
            private List <CoverageItem> GetAncestors(CoverageItem item)
            {
                List <CoverageItem> result = new List <CoverageItem>();

                while (item != null)
                {
                    result.Insert(0, item);
                    item = item.Parent;
                }
                return(result);
            }
Esempio n. 2
0
 private void LoadItem(CoverageItem item)
 {
     if (item.Visible)
     {
         listViewResults.Items.Add(item.ControlItem);
         if (item.Opening)
         {
             foreach (CoverageItem subItem in item.Items)
             {
                 LoadItem(subItem);
             }
         }
     }
 }
Esempio n. 3
0
            private int DirectCompare(CoverageItem itemX, CoverageItem itemY)
            {
                int result = 0;

                if (this.mainForm.sortingColumn == null)
                {
                    result = Comparer <string> .Default.Compare(itemX.Name, itemY.Name);
                }
                else
                {
                    result = Comparer <int> .Default.Compare(itemX[this.mainForm.sortingColumn], itemY[this.mainForm.sortingColumn]);
                }
                return(this.mainForm.sortingAscending ? result : -result);
            }
Esempio n. 4
0
        private void listViewResults_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            ListViewHitTestInfo info = listViewResults.HitTest(e.Location);

            if (info.Item != null)
            {
                CoverageItem coverageItem = info.Item.Tag as CoverageItem;
                int          index        = info.Item.Index;
                coverageItem.Opening = !coverageItem.Opening;
                ReloadItems();
                listViewResults.SelectedIndices.Clear();
                listViewResults.SelectedIndices.Add(index);
                listViewResults.EnsureVisible(index);
            }
        }
Esempio n. 5
0
 private void importVisualStudioUnittestResultToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (dialogOpen.ShowDialog() == DialogResult.OK)
     {
         try
         {
             XDocument document = XDocument.Load(dialogOpen.FileName);
             this.profile = CoverageReader.GetModules(document);
             ReloadItems();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
 }
Esempio n. 6
0
            int IComparer.Compare(object x, object y)
            {
                CoverageItem        itemX  = (x as ListViewItem).Tag as CoverageItem;
                CoverageItem        itemY  = (y as ListViewItem).Tag as CoverageItem;
                List <CoverageItem> itemXs = GetAncestors(itemX);
                List <CoverageItem> itemYs = GetAncestors(itemY);

                while (true)
                {
                    if (itemXs.Count > 0)
                    {
                        if (itemYs.Count > 0)
                        {
                            if (itemXs[0] == itemYs[0])
                            {
                                itemXs.RemoveAt(0);
                                itemYs.RemoveAt(0);
                            }
                            else
                            {
                                return(DirectCompare(itemXs[0], itemYs[0]));
                            }
                        }
                        else
                        {
                            return(1);
                        }
                    }
                    else
                    {
                        if (itemYs.Count > 0)
                        {
                            return(-1);
                        }
                        else
                        {
                            return(0);
                        }
                    }
                }
            }
Esempio n. 7
0
        public override bool Pass(CoverageItem item)
        {
            switch (this.Function)
            {
            case CoverageFilterFunctions.StartsWith:
                return(item.Name.StartsWith(this.Parameter));

            case CoverageFilterFunctions.NotStartsWith:
                return(!item.Name.StartsWith(this.Parameter));

            case CoverageFilterFunctions.EndsWith:
                return(item.Name.EndsWith(this.Parameter));

            case CoverageFilterFunctions.NotEndsWith:
                return(item.Name.EndsWith(this.Parameter));

            case CoverageFilterFunctions.Matches:
                return(GetRegex().Match(item.Name).Success);

            case CoverageFilterFunctions.NotMatches:
                return(!GetRegex().Match(item.Name).Success);

            case CoverageFilterFunctions.Contains:
                return(item.Name.IndexOf(this.Parameter) != -1);

            case CoverageFilterFunctions.NotContains:
                return(item.Name.IndexOf(this.Parameter) == -1);

            case CoverageFilterFunctions.Equal:
                return(item.Name == this.Parameter);

            case CoverageFilterFunctions.NotEqual:
                return(item.Name != this.Parameter);

            default:
                return(false);
            }
        }
 private static CoverageItem FillProperties(XElement element, string nameProperty, CoverageItem item)
 {
     if (item.CoverageType == CoverageType.Method)
     {
         item.BlocksCovered         = int.Parse(element.Element("BlocksCovered").Value);
         item.BlocksNotCovered      = int.Parse(element.Element("BlocksNotCovered").Value);
         item.LinesCovered          = int.Parse(element.Element("LinesCovered").Value);
         item.LinesNotCovered       = int.Parse(element.Element("LinesNotCovered").Value);
         item.LinesPartiallyCovered = int.Parse(element.Element("LinesPartiallyCovered").Value);
     }
     item.Name = element.Element(nameProperty).Value;
     return(item);
 }
 public FilterForm(CoverageItem item)
 {
     InitializeComponent();
     this.item          = item;
     textBoxFilter.Text = item.GetFilterXmlDocument().ToString();
 }
Esempio n. 10
0
 public override bool Pass(CoverageItem item)
 {
     return(Left.Pass(item) && Right.Pass(item));
 }
Esempio n. 11
0
 public abstract bool Pass(CoverageItem item);