private static IDictionary <CurveName, LoadedCurveSettings> parseCurveSettings(CharSource settingsResource) { ImmutableMap.Builder <CurveName, LoadedCurveSettings> builder = ImmutableMap.builder(); CsvFile csv = CsvFile.of(settingsResource, true); foreach (CsvRow row in csv.rows()) { string curveNameStr = row.getField(SETTINGS_CURVE_NAME); string valueTypeStr = row.getField(SETTINGS_VALUE_TYPE); string dayCountStr = row.getField(SETTINGS_DAY_COUNT); string interpolatorStr = row.getField(SETTINGS_INTERPOLATOR); string leftExtrapolatorStr = row.getField(SETTINGS_LEFT_EXTRAPOLATOR); string rightExtrapolatorStr = row.getField(SETTINGS_RIGHT_EXTRAPOLATOR); if (!VALUE_TYPE_MAP.containsKey(valueTypeStr.ToLower(Locale.ENGLISH))) { throw new System.ArgumentException(Messages.format("Unsupported {} in curve settings: {}", SETTINGS_VALUE_TYPE, valueTypeStr)); } CurveName curveName = CurveName.of(curveNameStr); ValueType valueType = VALUE_TYPE_MAP.get(valueTypeStr.ToLower(Locale.ENGLISH)); CurveInterpolator interpolator = CurveInterpolator.of(interpolatorStr); CurveExtrapolator leftExtrap = CurveExtrapolator.of(leftExtrapolatorStr); CurveExtrapolator rightExtrap = CurveExtrapolator.of(rightExtrapolatorStr); // ONE_ONE day count is not used DayCount dayCount = LoaderUtils.parseDayCount(dayCountStr); LoadedCurveSettings settings = LoadedCurveSettings.of(curveName, ValueType.YEAR_FRACTION, valueType, dayCount, interpolator, leftExtrap, rightExtrap); builder.put(curveName, settings); } return(builder.build()); }
public virtual void test_of_lookup_null() { assertThrowsIllegalArg(() => CurveInterpolator.of(null)); }
//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(CurveInterpolator convention, String name) public virtual void test_of_lookup(CurveInterpolator convention, string name) { assertEquals(CurveInterpolator.of(name), convention); }
public virtual void test_of_lookup_notFound() { assertThrowsIllegalArg(() => CurveInterpolator.of("Rubbish")); }