Esempio n. 1
0
        protected override bool MeetsAchievementCriteria()
        {
            if (_currentBuildDefinitionOrderedChronoligically.Count < 3)
            {
                return(false);
            }
            var lastThree = _currentBuildDefinitionOrderedChronoligically.Skip(_currentBuildDefinitionOrderedChronoligically.Count - 3).ToList();

            if (!lastThree.All(i => i.RequestedBy == PersonSetting.RawName))
            {
                return(false);
            }
            if (!lastThree.All(i => i.StartedTime.HasValue && i.FinishedTime.HasValue))
            {
                return(false);
            }
            if (!lastThree.All(i => i.BuildStatusEnum == BuildStatusEnum.Working))
            {
                return(false);
            }
            BuildStatus oldestBuild                    = lastThree[0];
            BuildStatus middleBuild                    = lastThree[1];
            BuildStatus mostRecentBuild                = lastThree[2];
            var         wereLastBuildsBackToBack       = oldestBuild.IsBackToBackWithNextBuild(middleBuild);
            var         wereMostRecentBuidlsBackToBack = middleBuild.IsBackToBackWithNextBuild(mostRecentBuild);

            return(wereLastBuildsBackToBack && wereMostRecentBuidlsBackToBack);
        }
Esempio n. 2
0
        public static int HowManyTimesHasPerformedBackToBackBuildsForABuild(PersonSetting activePerson, IEnumerable <BuildStatus> currentBuildDefinitionOrderedChronoligically)
        {
            BuildStatus lastBuild = null;

            int backToBack = 0;

            foreach (var buildStatus in currentBuildDefinitionOrderedChronoligically)
            {
                bool lastBuildWasByActivePerson   = lastBuild != null && lastBuild.RequestedBy == activePerson.RawName;
                bool currentBuildIsByActivePerson = buildStatus.RequestedBy == activePerson.RawName;
                if (lastBuildWasByActivePerson && currentBuildIsByActivePerson)
                {
                    bool lastBuildPassed    = lastBuild.BuildStatusEnum == BuildStatusEnum.Working;
                    bool currentBuildPassed = buildStatus.BuildStatusEnum == BuildStatusEnum.Working;
                    bool wereBackToBack     = lastBuild.IsBackToBackWithNextBuild(buildStatus);
                    if (lastBuildPassed && currentBuildPassed && wereBackToBack)
                    {
                        backToBack++;
                    }
                }

                lastBuild = buildStatus;
            }

            _log.Debug(activePerson.RawName + " has achieved back to back successful builds " + backToBack + " times");
            return(backToBack);
        }