Example #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "types") public void test_null(RollConvention type)
        public virtual void test_null(RollConvention type)
        {
            assertThrowsIllegalArg(() => type.adjust(null));
            assertThrowsIllegalArg(() => type.matches(null));
            assertThrowsIllegalArg(() => type.next(date(2014, JULY, 1), null));
            assertThrowsIllegalArg(() => type.next(null, P3M));
            assertThrowsIllegalArg(() => type.previous(date(2014, JULY, 1), null));
            assertThrowsIllegalArg(() => type.previous(null, P3M));
        }
Example #2
0
 public virtual void test_ofDayOfWeek_previous_oneDay()
 {
     foreach (DayOfWeek dow in DayOfWeek.values())
     {
         RollConvention test = RollConvention.ofDayOfWeek(dow);
         assertEquals(test.previous(date(2014, AUGUST, 14), P1D), date(2014, AUGUST, 13).with(TemporalAdjusters.previousOrSame(dow)));
     }
 }
Example #3
0
 public virtual void test_ofDayOfMonth_previous_oneMonth()
 {
     for (int start = 1; start <= 5; start++)
     {
         for (int i = 1; i <= 30; i++)
         {
             RollConvention test     = RollConvention.ofDayOfMonth(i);
             LocalDate      expected = date(2014, JUNE, i);
             assertEquals(test.previous(date(2014, JULY, start), P1M), expected);
         }
     }
 }
Example #4
0
 public virtual void test_ofDayOfMonth_previous_oneDay()
 {
     for (int start = 1; start <= 5; start++)
     {
         for (int i = 1; i <= 30; i++)
         {
             RollConvention test     = RollConvention.ofDayOfMonth(i);
             LocalDate      expected = date(2014, JULY, i);
             if (i >= start)
             {
                 expected = expected.minusMonths(1);
             }
             assertEquals(test.previous(date(2014, JULY, start), P1D), expected);
         }
     }
 }
Example #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "previous") public void test_previous(RollConvention conv, java.time.LocalDate input, Frequency freq, java.time.LocalDate expected)
        public virtual void test_previous(RollConvention conv, LocalDate input, Frequency freq, LocalDate expected)
        {
            assertEquals(conv.previous(input, freq), expected);
        }
 /// <summary>
 /// Checks if this period is regular according to the specified frequency and roll convention.
 /// <para>
 /// A schedule period is normally created from a frequency and roll convention.
 /// These can therefore be used to determine if the period is regular, which simply
 /// means that the period end date can be generated from the start date and vice versa.
 ///
 /// </para>
 /// </summary>
 /// <param name="frequency">  the frequency </param>
 /// <param name="rollConvention">  the roll convention </param>
 /// <returns> true if the period is regular </returns>
 public bool isRegular(Frequency frequency, RollConvention rollConvention)
 {
     ArgChecker.notNull(frequency, "frequency");
     ArgChecker.notNull(rollConvention, "rollConvention");
     return(rollConvention.next(unadjustedStartDate, frequency).Equals(unadjustedEndDate) && rollConvention.previous(unadjustedEndDate, frequency).Equals(unadjustedStartDate));
 }