public CreditCardBill GetNextBill(MonthYear monthYear)
        {
            MonthYear nextMonthYear = monthYear.GetNextMonthYear();

            return(Bills
                   .Where(x => x.DueDate.Year == nextMonthYear.Year && x.DueDate.Month == nextMonthYear.Month)
                   .SingleOrDefault());
        }
        public void ShouldReturnNextMonthYear(int year, int month, int nextYear, int nextMonth)
        {
            // Arrange
            MonthYear monthYear = MonthYear.Create(year, month);

            // Act
            MonthYear nextMonthYear = monthYear.GetNextMonthYear();

            // Assert
            Assert.Equal(MonthYear.Create(nextYear, nextMonth), nextMonthYear);
        }
        public IReadOnlyList <CreditCard> GetList(MonthYear monthYear)
        {
            bool reloadList  = false;
            var  creditCards = creditCardRepository.GetList(monthYear);

            foreach (var creditCard in creditCards)
            {
                reloadList |= CreateBillIfNotExists(creditCard, monthYear);
                reloadList |= CreateBillIfNotExists(creditCard, monthYear.GetNextMonthYear());
            }

            return(reloadList ? creditCardRepository.GetList(monthYear) : creditCards);
        }