示例#1
0
 public static CrapResult Build(IEnumerable<Crap> crap, Func<int, IEnumerable<Crap>> aboveThreshold,
     int crapThreshold)
 {
     var crapResult = new CrapResult();
     GetSummary(crapResult, aboveThreshold, crapThreshold, crap);
     List<CrapMethod> methods = GetMethods(crap);
     crapResult.Methods = methods;
     return crapResult;
 }
示例#2
0
        private static void GetSummary(CrapResult crapResult, Func<int, IEnumerable<Crap>> aboveThreshold,
            int crapThreshold, IEnumerable<Crap> crap)
        {
            var crappyMethods = aboveThreshold(crapThreshold);

            crapResult.Summary = new Summary
                                     {
                                         CrapLoad = Math.Round(crappyMethods.Sum(c => c.CrapLoad()), 1),
                                         TotalMethods = crap.Count(),
                                         CrappyMethods = crappyMethods.Count(),
                                         CrapThreshold = crapThreshold
                                     };
        }