Exemplo n.º 1
0
 /// <summary>
 ///   Registers a <see cref="IViolationReporter" /> for the <paramref name="reportFormat" /> with the Autofac container.
 /// </summary>
 public static void RegisterViolationReporter(
     this ContainerBuilder builder,
     ViolationReportFormat reportFormat,
     Func <IComponentContext, Func <TextWriter, IViolationReporter> > reporterFactory)
 {
     builder.Register(
         ctx =>
     {
         var context = ctx.Resolve <IComponentContext>();
         return(reporterFactory(context));
     }).Keyed <Func <TextWriter, IViolationReporter> >(reportFormat);
 }
Exemplo n.º 2
0
 public ParsedArguments(
     ISolution solution,
     IRuleCollection rules,
     ViolationReportFormat reportFormat,
     [CanBeNull] string reportOutputFile,
     ISolutionInspectorConfiguration configuration)
 {
     Solution         = solution;
     Rules            = rules;
     ReportFormat     = reportFormat;
     ReportOutputFile = reportOutputFile;
     Configuration    = configuration;
 }
        public IViolationReporter CreateFileReporter(ViolationReportFormat reportFormat, string filePath)
        {
            var writer = new StreamWriter(File.OpenWrite(filePath));

            return(_violationReporterFactories[reportFormat](writer));
        }
        public IViolationReporter CreateConsoleReporter(ViolationReportFormat reportFormat)
        {
            var writer = Console.Out;

            return(_violationReporterFactories[reportFormat](writer));
        }