Exemple #1
0
        public string GateTicsReport(TicsInputRepoModel inputModel)
        {
            CodeMetricsSqldbRepository sqldbRepository      = new CodeMetricsSqldbRepository();
            TicsReportParser           ticsReportParser     = new TicsReportParser(sqldbRepository);
            GitRepositoryHandler       gitRepositoryHandler = new GitRepositoryHandler();
            TicsToolExecutor           ticsToolExecutor     = new TicsToolExecutor(ticsReportParser);
            string inputRepo = inputModel.gitRepo;

            ticsReportParser.Persist(inputRepo);
            gitRepositoryHandler.CloneGithubRepository(inputRepo);
            ticsToolExecutor.ExecuteTicsTool();
            int    ticsErrors = ticsToolExecutor.ParseReport();
            int    gatingStatusOnPreviousRun = ticsReportParser.GateOnPreviousRun(inputRepo);
            string result;

            if (gatingStatusOnPreviousRun == -1)
            {
                result = CheckGatingCondition(ticsErrors, inputModel.TicsErrorsThreshold);
            }
            else if (gatingStatusOnPreviousRun == 0)
            {
                result = CheckGatingCondition(ticsErrors, inputModel.TicsErrorsThreshold) + " Less Errors than Previous Run";
            }
            else
            {
                result = CheckGatingCondition(ticsErrors, inputModel.TicsErrorsThreshold) + " Same Or More Errors than Previous Run";
            }
            return(result);
        }
 public void TestInitialize()
 {
     _mockWrapper     = new Moq.Mock <IReportParser>();
     _mockWrapper1    = new Moq.Mock <ICodeMetricsDbRepository>();
     ticsReportParser = new TicsReportParser(_mockWrapper1.Object);
     ticsExecutor     = new TicsToolExecutor(ticsReportParser);
 }
 public void TestCleanUp()
 {
     ticsExecutor = null;
     _mockWrapper = null;
 }