public void IfTest()
        {
            IMetric          cyclomaticComplexity = new ILCyclomicComplextityMetric();
            MethodDefinition simpleMethod         = Utils.GetMethod(assemblyDefinition, "DrivenMetrics.Tests.TestClasses.CodeComplexity", "IfMethod");
            MethodResult     methodResult         = cyclomaticComplexity.ProcessMethod(simpleMethod);

            Assert.AreEqual(3, methodResult.Result);
        }
Beispiel #2
0
            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 NumberOfLinesMetric();
                var cyclomicCompexity = new ILCyclomicComplextityMetric();

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

                return(drivenMetric);
            }