public void SimpleTest()
 {
     IMetric cyclomaticComplexity = new ILCyclomicComplextityMetric();
     MethodDefinition simpleMethod = Utils.GetMethod(assemblyDefinition, "DrivenMetrics.Tests.TestClasses.CodeComplexity", "SimpleMethod");
     MethodResult methodResult = cyclomaticComplexity.ProcessMethod(simpleMethod);
     Assert.AreEqual(1, methodResult.Result);
 }
Ejemplo n.º 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;
            }