Ejemplo n.º 1
0
        public void GivenCardsWithLabelListExpectMatchingNumberOfCardsWithLabel()
        {
            var expectedCardCount = 5;

            var labelName = "label name";
            var weekStats = new TrelloStats.Model.Stats.WeekStats();
            weekStats.Cards = CreateCardStats(ConfigurationFactory.DEFAULT_IN_TEST_LIST_NAME, expectedCardCount);
            weekStats.Cards.ToList().ForEach(c=>c.CardData.Card.Labels = new List<TrelloNet.Card.Label>(){ new TrelloNet.Card.Label(){Name = labelName}});

            Assert.AreEqual(expectedCardCount, weekStats.GetNumberOfCardsWithLabel(labelName));
        }
Ejemplo n.º 2
0
        private string GetWeekStatsHtmlRow(WeekStats w, BoardStatsAnalysis boardStatsAnalysis)
        {
            var row = new StringBuilder("<tr>");
            row.AppendLine(GetWeekStatsRow(w.WeekNumber));

            row.AppendLine(GetWeekStatsRow(w.StartDate.ToShortDateString(), "date"));
            row.AppendLine(GetWeekStatsRow(w.EndDate.ToShortDateString(), "date"));
            row.AppendLine(GetWeekStatsRow(GetNumberForTableDisplay(w.NumberOfCardsInProgress),"text-center"));
            row.AppendLine(GetWeekStatsRow(GetNumberForTableDisplay(w.NumberOfCardsInTest),"text-center"));

            row.AppendLine(GetWeekStatsRow(GetNumberForTableDisplay(w.NumberOfCompletedCards),"text-center"));

            foreach (var labelName in _configuration.LabelNames)
            {
                var labelNameSet = labelName.Split('/');
                if (labelNameSet.Length > 1)
                {
                    var value1 = w.GetNumberOfCardsWithLabel(labelNameSet[0]);
                    var value2 = w.GetNumberOfCardsWithLabel(labelNameSet[1]);
                    var valueSet = String.Format("{0}/{1}", value1, value2);
                    row.AppendLine(GetWeekStatsRow(valueSet,"text-center"));
                }
                else
                {
                    row.AppendLine(GetWeekStatsRow(GetNumberForTableDisplay(w.GetNumberOfCardsWithLabel(labelName)),"text-center"));
                }
            }

            row.AppendLine(GetWeekStatsRow(w.PointsCompleted,"text-center"));

            var hoursString = string.Format("{0}/{1}",Math.Ceiling(w.TotalHours),Math.Ceiling(w.TotalExcludedHours));
            row.AppendLine(GetWeekStatsRow(hoursString, "text-center"));

            row.Append("</tr>");

            return row.ToString();
        }