//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)); }
public virtual void test_ofDayOfWeek_next_oneDay() { foreach (DayOfWeek dow in DayOfWeek.values()) { RollConvention test = RollConvention.ofDayOfWeek(dow); assertEquals(test.next(date(2014, AUGUST, 14), P1D), date(2014, AUGUST, 15).with(TemporalAdjusters.nextOrSame(dow))); } }
public virtual void test_ofDayOfMonth_next_oneMonth() { for (int start = 1; start <= 5; start++) { for (int i = 1; i <= 30; i++) { RollConvention test = RollConvention.ofDayOfMonth(i); LocalDate expected = date(2014, AUGUST, i); assertEquals(test.next(date(2014, JULY, start), P1M), expected); } } }
public virtual void test_ofDayOfMonth_next_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.plusMonths(1); } assertEquals(test.next(date(2014, JULY, start), P1D), expected); } } }
//------------------------------------------------------------------------- /// <summary> /// Resolves the sequence to a list of steps. /// </summary> /// <param name="existingSteps"> the existing list of steps </param> /// <param name="rollConv"> the roll convention </param> /// <returns> the steps </returns> internal IList <ValueStep> resolve(IList <ValueStep> existingSteps, RollConvention rollConv) { ImmutableList.Builder <ValueStep> steps = ImmutableList.builder(); steps.addAll(existingSteps); LocalDate prev = firstStepDate; LocalDate date = firstStepDate; while (!date.isAfter(lastStepDate)) { steps.add(ValueStep.of(date, adjustment)); prev = date; date = rollConv.next(date, frequency); } if (!prev.Equals(lastStepDate)) { throw new System.ArgumentException(Messages.format("ValueStepSequence lastStepDate did not match frequency '{}' using roll convention '{}', {} != {}", frequency, rollConv, lastStepDate, prev)); } return(steps.build()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(dataProvider = "next") public void test_next(RollConvention conv, java.time.LocalDate input, Frequency freq, java.time.LocalDate expected) public virtual void test_next(RollConvention conv, LocalDate input, Frequency freq, LocalDate expected) { assertEquals(conv.next(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)); }