public FeatureTestRunner(AttributeTextCleaner attributeCleaner) {
     this.attributeCleaner = attributeCleaner;
 }
 public FeatureTestTableSource(FeatureTestRunner runner, AttributeTextCleaner attributeCleaner, ExceptionNormalizer exceptionNormalizer) {
     this.runner = runner;
     this.attributeCleaner = attributeCleaner;
     this.exceptionNormalizer = exceptionNormalizer;
 }
Пример #3
0
        private static void Main(CommandLineArguments args)
        {
            var cache            = new LocalPackageCache(Path.GetFullPath(ConfigurationManager.AppSettings["NuGetPackagesPath"]));
            var httpDataProvider = new HttpDataProvider(new DirectoryInfo("HttpCache"));

            var attributeCleaner = new AttributeTextCleaner();
            var sources          = new IFeatureTableSource[] {
                new GeneralInfoTableSource(
                    cache,
                    httpDataProvider,
                    new LicenseResolver(httpDataProvider, new Uri(ConfigurationManager.AppSettings["LicensesJsonUrl"]))
                    ),
                new NetFxSupportTableSource(cache),
                new FeatureTestTableSource(new FeatureTestRunner(attributeCleaner), attributeCleaner, new ExceptionNormalizer())
            };
            var outputs = new IResultOutput[] {
                new HtmlOutput(new DirectoryInfo(ConfigurationManager.AppSettings["HtmlTemplatesPath"])),
                new JsonOutput()
            };

            var outputDirectory = new DirectoryInfo(args.OutputPath ?? ConfigurationManager.AppSettings["OutputPath"]);

            if (!outputDirectory.Exists)
            {
                outputDirectory.Create();
            }

            var assemblyPaths = GetAssemblyPaths();
            var results       = assemblyPaths.Select(path => {
                console.White.Text("Running " + Path.GetFileName(path) + ":");
                try {
                    var assembly = Assembly.LoadFrom(path);

                    var tables = sources.SelectMany(s => s.GetTables(assembly)).ToArray();
                    CalculateTotal(tables.Single(t => t.Key == MetadataKeys.GeneralInfoTable), tables);

                    var outputNamePrefix = assembly.GetName().Name.SubstringAfter(AssemblyNamePrefix);
                    var result           = new ResultForAssembly(assembly, tables, outputNamePrefix);

                    console.Green.Line(" OK");
                    return(result);
                }
                catch (Exception) {
                    console.Red.Line(" FAIL");
                    throw;
                }
            }).ToArray();

            console.NewLine();
            console.White.Line("Creating outputs:");
            foreach (var output in outputs)
            {
                output.Write(outputDirectory, results, args.WatchTemplates);
            }

            if (args.WatchTemplates)
            {
                console.NewLine()
                .White
                .Line("Auto-updating outputs if templates change.")
                .Line("Press [Enter] to stop.");
                Console.ReadLine();
            }

            foreach (var output in outputs)
            {
                output.Dispose();
            }

            Console.WriteLine();
            console.Green.Line("Completed.");
        }
Пример #4
0
        private static void Main(CommandLineArguments args)
        {
            var cache = new LocalPackageCache(Path.GetFullPath(ConfigurationManager.AppSettings["NuGetPackagesPath"]));
            var httpDataProvider = new HttpDataProvider(new DirectoryInfo("HttpCache"));

            var attributeCleaner = new AttributeTextCleaner();
            var sources = new IFeatureTableSource[] {
                new GeneralInfoTableSource(
                    cache,
                    httpDataProvider,
                    new LicenseResolver(httpDataProvider, new Uri(ConfigurationManager.AppSettings["LicensesJsonUrl"]))
                ),
                new NetFxSupportTableSource(cache),
                new FeatureTestTableSource(new FeatureTestRunner(attributeCleaner), attributeCleaner, new ExceptionNormalizer())
            };
            var outputs = new IResultOutput[] {
                new HtmlOutput(new DirectoryInfo(ConfigurationManager.AppSettings["HtmlTemplatesPath"])),
                new JsonOutput()
            };

            var outputDirectory = new DirectoryInfo(args.OutputPath ?? ConfigurationManager.AppSettings["OutputPath"]);
            if (!outputDirectory.Exists)
                outputDirectory.Create();

            var assemblyPaths = GetAssemblyPaths();
            var results = assemblyPaths.Select(path => {
                console.White.Text("Running " + Path.GetFileName(path) + ":");
                try {
                    var assembly = Assembly.LoadFrom(path);

                    var tables = sources.SelectMany(s => s.GetTables(assembly)).ToArray();
                    CalculateTotal(tables.Single(t => t.Key == MetadataKeys.GeneralInfoTable), tables);

                    var outputNamePrefix = assembly.GetName().Name.SubstringAfter(AssemblyNamePrefix);
                    var result = new ResultForAssembly(assembly, tables, outputNamePrefix);

                    console.Green.Line(" OK");
                    return result;
                }
                catch (Exception) {
                    console.Red.Line(" FAIL");
                    throw;
                }
            }).ToArray();

            console.NewLine();
            console.White.Line("Creating outputs:");
            foreach (var output in outputs) {
                output.Write(outputDirectory, results, args.WatchTemplates);
            }

            if (args.WatchTemplates) {
                console.NewLine()
                       .White
                       .Line("Auto-updating outputs if templates change.")
                       .Line("Press [Enter] to stop.");
                Console.ReadLine();
            }

            foreach (var output in outputs) {
                output.Dispose();
            }

            Console.WriteLine();
            console.Green.Line("Completed.");
        }
Пример #5
0
 public FeatureTestTableSource(FeatureTestRunner runner, AttributeTextCleaner attributeCleaner, ExceptionNormalizer exceptionNormalizer)
 {
     this.runner              = runner;
     this.attributeCleaner    = attributeCleaner;
     this.exceptionNormalizer = exceptionNormalizer;
 }