public virtual void test_ofDayOfMonth_matches_Day30() { assertEquals(RollConvention.ofDayOfMonth(30).matches(date(2016, JANUARY, 29)), false); assertEquals(RollConvention.ofDayOfMonth(30).matches(date(2016, JANUARY, 30)), true); assertEquals(RollConvention.ofDayOfMonth(30).matches(date(2016, JANUARY, 31)), false); assertEquals(RollConvention.ofDayOfMonth(30).matches(date(2016, FEBRUARY, 28)), false); assertEquals(RollConvention.ofDayOfMonth(30).matches(date(2016, FEBRUARY, 29)), true); assertEquals(RollConvention.ofDayOfMonth(30).matches(date(2015, FEBRUARY, 27)), false); assertEquals(RollConvention.ofDayOfMonth(30).matches(date(2015, FEBRUARY, 28)), true); }
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); } } }
//------------------------------------------------------------------------- public virtual void test_ofDayOfMonth() { for (int i = 1; i < 30; i++) { RollConvention test = RollConvention.ofDayOfMonth(i); assertEquals(test.adjust(date(2014, JULY, 1)), date(2014, JULY, i)); assertEquals(test.Name, "Day" + i); assertEquals(test.ToString(), "Day" + i); assertSame(RollConvention.of(test.Name), test); assertSame(RollConvention.of("DAY" + i), test); } }
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); } } }
public virtual void test_ofDayOfMonth_adjust_Day30() { assertEquals(RollConvention.ofDayOfMonth(30).adjust(date(2014, FEBRUARY, 2)), date(2014, FEBRUARY, 28)); assertEquals(RollConvention.ofDayOfMonth(30).adjust(date(2016, FEBRUARY, 2)), date(2016, FEBRUARY, 29)); }
public virtual void test_ofDayOfMonth_invalid() { assertThrowsIllegalArg(() => RollConvention.ofDayOfMonth(0)); assertThrowsIllegalArg(() => RollConvention.ofDayOfMonth(32)); }
public virtual void test_ofDayOfMonth_31() { assertEquals(RollConvention.ofDayOfMonth(31), EOM); }
//------------------------------------------------------------------------- //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @DataProvider(name = "roll") public static Object[][] data_roll() public static object[][] data_roll() { return(new object[][] { new object[] { NONE, date(2014, JANUARY, 14), date(2014, AUGUST, 16), P1M, false, DAY_14 }, new object[] { NONE, date(2014, JANUARY, 14), date(2014, AUGUST, 16), P1M, true, DAY_14 }, new object[] { NONE, date(2014, JANUARY, 14), date(2014, AUGUST, 16), P2W, false, DAY_TUE }, new object[] { NONE, date(2014, JANUARY, 14), date(2014, AUGUST, 16), P2W, true, DAY_TUE }, new object[] { NONE, date(2014, JANUARY, 14), date(2014, AUGUST, 16), TERM, false, RollConventions.NONE }, new object[] { NONE, date(2014, JANUARY, 14), date(2014, AUGUST, 16), TERM, true, RollConventions.NONE }, new object[] { NONE, date(2014, JANUARY, 31), date(2014, APRIL, 30), P1M, true, RollConventions.EOM }, new object[] { NONE, date(2014, APRIL, 30), date(2014, AUGUST, 31), P1M, true, RollConventions.EOM }, new object[] { NONE, date(2014, APRIL, 30), date(2014, FEBRUARY, 28), P1M, true, RollConventions.EOM }, new object[] { NONE, date(2016, FEBRUARY, 29), date(2019, FEBRUARY, 28), P6M, true, RollConventions.EOM }, new object[] { NONE, date(2015, FEBRUARY, 28), date(2016, FEBRUARY, 29), P6M, true, RollConventions.EOM }, new object[] { NONE, date(2015, APRIL, 30), date(2016, FEBRUARY, 29), P1M, true, RollConventions.EOM }, new object[] { NONE, date(2016, MARCH, 31), date(2017, MARCH, 27), P6M, true, RollConventions.EOM }, new object[] { NONE, date(2016, MARCH, 16), date(2016, MARCH, 31), P6M, true, RollConvention.ofDayOfMonth(16) }, new object[] { NONE, date(2016, MARCH, 16), date(2017, MARCH, 31), P6M, true, RollConventions.EOM }, new object[] { SHORT_INITIAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), P1M, false, DAY_16 }, new object[] { SHORT_INITIAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), P1M, true, DAY_16 }, new object[] { SHORT_INITIAL, date(2014, JANUARY, 14), date(2014, JUNE, 30), P1M, false, DAY_30 }, new object[] { SHORT_INITIAL, date(2014, JANUARY, 14), date(2014, JUNE, 30), P1M, true, EOM }, new object[] { SHORT_INITIAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), P2W, true, DAY_SAT }, new object[] { SHORT_INITIAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), P2W, true, DAY_SAT }, new object[] { SHORT_INITIAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), TERM, false, RollConventions.NONE }, new object[] { SHORT_INITIAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), TERM, true, RollConventions.NONE }, new object[] { LONG_INITIAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), P1M, false, DAY_16 }, new object[] { LONG_INITIAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), P1M, true, DAY_16 }, new object[] { LONG_INITIAL, date(2014, JANUARY, 14), date(2014, JUNE, 30), P1M, false, DAY_30 }, new object[] { LONG_INITIAL, date(2014, JANUARY, 14), date(2014, JUNE, 30), P1M, true, EOM }, new object[] { LONG_INITIAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), P2W, false, DAY_SAT }, new object[] { LONG_INITIAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), P2W, true, DAY_SAT }, new object[] { LONG_INITIAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), TERM, false, RollConventions.NONE }, new object[] { LONG_INITIAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), TERM, true, RollConventions.NONE }, new object[] { SMART_INITIAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), P1M, false, DAY_16 }, new object[] { SMART_INITIAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), P1M, true, DAY_16 }, new object[] { SMART_INITIAL, date(2014, JANUARY, 14), date(2014, JUNE, 30), P1M, false, DAY_30 }, new object[] { SMART_INITIAL, date(2014, JANUARY, 14), date(2014, JUNE, 30), P1M, true, EOM }, new object[] { SMART_INITIAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), P2W, false, DAY_SAT }, new object[] { SMART_INITIAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), P2W, true, DAY_SAT }, new object[] { SMART_INITIAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), TERM, false, RollConventions.NONE }, new object[] { SMART_INITIAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), TERM, true, RollConventions.NONE }, new object[] { SHORT_FINAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), P1M, false, DAY_14 }, new object[] { SHORT_FINAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), P1M, true, DAY_14 }, new object[] { SHORT_FINAL, date(2014, JUNE, 30), date(2014, AUGUST, 16), P1M, false, DAY_30 }, new object[] { SHORT_FINAL, date(2014, JUNE, 30), date(2014, AUGUST, 16), P1M, true, EOM }, new object[] { SHORT_FINAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), P2W, false, DAY_TUE }, new object[] { SHORT_FINAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), P2W, true, DAY_TUE }, new object[] { SHORT_FINAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), TERM, false, RollConventions.NONE }, new object[] { SHORT_FINAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), TERM, true, RollConventions.NONE }, new object[] { LONG_FINAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), P1M, false, DAY_14 }, new object[] { LONG_FINAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), P1M, true, DAY_14 }, new object[] { LONG_FINAL, date(2014, JUNE, 30), date(2014, AUGUST, 16), P1M, false, DAY_30 }, new object[] { LONG_FINAL, date(2014, JUNE, 30), date(2014, AUGUST, 16), P1M, true, EOM }, new object[] { LONG_FINAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), P2W, false, DAY_TUE }, new object[] { LONG_FINAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), P2W, true, DAY_TUE }, new object[] { LONG_FINAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), TERM, false, RollConventions.NONE }, new object[] { LONG_FINAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), TERM, true, RollConventions.NONE }, new object[] { SMART_FINAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), P1M, false, DAY_14 }, new object[] { SMART_FINAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), P1M, true, DAY_14 }, new object[] { SMART_FINAL, date(2014, JUNE, 30), date(2014, AUGUST, 16), P1M, false, DAY_30 }, new object[] { SMART_FINAL, date(2014, JUNE, 30), date(2014, AUGUST, 16), P1M, true, EOM }, new object[] { SMART_FINAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), P2W, false, DAY_TUE }, new object[] { SMART_FINAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), P2W, true, DAY_TUE }, new object[] { SMART_FINAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), TERM, false, RollConventions.NONE }, new object[] { SMART_FINAL, date(2014, JANUARY, 14), date(2014, AUGUST, 16), TERM, true, RollConventions.NONE }, new object[] { BOTH, date(2014, JANUARY, 14), date(2014, AUGUST, 16), P1M, false, DAY_14 }, new object[] { BOTH, date(2014, JANUARY, 14), date(2014, AUGUST, 16), P1M, true, DAY_14 } }); }