public List <Count> GetCardCountByDayFrom(int numberOfDays)
        {
            if (IsClearCache(numberOfDays))
            {
                CacheHelper.ClearObjectFromCache(Card.CacheKey);
            }

            var fromDate = GetFromDate(numberOfDays);

            var days = Enumerable.Range(0, 1 + _tellTheTime.Now().Subtract(fromDate).Days)
                       .Select(o => fromDate.AddDays(o)).ToList();

            return((from day in days
                    let countByDay = GetCardCountsFor(AllPredicateFor(day))
                                     let doneCountByDay = GetCardCountsFor(DonePredicateFor(day))
                                                          let reworkCountByDay = GetCardCountsFor(AllDefectsNotDoneFor(day))
                                                                                 select new Count
            {
                Date = day,
                DoneTotal = doneCountByDay,
                Total = countByDay,
                Rate = Calculator.Percentage(reworkCountByDay, countByDay)
            })
                   .ToList());
        }
        public void Setup()
        {
            _tellTheTime = Substitute.For <ITellTheTime>();
            _build       = Substitute.For <IBuild>();

            _tellTheTime.Today().Returns(new DateTime(2017, 12, 04));
            _tellTheTime.Now().Returns(new DateTime(2017, 12, 04));
        }
예제 #3
0
        public void Setup()
        {
            _tellTheTime = Substitute.For <ITellTheTime>();
            _card        = Substitute.For <ICard>();

            _tellTheTime.Now().Returns(new DateTime(2017, 10, 05));
            _card.GetCards().Returns(GetCards());
        }
        public void Setup()
        {
            var builds = GetBuildDataFrom(new DateTime(2017, 01, 01), 300);

            _build       = Substitute.For <IBuild>();
            _tellTheTime = Substitute.For <ITellTheTime>();

            _build.GetBuilds().Returns(builds);
            _build.GetSuccessfulBuildStepsContaining(Arg.Any <string>()).Returns(
                builds
                .Where(b =>
                       b.BuildTypeId.Contains("_01") &&
                       b.Status.Equals(BuildStatus.Success.ToString()) &&
                       b.State.Equals("Finished", StringComparison.InvariantCultureIgnoreCase))
                .ToList());

            _tellTheTime.Today().Returns(new DateTime(2017, 11, 27));
            _tellTheTime.Now().Returns(new DateTime(2017, 11, 27));

            _buildThroughput = new BuildThroughput(_build, _tellTheTime);
        }