public virtual void emptyAmounts() { MultiCurrencyScenarioArray array = MultiCurrencyScenarioArray.of(MultiCurrencyAmount.empty(), MultiCurrencyAmount.empty()); assertThat(array.ScenarioCount).isEqualTo(2); assertThat(array.get(0)).isEqualTo(MultiCurrencyAmount.empty()); assertThat(array.get(1)).isEqualTo(MultiCurrencyAmount.empty()); }
public virtual void get() { MultiCurrencyAmount expected = MultiCurrencyAmount.of(CurrencyAmount.of(Currency.GBP, 22), CurrencyAmount.of(Currency.USD, 33), CurrencyAmount.of(Currency.EUR, 44)); assertThat(VALUES_ARRAY.get(2)).isEqualTo(expected); assertThrows(() => VALUES_ARRAY.get(3), typeof(System.IndexOutOfRangeException)); assertThrows(() => VALUES_ARRAY.get(-1), typeof(System.IndexOutOfRangeException)); }
public virtual void createByFunction() { MultiCurrencyAmount mca1 = MultiCurrencyAmount.of(CurrencyAmount.of(Currency.GBP, 10), CurrencyAmount.of(Currency.USD, 20)); MultiCurrencyAmount mca2 = MultiCurrencyAmount.of(CurrencyAmount.of(Currency.GBP, 10), CurrencyAmount.of(Currency.EUR, 30)); MultiCurrencyAmount mca3 = MultiCurrencyAmount.of(CurrencyAmount.of(Currency.USD, 40)); IList <MultiCurrencyAmount> amounts = ImmutableList.of(mca1, mca2, mca3); MultiCurrencyScenarioArray test = MultiCurrencyScenarioArray.of(3, i => amounts[i]); assertThat(test.get(0)).isEqualTo(mca1.plus(Currency.EUR, 0)); assertThat(test.get(1)).isEqualTo(mca2.plus(Currency.USD, 0)); assertThat(test.get(2)).isEqualTo(mca3.plus(Currency.GBP, 0).plus(Currency.EUR, 0)); }