Exemple #1
0
        private static void Main(string[] args)
        {
            IStatCalculator stats = null;
            bool showErrors = true;
            bool showHelp = false;

            var p = new OptionSet
            {
                { "b|burndown", "Get burndown chart data", v => {
                    stats = new BurndownStats();
                }},
                { "c|cfd", "Get cumulative flow chart data", v => { stats = new CumulativeFlowStats(); }},
                { "t|table", "Summarize issues in sprint", v => { stats = new ContentTableStats(); }},
                { "e|errors", "Turn on or off list of issues with state errors (defaults to on)",
                    v => { showErrors = v != null; } },
                { "h|?|help", "Display this help message", v => showHelp = v != null }
            };
            List<String> extras = p.Parse(args);

            if (showHelp)
            {
                ShowHelp(p);
                return;
            }

            IList<Tuple<string, string>> repos = GetRepoNames(extras);

            if (stats == null)
            {
                stats = new BurndownStats();
            }

            var program = new Program(stats, repos, showErrors);
            program.Go();
        }
Exemple #2
0
        public void Setup()
        {
            _cache = new RedisCacheRepository(
                connectionString: "localhost,abortConnect=false",
                environment: "local",
                functionalArea: "bts",
                serializer: new XmlSerializer(),
                logger: new FakeCacheLogger(),
                expire: false);
            var lineupRepo = new CachedLineupRepository(
                new LineupRepository(),
                _cache);
            var actualRoster = new ActualRoster(
                lineupRepo);

            _gameLogRepository       = new GameLogRepository();
            _cachedGameLogRepository = new CachedGameLogRepository(
                _gameLogRepository,
                _cache);
            _statCalculator = new StatCalculator(
                _cachedGameLogRepository);
            _rosterMaster = new FbbRosters(
                new FbbEventStore.FbbEventStore());
            _sut = new HotList(
                actualRoster,
                _rosterMaster,
                _statCalculator);
        }
Exemple #3
0
        Program(IStatCalculator stats, IEnumerable<Tuple<string, string>> repoNames, bool listErrors)
        {
            this.stats = stats;
            this.repoNames = new List<Tuple<string, string>>(repoNames);

            ConnectToGithub();
            CreateFormatters(listErrors);
        }
Exemple #4
0
        Program(IStatCalculator stats, IEnumerable <Tuple <string, string> > repoNames, bool listErrors)
        {
            this.stats     = stats;
            this.repoNames = new List <Tuple <string, string> >(repoNames);

            ConnectToGithub();
            CreateFormatters(listErrors);
        }
        public UnitStatPM(IUnit i_unit, string i_stat, IStatCalculator i_calculator) : base()
        {
            Unit            = i_unit;
            Stat            = i_stat;
            mStatCalculator = i_calculator;

            SetProperties();
        }
        public UnitInfoPM(List <IUnit> i_units, int i_selectedIndex, IStatCalculator i_statCalculator) : base()
        {
            mUnits          = i_units;
            mSelectedIndex  = i_selectedIndex;
            mStatCalculator = i_statCalculator;

            RefreshPM();
        }
Exemple #7
0
 public HotList(
     IActualRoster actualRoster,
     IRosterMaster rosterMaster,
     IStatCalculator statCalculator)
 {
     _actualRoster   = actualRoster;
     _rosterMaster   = rosterMaster;
     _statCalculator = statCalculator;
 }
        public void GetSprintStatistics(IStatCalculator stats)
        {
            repository = github.GetRepository(ownerLogin, repositoryName);
            FindCurrentMilestone();
            FindIssues();

            stats.StartRepository(repository.Name, currentMilestone.Title);
            CalculateStatistics(stats);
        }
Exemple #9
0
        public void GetSprintStatistics(IStatCalculator stats)
        {
            repository = github.GetRepository(ownerLogin, repositoryName);
            FindCurrentMilestone();
            FindIssues();

            stats.StartRepository(repository.Name, currentMilestone.Title);
            CalculateStatistics(stats);
        }
Exemple #10
0
        private void CalculateStatistics(IStatCalculator stats)
        {
            foreach (Issue issue in openIssues.Concat(closedIssues).Where(i => !GithubConventions.IsPartnerIssue(i)))
            {
                float devEstimate;
                float testEstimate;

                GithubConventions.ParseEstimates(issue, stats, out devEstimate, out testEstimate);
                stats.AddIssue(issue, devEstimate, testEstimate);
            }
        }
Exemple #11
0
        public void VerifyStatName_MatchesCalculator()
        {
            string          statName           = "TestStatName";
            IStatCalculator mockStatCalculator = Substitute.For <IStatCalculator>();

            mockStatCalculator.GetStatName(Arg.Any <string>()).Returns(statName);

            UnitStatPM testPM = new UnitStatPM(Substitute.For <IUnit>(), "TestStat", mockStatCalculator);

            Assert.AreEqual(testPM.ViewModel.GetPropertyValue <string>(UnitStatPM.STAT_NAME_PROPERTY), statName);
        }
Exemple #12
0
        public void VerifyGuildBonus_MatchesStatCalculator()
        {
            int             bonusValue         = 111;
            IStatCalculator mockStatCalculator = Substitute.For <IStatCalculator>();

            mockStatCalculator.GetStatBonusFromSource(Arg.Any <IUnit>(), Arg.Any <string>(), Arg.Any <StatBonusSources>()).Returns(bonusValue);

            UnitStatPM testPM = new UnitStatPM(Substitute.For <IUnit>(), "TestStat", mockStatCalculator);

            Assert.AreEqual(testPM.ViewModel.GetPropertyValue <int>(UnitStatPM.STAT_GUILD_BONUS_PROPERTY), bonusValue);
        }
