public void ShouldReturnTrueForValidType()
        {
            var assemblyLoader = new AssemblyLoader("DomainTestClasses.dll");
            var assembly = assemblyLoader.Load();
            var result = assembly.MainModule.Types["DomainTestClasses.Foo"].IsValidForMetrics();

            Assert.That(result,Is.True);
        }
        public void ShouldReturnFalseForCompilerMadeMethod()
        {
            var assemblyLoader = new AssemblyLoader("DomainTestClasses.dll");
            var assembly = assemblyLoader.Load();
            var result = assembly.MainModule.Types[0].IsValidForMetrics();

            Assert.That(result, Is.False);
        }
 public void Setup()
 {
     var assemblyLoader = new AssemblyLoader("DomainTestClasses.dll");
     var assembly = assemblyLoader.Load();
     _methodFinder = new AssemblySearcher(assembly);
 }
 public void Setup()
 {
     var assemblyLoader = new AssemblyLoader("DomainTestClasses.dll");
     _assembly = assemblyLoader.Load();
 }
 public void SetUp()
 {
     AssemblyLoader loader = new AssemblyLoader("DrivenMetrics.Tests.exe");
     assemblyDefinition = loader.Load();
 }
示例#6
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;
            }
示例#7
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;
            }
 public void ShouldThrowExceptionOnMissingFile()
 {
     var assemblyLoader = new AssemblyLoader("fake.dll");
     Assert.Throws <FileNotFoundException>(() => assemblyLoader.Load());
 }
 public void ShouldLoadAssembly()
 {
     var assemblyLoader = new AssemblyLoader("DomainTestClasses.dll");
     var assembly = assemblyLoader.Load();
     Assert.That(assembly,Is.Not.Null);
 }