public void ShouldReturnNullForInvalidMethod()
        {
            var methodFinder = new AssemblySearcher(_assembly);
            var method = methodFinder.FindMethod("NonExisting");

            Assert.That(method, Is.Null);
        }
        public void ShouldLoadValidMethod()
        {
            var methodFinder = new AssemblySearcher(_assembly);
            var method = methodFinder.FindMethod("First");

            Assert.That(method.Name,Is.EqualTo("First"));
        }
        public void ShouldGetAllTypes()
        {
            var methodFinder = new AssemblySearcher(_assembly);
            var types = methodFinder.GetAllTypes().ToList();

            CollectionAssert.AreEquivalent(new[] { "Foo", "BaseClass" }, types.Select((typeDef, index) => typeDef.Name));
        }
Exemplo n.º 4
0
            public DrivenMetrics Create(string[] assemblyNames, IMetricCalculator[] metrics, string reportFilePath, IReport htmlReport)
            {
                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 drivenMetric = new DrivenMetrics(methodFinder, htmlReport, metrics);

                return(drivenMetric);
            }
Exemplo n.º 5
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 NumberOfLinesCalculator(20);
                var cyclomicCompexity = new ILCyclomicComplextityCalculator(20);

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

                return(drivenMetric);
            }
 public void Setup()
 {
     var assemblyLoader = new AssemblyLoader("DomainTestClasses.dll");
     var assembly = assemblyLoader.Load();
     _methodFinder = new AssemblySearcher(assembly);
 }
Exemplo n.º 7
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 NumberOfLinesCalculator(20);
                var cyclomicCompexity = new ILCyclomicComplextityCalculator(20);

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

                return drivenMetric;
            }
Exemplo n.º 8
0
            public DrivenMetrics Create(string[] assemblyNames, IMetricCalculator[] metrics, string reportFilePath, IReport htmlReport)
            {
                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 drivenMetric = new DrivenMetrics(methodFinder, htmlReport, metrics);

                return drivenMetric;
            }