Exemple #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "name") public void test_extendedEnum(IborFutureConvention convention, String name)
        public virtual void test_extendedEnum(IborFutureConvention convention, string name)
        {
            IborFutureConvention.of(name);     // ensures map is populated
            ImmutableMap <string, IborFutureConvention> map = IborFutureConvention.extendedEnum().lookupAll();

            assertEquals(map.get(name), convention);
        }
Exemple #2
0
        private static CurveNode curveIborFutureCurveNode(string conventionStr, string timeStr, string label, QuoteId quoteId, double spread, CurveNodeDate date, CurveNodeDateOrder order)
        {
            Matcher matcher = FUT_TIME_REGEX.matcher(timeStr.ToUpper(Locale.ENGLISH));

            if (matcher.matches())
            {
                Period periodToStart            = Period.parse("P" + matcher.group(1));
                int    sequenceNumber           = int.Parse(matcher.group(2));
                IborFutureConvention convention = IborFutureConvention.of(conventionStr);
                IborFutureTemplate   template   = IborFutureTemplate.of(periodToStart, sequenceNumber, convention);
                return(IborFutureCurveNode.builder().template(template).rateId(quoteId).additionalSpread(spread).label(label).date(date).dateOrder(order).build());
            }
            Matcher matcher2 = FUT_MONTH_REGEX.matcher(timeStr.ToUpper(Locale.ENGLISH));

            if (matcher2.matches())
            {
                YearMonth            yearMonth  = YearMonth.parse(matcher2.group(1), YM_FORMATTER);
                IborFutureConvention convention = IborFutureConvention.of(conventionStr);
                IborFutureTemplate   template   = IborFutureTemplate.of(yearMonth, convention);
                return(IborFutureCurveNode.builder().template(template).rateId(quoteId).additionalSpread(spread).label(label).date(date).dateOrder(order).build());
            }
            throw new System.ArgumentException(Messages.format("Invalid time format for Ibor Future: {}", timeStr));
        }
Exemple #3
0
 public virtual void test_of_lookup_null()
 {
     assertThrowsIllegalArg(() => IborFutureConvention.of((string)null));
 }
Exemple #4
0
 public virtual void test_of_lookup_notFound()
 {
     assertThrowsIllegalArg(() => IborFutureConvention.of("Rubbish"));
 }
Exemple #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "name") public void test_of_lookup(IborFutureConvention convention, String name)
        public virtual void test_of_lookup(IborFutureConvention convention, string name)
        {
            assertEquals(IborFutureConvention.of(name), convention);
        }