Esempio n. 1
0
        public CoverageDetails CalculateLineCoverage(Lines lines)
        {
            var details = new CoverageDetails();

            details.Covered = lines.Where(l => l.Value > 0).Count();
            details.Total   = lines.Count;
            return(details);
        }
Esempio n. 2
0
        public CoverageDetails CalculateMethodCoverage(Lines lines)
        {
            var details = new CoverageDetails();

            details.Covered = lines.Any(l => l.Value > 0) ? 1 : 0;
            details.Total   = 1;
            return(details);
        }
Esempio n. 3
0
        public CoverageDetails CalculateBranchCoverage(IList <BranchInfo> branches)
        {
            var details = new CoverageDetails();

            details.Covered = branches.Count(bi => bi.Hits > 0);
            details.Total   = branches.Count;
            return(details);
        }
Esempio n. 4
0
        public CoverageDetails CalculateBranchCoverage(Branches branches)
        {
            var details = new CoverageDetails();

            details.Covered = branches.Sum(b => b.Value.Where(bi => bi.Hits > 0).Count());
            details.Total   = branches.Sum(b => b.Value.Count());
            return(details);
        }
Esempio n. 5
0
        public CoverageDetails CalculateLineCoverage(Documents documents)
        {
            var details = new CoverageDetails();

            foreach (var document in documents)
            {
                var documentCoverage = CalculateLineCoverage(document.Value);
                details.Covered += documentCoverage.Covered;
                details.Total   += documentCoverage.Total;
            }
            return(details);
        }
Esempio n. 6
0
        public CoverageDetails CalculateLineCoverage(Classes classes)
        {
            var details = new CoverageDetails();

            foreach (var @class in classes)
            {
                var classCoverage = CalculateLineCoverage(@class.Value);
                details.Covered += classCoverage.Covered;
                details.Total   += classCoverage.Total;
            }
            return(details);
        }
Esempio n. 7
0
        public CoverageDetails CalculateLineCoverage(Methods methods)
        {
            var details = new CoverageDetails();

            foreach (var method in methods)
            {
                var methodCoverage = CalculateLineCoverage(method.Value.Lines);
                details.Covered += methodCoverage.Covered;
                details.Total   += methodCoverage.Total;
            }
            return(details);
        }
Esempio n. 8
0
        public CoverageDetails CalculateLineCoverage(Modules modules)
        {
            var details = new CoverageDetails();

            foreach (var module in modules)
            {
                var moduleCoverage = CalculateLineCoverage(module.Value);
                details.Covered += moduleCoverage.Covered;
                details.Total   += moduleCoverage.Total;
            }
            return(details);
        }
Esempio n. 9
0
        public CoverageDetails CalculateLineCoverage(Documents documents)
        {
            var details = new CoverageDetails();

            foreach (KeyValuePair <string, Classes> document in documents)
            {
                CoverageDetails documentCoverage = CalculateLineCoverage(document.Value);
                details.Covered += documentCoverage.Covered;
                details.Total   += documentCoverage.Total;
            }
            return(details);
        }
Esempio n. 10
0
        public CoverageDetails CalculateLineCoverage(Classes classes)
        {
            var details = new CoverageDetails();

            foreach (KeyValuePair <string, Methods> @class in classes)
            {
                CoverageDetails classCoverage = CalculateLineCoverage(@class.Value);
                details.Covered += classCoverage.Covered;
                details.Total   += classCoverage.Total;
            }
            return(details);
        }
Esempio n. 11
0
        public CoverageDetails CalculateBranchCoverage(Methods methods)
        {
            var details = new CoverageDetails();

            foreach (KeyValuePair <string, Method> method in methods)
            {
                CoverageDetails methodCoverage = CalculateBranchCoverage(method.Value.Branches);
                details.Covered += methodCoverage.Covered;
                details.Total   += methodCoverage.Total;
            }
            return(details);
        }
Esempio n. 12
0
        public CoverageDetails CalculateMethodCoverage(Methods methods)
        {
            var details          = new CoverageDetails();
            var methodsWithLines = methods.Where(m => m.Value.Lines.Count > 0);

            foreach (var method in methodsWithLines)
            {
                var methodCoverage = CalculateMethodCoverage(method.Value.Lines);
                details.Covered += methodCoverage.Covered;
            }
            details.Total = methodsWithLines.Count();
            return(details);
        }
Esempio n. 13
0
        public CoverageDetails CalculateMethodCoverage(Methods methods)
        {
            var details = new CoverageDetails();
            IEnumerable <KeyValuePair <string, Method> > methodsWithLines = methods.Where(m => m.Value.Lines.Count > 0);

            foreach (KeyValuePair <string, Method> method in methodsWithLines)
            {
                CoverageDetails methodCoverage = CalculateMethodCoverage(method.Value.Lines);
                details.Covered += methodCoverage.Covered;
            }
            details.Total = methodsWithLines.Count();
            return(details);
        }
Esempio n. 14
0
        public CoverageDetails CalculateLineCoverage(Modules modules)
        {
            var details      = new CoverageDetails();
            var accumPercent = 0.0D;

            foreach (var module in modules)
            {
                var moduleCoverage = CalculateLineCoverage(module.Value);
                details.Covered += moduleCoverage.Covered;
                details.Total   += moduleCoverage.Total;
                accumPercent    += moduleCoverage.Percent;
            }
            details.AverageModulePercent = accumPercent / modules.Count;
            return(details);
        }
Esempio n. 15
0
        public CoverageDetails CalculateMethodCoverage(Modules modules)
        {
            var details = new CoverageDetails {
                Modules = modules
            };
            var accumPercent = 0.0D;

            if (modules.Count == 0)
            {
                return(details);
            }

            foreach (var module in modules)
            {
                var moduleCoverage = CalculateMethodCoverage(module.Value);
                details.Covered += moduleCoverage.Covered;
                details.Total   += moduleCoverage.Total;
                accumPercent    += moduleCoverage.Percent;
            }
            details.AverageModulePercent = modules.Count == 0 ? 0 : accumPercent / modules.Count;
            return(details);
        }
Esempio n. 16
0
        public CoverageDetails CalculateLineCoverage(Modules modules)
        {
            var details = new CoverageDetails {
                Modules = modules
            };
            double accumPercent = 0.0D;

            if (modules.Count == 0)
            {
                return(details);
            }

            foreach (KeyValuePair <string, Documents> module in modules)
            {
                CoverageDetails moduleCoverage = CalculateLineCoverage(module.Value);
                details.Covered += moduleCoverage.Covered;
                details.Total   += moduleCoverage.Total;
                accumPercent    += moduleCoverage.Percent;
            }
            details.AverageModulePercent = accumPercent / modules.Count;
            return(details);
        }