예제 #1
0
 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));
 }
예제 #2
0
 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);
 }
예제 #3
0
        //-------------------------------------------------------------------------
//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 }
            });
        }
예제 #4
0
        //-------------------------------------------------------------------------
        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);
        }