public void ShouldCalculateNumberOfLinesForFooThird()
        {
            var method = _methodFinder.Find("Third");
            var lineCalculator = new NumberOfLinesCalculator(_MaxLines);
            var loc = lineCalculator.Calculate(method);

            Assert.That(loc.Result, Is.InRange(4, 6));
        }
        public void ShouldCalculateNumberOfLinesForFooFourth()
        {
            var method         = _assemblySearcher.FindMethod("Fourth");
            var lineCalculator = new NumberOfLinesCalculator(_MaxLines);
            var loc            = lineCalculator.Calculate(method);

            Assert.That(loc.Result, Is.InRange(11, 19));
        }
        public void ShouldCalculateNumberOfLinesForFooThird()
        {
            var method         = _methodFinder.Find("Third");
            var lineCalculator = new NumberOfLinesCalculator(_MaxLines);
            var loc            = lineCalculator.Calculate(method);

            Assert.That(loc.Result, Is.InRange(4, 6));
        }
        public void ShouldCalculateNoLForAllMethodsInCollection()
        {
            var lineCalculator = new NumberOfLinesCalculator(_MaxLines);
            var types = _methodFinder.GetAllTypes();

            var results = lineCalculator.Calculate(types);

            var numberOfClasses = results.ClassResults.Count;
            var numberOfMethods = results.ClassResults[0].MethodResults.Count;

            Assert.That(numberOfClasses,Is.EqualTo(1));
            Assert.That(numberOfMethods,Is.EqualTo(5));
        }
        public void ShouldCalculateNoLForAllMethodsInCollection()
        {
            var lineCalculator = new NumberOfLinesCalculator(_MaxLines);
            var types          = _assemblySearcher.GetAllTypes();

            var results = lineCalculator.Calculate(types);

            var numberOfClasses = results.ClassResults.Count;
            var numberOfMethods = results.ClassResults[0].MethodResults.Count;


            Assert.That(numberOfClasses, Is.EqualTo(2));
            Assert.That(numberOfMethods, Is.EqualTo(6));
        }
            public DrivenMetrics Create(string[] assemblyNames, string reportFilePath)
            {
                var assemblies = new List <AssemblyDefinition>();

                foreach (var assemblyName in assemblyNames)
                {
                    var assemblyLoader = new AssemblyLoader(assemblyName);
                    var assembly       = assemblyLoader.Load();
                    assemblies.Add(assembly);
                }

                var methodFinder = new AssemblySearcher(assemblies.ToArray());
                //var htmlReport = new HtmlReport(new FileWriter(), reportFilePath);
                var htmlReport        = new HtmlFailedReport(new FileWriter(), reportFilePath);
                var numberOfLines     = new NumberOfLinesCalculator(20);
                var cyclomicCompexity = new ILCyclomicComplextityCalculator(20);

                var drivenMetric = new DrivenMetrics(methodFinder, htmlReport, new IMetricCalculator[] { numberOfLines, cyclomicCompexity });

                return(drivenMetric);
            }