public virtual void test_of_notNegative() { assertThrowsIllegalArg(() => Tenor.of(Period.ofDays(-1))); assertThrowsIllegalArg(() => Tenor.ofDays(-1)); assertThrowsIllegalArg(() => Tenor.ofWeeks(-1)); assertThrowsIllegalArg(() => Tenor.ofMonths(-1)); assertThrowsIllegalArg(() => Tenor.ofYears(-1)); }
//------------------------------------------------------------------------- public virtual void test_compare() { IList <Tenor> tenors = ImmutableList.of(Tenor.ofDays(1), Tenor.ofDays(3), Tenor.ofDays(7), Tenor.ofWeeks(2), Tenor.ofWeeks(4), Tenor.ofDays(30), Tenor.ofMonths(1), Tenor.ofDays(31), Tenor.of(Period.of(0, 1, 1)), Tenor.ofDays(60), Tenor.ofMonths(2), Tenor.ofDays(61), Tenor.ofDays(91), Tenor.ofMonths(3), Tenor.ofDays(92), Tenor.ofDays(182), Tenor.ofMonths(6), Tenor.ofDays(183), Tenor.ofDays(365), Tenor.ofYears(1), Tenor.ofDays(366)); IList <Tenor> test = new List <Tenor>(tenors); Collections.shuffle(test); test.Sort(); assertEquals(test, tenors); }
public virtual void test_of_int() { assertEquals(Tenor.ofDays(1), TENOR_1D); assertEquals(Tenor.ofDays(7), TENOR_1W); assertEquals(Tenor.ofWeeks(2), TENOR_2W); assertEquals(Tenor.ofMonths(1), TENOR_1M); assertEquals(Tenor.ofMonths(15), TENOR_15M); assertEquals(Tenor.ofMonths(18), TENOR_18M); assertEquals(Tenor.ofMonths(21), TENOR_21M); assertEquals(Tenor.ofYears(1), TENOR_1Y); assertEquals(Tenor.ofYears(35), TENOR_35Y); assertEquals(Tenor.ofYears(40), TENOR_40Y); assertEquals(Tenor.ofYears(45), TENOR_45Y); assertEquals(Tenor.ofYears(50), TENOR_50Y); }
//------------------------------------------------------------------------- //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @DataProvider(name = "based") public static Object[][] data_based() public static object[][] data_based() { return(new object[][] { new object[] { Tenor.ofDays(1), false, false }, new object[] { Tenor.ofDays(2), false, false }, new object[] { Tenor.ofDays(6), false, false }, new object[] { Tenor.ofDays(7), true, false }, new object[] { Tenor.ofWeeks(1), true, false }, new object[] { Tenor.ofWeeks(3), true, false }, new object[] { Tenor.ofMonths(1), false, true }, new object[] { Tenor.ofMonths(3), false, true }, new object[] { Tenor.ofYears(1), false, true }, new object[] { Tenor.ofYears(3), false, true }, new object[] { Tenor.of(Period.of(1, 2, 3)), false, false } }); }
//------------------------------------------------------------------------- public virtual void test_equals_hashCode() { Tenor a1 = TENOR_3D; Tenor a2 = Tenor.ofDays(3); Tenor b = TENOR_4M; assertEquals(a1.Equals(a1), true); assertEquals(a1.Equals(b), false); assertEquals(a1.Equals(a2), true); assertEquals(a2.Equals(a1), true); assertEquals(a2.Equals(a2), true); assertEquals(a2.Equals(b), false); assertEquals(b.Equals(a1), false); assertEquals(b.Equals(a2), false); assertEquals(b.Equals(b), true); assertEquals(a1.GetHashCode(), a2.GetHashCode()); }