public void Dispose()
 {
     this.styleCopConsole.ViolationEncountered -= this.OnViolationEncountered;
     this.styleCopConsole = null;
     this.environment = null;
     this.configuration = null;
     this.violations = null;
 }
 public StyleCopRunner()
 {
     this.violations = new Dictionary<string, List<Violation>>();
     this.environment = new ObjectBasedEnvironment(this.SourceCodeFactory, this.SettingsFactory);
     this.configuration = new Configuration(new[] { "DEBUG", "TRACE" });
     this.styleCopConsole = new StyleCopObjectConsole(this.environment, null, null, true);
     this.styleCopConsole.ViolationEncountered += this.OnViolationEncountered;
 }
        public void StTestObjectBasedSourceCodeWithNoSettings()
        {
            ObjectBasedEnvironment environment = new ObjectBasedEnvironment(this.SourceCodeFactory, this.ProjectSettingsFactory);

            StyleCopObjectConsole styleCop = new StyleCopObjectConsole(environment, null, new string[] { "%projectroot%\\test\\testbin" }, false);

            // Create the configuration.
            Configuration configuration = new Configuration(null);

            // Create a CodeProject.
            CodeProject project = new CodeProject(0, null, configuration);
            styleCop.Core.Environment.AddSourceCode(project, "source1.cs", 0);
            styleCop.Core.Environment.AddSourceCode(project, "source2.cs", 1);
            styleCop.Core.Environment.AddSourceCode(project, "source3.cs", 2);

            styleCop.Start(new CodeProject[] { project });
        }