示例#1
0
        public void GivenOneAddedCardExpectGoodCardCountIsOne()
        {
            var boardStats = new BoardStats();
            boardStats.AddGoodCardStat(CardStatsFactory.GetCardStats(new List<TrelloNet.Action>()));

            Assert.AreEqual(1, boardStats.CardStats.Count);
        }
        public BoardStatsAnalysis BuildBoardStatsAnalysis(TrelloData trelloData, List<TimesheetData> timesheetData)
        {
            var boardStats = new BoardStats();
            BuildCardStats(trelloData, boardStats);
            boardStats.ListStats = GetListStats(trelloData.ListsToCount);
            boardStats.TimesheetData = timesheetData;
            boardStats.ProjectStartDate = ProjectStartDate;
            var boardStatsAnalysis = new BoardStatsAnalysis(_configuration, boardStats);

            boardStatsAnalysis.NextMilestoneProjection = BuildProjectionsForNextMilestone(trelloData, boardStatsAnalysis);
            boardStatsAnalysis.Projections = BuildProjections(trelloData, boardStatsAnalysis);

            if (trelloData.MilestoneList != null)
            {
                var milestones = new List<Milestone>();
                foreach (var card in trelloData.MilestoneList.CardDataCollection)
                {

                    if (card.Card.Due.HasValue)
                    {
                        milestones.Add(new Milestone() { Name = card.Card.Name, TargetDate = card.Card.Due.Value });
                    }
                }
                boardStatsAnalysis.Milestones = milestones;
            }

            return boardStatsAnalysis;
        }
        private void BuildCardStats(TrelloData trelloData, BoardStats boardStats)
        {
            foreach (var listData in trelloData.ListDataCollection)
            {
                foreach (var cardData in listData.CardDataCollection)
                {
                    var stat = new CardStats() { CardData = cardData, ListData = listData, ListNames = _configuration.ListNames, TimeZone = _configuration.TimeZone };

                    if (stat.IsComplete || stat.IsInProgress || stat.IsInTest)
                        boardStats.AddGoodCardStat(stat);
                    else
                        boardStats.AddBadCardStat(stat);
                }
            }
        }
 public BoardStatsAnalysis(TrelloStatsConfiguration configuration, BoardStats boardStats)
 {
     BoardStats = boardStats;
     _configuration = configuration;
     Milestones = new List<Milestone>();
 }