Пример #1
0
        public void ShouldConvertPercent(
            int itemPercentage,
            int totalPercentage,
            string expected)
        {
            // Arrange
            // Act
            var result = BrailleProgressBarGenerator.CompositeProgressBarFor(
                itemPercentage,
                totalPercentage);

            // Assert
            Expect(result)
            .To.Equal(expected);
        }
Пример #2
0
        protected override void ReportIntermediateState(
            NotificationDetails details)
        {
            _notificationDetailHistory.Enqueue(details);
            if (_notificationDetailHistory.Count > HISTORY_SIZE)
            {
                _notificationDetailHistory.Dequeue();
            }

            if (ShouldWaitToOutput())
            {
                return;
            }

            var last         = _notificationDetailHistory.Last();
            var rate         = EstimateRate();
            var itemEtr      = EstimateItemTimeRemaining(last, rate);
            var totalEtr     = EstimateTotalTimeRemaining(last, rate);
            var readableRate = HumanReadableRateFor(rate);

            Rewrite(
                details.Label,
                string.Join(" · ",
                            new[]
            {
                readableRate,
                itemEtr,
                totalEtr,
                BrailleProgressBarGenerator.CompositeProgressBarFor(
                    details.CurrentPercentageCompleteBySize,
                    details.TotalPercentageCompleteBySize
                    ) + " "
            }.Where(s => s != "")
                            )
                );
        }