示例#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));
 }
        //-------------------------------------------------------------------------
        public virtual void test_of_additionConventionNone()
        {
            TenorAdjustment test = TenorAdjustment.of(Tenor.of(Period.of(1, 2, 3)), PAC_NONE, BDA_NONE);

            assertEquals(test.Tenor, Tenor.of(Period.of(1, 2, 3)));
            assertEquals(test.AdditionConvention, PAC_NONE);
            assertEquals(test.Adjustment, BDA_NONE);
            assertEquals(test.ToString(), "1Y2M3D");
        }
示例#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);
        }
示例#5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "normalized") public void test_normalized(java.time.Period period, java.time.Period normalized)
        public virtual void test_normalized(Period period, Period normalized)
        {
            assertEquals(Tenor.of(period).normalized().Period, normalized);
        }
示例#6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "ofPeriod") public void test_ofPeriod(java.time.Period period, java.time.Period stored, String str)
        public virtual void test_ofPeriod(Period period, Period stored, string str)
        {
            assertEquals(Tenor.of(period).Period, stored);
            assertEquals(Tenor.of(period).ToString(), str);
        }