Пример #1
0
 public static CreditCardBill Create(CreditCard creditCard, MonthYear monthYear)
 {
     return(new CreditCardBill()
     {
         ClosingDay = creditCard.ClosingDay,
         CreditCard = creditCard,
         DueDate = monthYear.GetDate(creditCard.PaymentDay),
         Category = creditCard.Category
     });
 }
Пример #2
0
        public void GetDate()
        {
            // Arrange
            int year  = 2018;
            int month = 5;
            int day   = 6;

            MonthYear monthYear = MonthYear.Create(year, month);

            // Act
            DateTime result = monthYear.GetDate(day);

            // Assert
            Assert.Equal(year, result.Year);
            Assert.Equal(month, result.Month);
            Assert.Equal(day, result.Day);
        }
 public void GetDateTestShouldFailIfDayIsInvalid()
 {
     var my = new MonthYear(2, 2001);
     Assert.Throws<ArgumentOutOfRangeException>(() => my.GetDate(29));
 }
 public void ToStringTest()
 {
     var my = new MonthYear(1, 2000);
     var expected = my.GetDate(1).ToString("MM/yyyy");
     var actual = my.ToString();
     Assert.AreEqual(expected, actual);
 }
        public void GetDateTest()
        {
            var date = new DateTime(2000, 1, 14);
            var my = new MonthYear(1, 2000);
            Assert.AreEqual(date, my.GetDate(14));

            date = new DateTime(2000, 2, 29);
            my = new MonthYear(2, 2000);
            Assert.AreEqual(date, my.GetDate(29));
        }