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(); }
public void Given_AnalyzersData_When_ProcessOutput_Invoked_Then_Expected_True() { IStaticAnalyzers nDependAnalyzer = new FxCopAnalyzer("", new FakeUtilitiesStub()); nDependAnalyzer.AnalyzersData = new AnalyzersDataModel { ExePath = "", Name = "", OutputFilePath = "", RuleFilePath = "" }; Assert.IsTrue(nDependAnalyzer.ProcessOutput()); }
public void Given_UserFilePath_When_ProcessInput_Invoked_Then_ExpectedTo_Return_False() { IStaticAnalyzers nDependAnalyzer = new FxCopAnalyzer("dir", new FakeUtilitiesStub()); nDependAnalyzer.AnalyzersData = new AnalyzersDataModel { ExePath = "", Name = "", OutputFilePath = "", RuleFilePath = "" }; Assert.IsFalse(nDependAnalyzer.ProcessInput()); }
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); }