static void Main(string[] args) { string inputConfigFilePath = ConfigurationManager.AppSettings.Get("InputConfigFilePath"); string outputFilePath = ConfigurationManager.AppSettings.Get("OutputFilePath"); IStaticAnalyzerConfigurations xmlConfigurations = new StaticAnalyzerXmlConfigurations(inputConfigFilePath); IStaticAnalyzers fxCopAnalyzer = new FxCopAnalyzer(xmlConfigurations); IReader fxCopReader = new FxCopReader(xmlConfigurations); IWriter textWriter = new TextWriter(outputFilePath); #region Analyzers and Readers List List <IStaticAnalyzers> analyzers = new List <IStaticAnalyzers>(); List <IReader> readers = new List <IReader>(); #endregion analyzers.Add(fxCopAnalyzer); readers.Add(fxCopReader); readers.Add(fxCopReader); readers.Add(fxCopReader); var manager = new StaticToolsProcessor(analyzers, readers, textWriter); manager.Process(); }
private bool StaticAnalyzerProcessor(string extractedFilePath, string dataPath) { string fxCopOutputFilePath = dataPath + "AnalyzerTools\\FxCopReport.xml"; string fxCopExePath = dataPath + "AnalyzerTools\\Microsoft_Fxcop_10.0\\FxCopCmd.exe"; string fxCopRulesFilePath = dataPath + "AnalyzerTools\\Microsoft_Fxcop_10.0\\common_fx_cop_file.FxCop"; string analyzerOutputFile = _outputReportPath; string nDependOutputFilePath = dataPath + "AnalyzerTools\\NDependOutput"; string nDependExePath = dataPath + "AnalyzerTools\\NDepend_2019.2.7.9280\\NDepend.Console.exe"; string nDependRulesFilePath = dataPath + "AnalyzerTools\\NDepend_2019.2.7.9280\\common.ndproj"; List <AnalyzersDataModel> analyzersDataModelsList = new List <AnalyzersDataModel> { new AnalyzersDataModel { Name = "FxCop", ExePath = fxCopExePath, OutputFilePath = fxCopOutputFilePath, RuleFilePath = fxCopRulesFilePath }, new AnalyzersDataModel { Name = "NDepend", ExePath = nDependExePath, OutputFilePath = nDependOutputFilePath, RuleFilePath = nDependRulesFilePath } }; IStaticAnalyzers fxCopAnalyzer = new FxCopAnalyzer(extractedFilePath, new StaticAnalyzerUtilities(new ConsoleLogger())); IStaticAnalyzers nDependAnalyzer = new NDependAnalyzer(extractedFilePath, new StaticAnalyzerUtilities(new ConsoleLogger())); IReader fxCopReader = new FxCopReader(new ConsoleLogger()); IReader nDependReader = new NDependReader(new ConsoleLogger()); IReportWriter textWriter = new TextReportWriter(analyzerOutputFile); #region Analyzers and Readers List List <IStaticAnalyzers> analyzers = new List <IStaticAnalyzers>(); List <IReader> readers = new List <IReader>(); analyzers.Add(fxCopAnalyzer); analyzers.Add(nDependAnalyzer); readers.Add(fxCopReader); readers.Add(nDependReader); #endregion #region Calling the processmanger var manager = new StaticToolsProcessor(analyzersDataModelsList, analyzers, readers, textWriter); bool successStatus = manager.Process(); #endregion return(successStatus); }
public void Given_Wrong_AnalyzerData_When_Process_Method_Invoked_Expected_Value_IsFalse() { List <AnalyzersDataModel> analyzersDataList = new List <AnalyzersDataModel> { new AnalyzersDataModel { Name = "", ExePath = "", OutputFilePath = "OutputPath", RuleFilePath = "" } }; StaticToolsProcessor staticToolsProcessorRef = new StaticToolsProcessor(analyzersDataList, analyzersList, readersList, _reportWriter); Assert.IsFalse(staticToolsProcessorRef.Process()); }