Exemple #13
0
        private void CalculateStatistics(IStatCalculator stats)
        {
            foreach (Issue issue in openIssues.Concat(closedIssues).Where(i => !GithubConventions.IsPartnerIssue(i)))
            {
                float devEstimate;
                float testEstimate;

                GithubConventions.ParseEstimates(issue, stats, out devEstimate, out testEstimate);
                stats.AddIssue(issue, devEstimate, testEstimate);
            }
        }
Exemple #14
0
        public void VerifyStatTotal_MatchesCalculator()
        {
            int             totalValue         = 111;
            IStatCalculator mockStatCalculator = Substitute.For <IStatCalculator>();

            mockStatCalculator.GetTotalStatFromUnit(Arg.Any <IUnit>(), Arg.Any <string>()).Returns(totalValue);

            UnitStatPM testPM = new UnitStatPM(Substitute.For <IUnit>(), "TestStat", mockStatCalculator);

            Assert.AreEqual(testPM.ViewModel.GetPropertyValue <int>(UnitStatPM.STAT_TOTAL_PROPERTY), totalValue);
        }
        private void SetStatCalculator()
        {
            List <IUnit> testList = new List <IUnit>();

            testList.Add(mTestUnit);

            IStatCalculator calculator = Substitute.For <IStatCalculator>();

            calculator.GetUnitsWithStat(Arg.Any <string>()).Returns(testList);

            StatCalculator.Instance = calculator;
        }
        private void Output(IStatCalculator stats)
        {
            bool errorHeaderWritten = false;

            var errors = stats.Errors
                         .GroupBy(e => e.Issue.Number);

            foreach (var group in errors)
            {
                if (!errorHeaderWritten)
                {
                    WriteErrorHeader();
                    errorHeaderWritten = true;
                }
                WriteErrors(group);
            }
        }
        private void Output(IStatCalculator stats)
        {
            bool errorHeaderWritten = false;

            var errors = stats.Errors
                .GroupBy(e => e.Issue.Number);

            foreach (var group in errors)
            {
                if (!errorHeaderWritten)
                {
                    WriteErrorHeader();
                    errorHeaderWritten = true;
                }
                WriteErrors(group);
            }
        }
        public static void ParseEstimates(Issue issue, IStatCalculator stats, out float devEstimate, out float testEstimate)
        {
            Match devMatches = devEstimateRegex.Match(issue.Body);
            Match testMatches = testEstimateRegex.Match(issue.Body);

            if (!devMatches.Success)
            {
                stats.AddError(issue, "Dev estimate not found in issue");
            }

            if (!testMatches.Success)
            {
                stats.AddError(issue, "Test estimate not found in issue");
            }

            float.TryParse(devMatches.Groups["estimate"].Value, out devEstimate);
            float.TryParse(testMatches.Groups["estimate"].Value, out testEstimate);
        }
Exemple #19
0
        public static void ParseEstimates(Issue issue, IStatCalculator stats, out float devEstimate, out float testEstimate)
        {
            Match devMatches  = devEstimateRegex.Match(issue.Body);
            Match testMatches = testEstimateRegex.Match(issue.Body);

            if (!devMatches.Success)
            {
                stats.AddError(issue, "Dev estimate not found in issue");
            }

            if (!testMatches.Success)
            {
                stats.AddError(issue, "Test estimate not found in issue");
            }

            float.TryParse(devMatches.Groups["estimate"].Value, out devEstimate);
            float.TryParse(testMatches.Groups["estimate"].Value, out testEstimate);
        }
Exemple #20
0
        private static void Main(string[] args)
        {
            IStatCalculator stats      = null;
            bool            showErrors = true;
            bool            showHelp   = false;

            var p = new OptionSet
            {
                { "b|burndown", "Get burndown chart data", v => {
                      stats = new BurndownStats();
                  } },
                { "c|cfd", "Get cumulative flow chart data", v => { stats = new CumulativeFlowStats(); } },
                { "t|table", "Summarize issues in sprint", v => { stats = new ContentTableStats(); } },
                { "e|errors", "Turn on or off list of issues with state errors (defaults to on)",
                  v => { showErrors = v != null; } },
                { "h|?|help", "Display this help message", v => showHelp = v != null }
            };
            List <String> extras = p.Parse(args);

            if (showHelp)
            {
                ShowHelp(p);
                return;
            }

            IList <Tuple <string, string> > repos = GetRepoNames(extras);

            if (stats == null)
            {
                stats = new BurndownStats();
            }

            var program = new Program(stats, repos, showErrors);

            program.Go();
        }
Exemple #21
0
 public Simulator(IStatCalculator statCalculator,
                  IGetStatMethods getStatMethods)
 {
     this._statCalculator = statCalculator;
     this._getStatMethods = getStatMethods;
 }
Exemple #22
0
 public Monster(IStatCalculator calculator)
 {
     _calculator = calculator;
 }
Exemple #23
0
 private void WriteHeader(string label, IStatCalculator stats)
 {
     output.WriteLine("{0}: Repository {1}, milestone {2}",
                      label, stats.RepoName, stats.Milestone);
 }
 private void WriteHeader(string label, IStatCalculator stats)
 {
     output.WriteLine("{0}: Repository {1}, milestone {2}",
         label, stats.RepoName, stats.Milestone);
 }