public void DateTimeFuncsExceptionTest(int sYear, int sMonth, int sDay,
                                               int eYear, int eMonth, int eDay)
        {
            // Arrange
            DateTime startDate = new DateTime(sYear, sMonth, sDay);
            DateTime endDate   = new DateTime(eYear, eMonth, eDay);


            // Assert
            Assert.Throws <Exception>(() => { CustomDateTime.DatesDifference(startDate, endDate); });
        }
        public void DateTimeFuncsDays(int sYear, int sMonth, int sDay,
                                      int eYear, int eMonth, int eDay,
                                      int days)
        {
            // Arrange
            DateTime startDate = new DateTime(sYear, sMonth, sDay);
            DateTime endDate   = new DateTime(eYear, eMonth, eDay);


            // Act
            var result = CustomDateTime.DatesDifference(startDate, endDate);

            // Assert
            Assert.AreEqual(result, days);
        }
Beispiel #3
0
 private bool LessThan30Days(DateTime startDate, DateTime endDate)
 {
     try
     {
         if (CustomDateTime.DatesDifference(startDate, endDate) <= 30 && CustomDateTime.DatesDifference(startDate, endDate) >= 1)
         {
             return(true);
         }
         return(false);
     }
     catch (Exception)
     {
         throw;
     }
 }