示例#1
0
        public void TestMethod1()
        {
            string simianOptions = " -ignoreCurlyBraces+ ";

            simianExecutor.ExecuteSimianTool(simianOptions);
            Assert.IsTrue(File.Exists("C:\\Users\\320053937\\Documents\\SimianReport.txt"));
        }
        public string GateSimianReport(InputRepoModel inputModel)
        {
            CodeMetricsSqldbRepository sqldbRepository      = new CodeMetricsSqldbRepository();
            SimianReportParser         simianReportParser   = new SimianReportParser(sqldbRepository);
            GitRepositoryHandler       gitRepositoryHandler = new GitRepositoryHandler();
            SimianToolExecutor         simianToolExecutor   = new SimianToolExecutor(simianReportParser);
            string inputRepo = inputModel.gitRepo;

            simianReportParser.Persist(inputRepo);
            gitRepositoryHandler.CloneGithubRepository(inputRepo);
            int    simianExitCode            = simianToolExecutor.ExecuteSimianTool(simianOptions);
            int    simianDuplicates          = simianToolExecutor.ParseReport();
            int    gatingStatusOnPreviousRun = simianReportParser.GateOnPreviousRun(inputRepo);
            string result;

            if (gatingStatusOnPreviousRun == -1)
            {
                result = CheckGatingCondition(simianExitCode, simianDuplicates, inputModel.SimianDuplicatesThreshold);
            }
            else if (gatingStatusOnPreviousRun == 0)
            {
                result = CheckGatingCondition(simianExitCode, simianDuplicates, inputModel.SimianDuplicatesThreshold) + " Less Duplicates than Previous Run";
            }
            else
            {
                result = CheckGatingCondition(simianExitCode, simianDuplicates, inputModel.SimianDuplicatesThreshold) + "More Duplicates than Previous Run";
            }
            return(result);
        }