コード例 #1
0
        public void Given_Valid_Arguments_When_UpdateThreshold_Invoked_Then_valid_Results_Asserted()
        {
            codeAnalysisRepo.Add("Admin", "Repo1", "master", Tools.Resharper, 5, -1);
            var latestResult = codeAnalysisRepo.ReadLatestResult("Admin", "Repo1", "master", Tools.Resharper);

            Assert.AreEqual(-1, latestResult[0]);
            Assert.IsTrue(codeAnalysisRepo.UpdateThreshold("Admin", "Repo1", Tools.Resharper, "master", 3, 5));
            latestResult = codeAnalysisRepo.ReadLatestResult("Admin", "Repo1", "master", Tools.Resharper);
            Assert.AreEqual(3, latestResult[0]);
        }
コード例 #2
0
        public bool AbsoluteGate(int threshold, string userName, Tools tool, string repository, string branch)
        {
            var result = userCodeAnalysisRepo.ReadLatestResult(userName, repository, branch, tool);

            if (!result.Any())
            {
                return(false);
            }
            if (result[0] == -1)
            {
                userCodeAnalysisRepo.UpdateThreshold(userName, repository, tool, branch, threshold, result[1]);
            }

            return(result[1] <= threshold);
        }