Exemplo n.º 1
0
        public SummaryViewModel(Poco.CodeModule[] modules)
        {
            var numSequencePoints     = modules.Sum(x => x.Summary.NumSequencePoints);
            var numBranchPoints       = modules.Sum(x => x.Summary.NumBranchPoints);
            var visitedSequencePoints = modules.Sum(x => x.Summary.VisitedSequencePoints);
            var visitedBranchPoints   = modules.Sum(x => x.Summary.VisitedBranchPoints);

            Summary = new SummaryInfo {
                Name                  = "Look at me",
                NumBranchPoints       = numBranchPoints,
                NumSequencePoints     = numSequencePoints,
                VisitedBranchPoints   = visitedBranchPoints,
                VisitedSequencePoints = visitedSequencePoints
            };
            if (visitedSequencePoints > 0 && visitedBranchPoints > 0)
            {
                decimal branchCoverage   = numBranchPoints / visitedBranchPoints;
                decimal sequenceCoverage = numSequencePoints / visitedSequencePoints;
                Summary.BranchCoverage   = branchCoverage;
                Summary.SequenceCoverage = sequenceCoverage;
            }
            _items = new ObservableCollection <SummaryViewModel>(
                (from module in modules
                 select new SummaryViewModel(module))
                .ToList());
            _modules = new ReadOnlyCollection <ModuleViewModel>(
                (from module in modules
                 select new ModuleViewModel(module))
                .ToList());
        }
Exemplo n.º 2
0
        public SummaryViewModel(Poco.CodeMethod method)
        {
            var methodName = method.Name.ToString();
            var start      = methodName.IndexOf("::") + 2;
            var end        = methodName.IndexOf("(") - start;

            Summary = new SummaryInfo(method.Summary, methodName.Substring(start, end));
        }
Exemplo n.º 3
0
 public SummaryViewModel(Poco.CodeModule module)
 {
     Summary = new SummaryInfo(module.Summary, module.Name);
     _items  = new ObservableCollection <SummaryViewModel>(
         (from clas in module.Classes
          select new SummaryViewModel(clas))
         .ToList());
 }
Exemplo n.º 4
0
        public SummaryViewModel(Poco.CodeClass clas)
        {
            var className = clas.Name.Substring(clas.Name.LastIndexOf(".") + 1);

            Summary = new SummaryInfo(clas.Summary, className);
            _items  = new ObservableCollection <SummaryViewModel>(
                (from method in clas.Methods
                 select new SummaryViewModel(method))
                .ToList());
        }