public virtual void collectorDifferentArrayLengths() { IList <CurrencyAmountArray> arrays = ImmutableList.of(CurrencyAmountArray.of(USD, DoubleArray.of(10, 20, 30)), CurrencyAmountArray.of(GBP, DoubleArray.of(1, 2))); //JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter: assertThrowsIllegalArg(() => arrays.collect(toMultiCurrencyAmountArray())); }
public virtual void test_minus_currencyAmount() { DoubleArray values = DoubleArray.of(1, 2, 3); CurrencyAmountArray array = CurrencyAmountArray.of(GBP, values); CurrencyAmountArray result = array.minus(CurrencyAmount.of(GBP, 0.5)); assertThat(result).isEqualTo(CurrencyAmountArray.of(GBP, DoubleArray.of(0.5, 1.5, 2.5))); }
public virtual void test_convertedTo_missingFxRate() { DoubleArray values = DoubleArray.of(1, 2, 3); CurrencyAmountArray test = CurrencyAmountArray.of(GBP, values); FxRate fxRate = FxRate.of(EUR, USD, 1.61); assertThrows(() => test.convertedTo(USD, fxRate), typeof(System.ArgumentException)); }
//------------------------------------------------------------------------- public virtual void coverage() { DoubleArray values = DoubleArray.of(1, 2, 3); CurrencyAmountArray test = CurrencyAmountArray.of(GBP, values); coverImmutableBean(test); DoubleArray values2 = DoubleArray.of(1, 2, 3); CurrencyAmountArray test2 = CurrencyAmountArray.of(USD, values2); coverBeanEquals(test, test2); }
public virtual void test_convertedTo_noConversionNecessary() { DoubleArray values = DoubleArray.of(1, 2, 3); CurrencyAmountArray test = CurrencyAmountArray.of(GBP, values); FxRate fxRate = FxRate.of(GBP, USD, 1.61); CurrencyAmountArray convertedList = test.convertedTo(GBP, fxRate); assertThat(convertedList).isEqualTo(test); }
public virtual void total() { IList <CurrencyAmountArray> arrays = ImmutableList.of(CurrencyAmountArray.of(USD, DoubleArray.of(10, 20, 30)), CurrencyAmountArray.of(USD, DoubleArray.of(5, 6, 7)), CurrencyAmountArray.of(EUR, DoubleArray.of(2, 4, 6)), CurrencyAmountArray.of(GBP, DoubleArray.of(11, 12, 13)), CurrencyAmountArray.of(GBP, DoubleArray.of(1, 2, 3))); IDictionary <Currency, DoubleArray> expectedMap = ImmutableMap.of(USD, DoubleArray.of(15, 26, 37), EUR, DoubleArray.of(2, 4, 6), GBP, DoubleArray.of(12, 14, 16)); MultiCurrencyAmountArray expected = MultiCurrencyAmountArray.of(expectedMap); assertThat(MultiCurrencyAmountArray.total(arrays)).isEqualTo(expected); }
public virtual void collector() { IList <CurrencyAmountArray> arrays = ImmutableList.of(CurrencyAmountArray.of(USD, DoubleArray.of(10, 20, 30)), CurrencyAmountArray.of(USD, DoubleArray.of(5, 6, 7)), CurrencyAmountArray.of(EUR, DoubleArray.of(2, 4, 6)), CurrencyAmountArray.of(GBP, DoubleArray.of(11, 12, 13)), CurrencyAmountArray.of(GBP, DoubleArray.of(1, 2, 3))); IDictionary <Currency, DoubleArray> expectedMap = ImmutableMap.of(USD, DoubleArray.of(15, 26, 37), EUR, DoubleArray.of(2, 4, 6), GBP, DoubleArray.of(12, 14, 16)); MultiCurrencyAmountArray expected = MultiCurrencyAmountArray.of(expectedMap); //JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter: assertThat(arrays.collect(toMultiCurrencyAmountArray())).isEqualTo(expected); }
//------------------------------------------------------------------------- public virtual void test_convertedTo() { DoubleArray values = DoubleArray.of(1, 2, 3); CurrencyAmountArray test = CurrencyAmountArray.of(GBP, values); FxRate fxRate = FxRate.of(GBP, USD, 1.61); CurrencyAmountArray convertedList = test.convertedTo(USD, fxRate); DoubleArray expectedValues = DoubleArray.of(1 * 1.61, 2 * 1.61, 3 * 1.61); CurrencyAmountArray expectedList = CurrencyAmountArray.of(USD, expectedValues); assertThat(convertedList).isEqualTo(expectedList); }
public virtual void test_of_function() { IList<CurrencyAmount> values = ImmutableList.of(CurrencyAmount.of(GBP, 1), CurrencyAmount.of(GBP, 2), CurrencyAmount.of(GBP, 3)); CurrencyAmountArray test = CurrencyAmountArray.of(3, i => values[i]); assertThat(test.Currency).isEqualTo(GBP); assertThat(test.Values).isEqualTo(DoubleArray.of(1d, 2d, 3d)); assertThat(test.size()).isEqualTo(3); assertThat(test.get(0)).isEqualTo(CurrencyAmount.of(GBP, 1)); assertThat(test.get(1)).isEqualTo(CurrencyAmount.of(GBP, 2)); assertThat(test.get(2)).isEqualTo(CurrencyAmount.of(GBP, 3)); assertThat(test.ToList()).containsExactly(CurrencyAmount.of(GBP, 1), CurrencyAmount.of(GBP, 2), CurrencyAmount.of(GBP, 3)); }
//------------------------------------------------------------------------- public virtual void test_of_CurrencyDoubleArray() { DoubleArray values = DoubleArray.of(1, 2, 3); CurrencyAmountArray test = CurrencyAmountArray.of(GBP, values); assertThat(test.Currency).isEqualTo(GBP); assertThat(test.Values).isEqualTo(values); assertThat(test.size()).isEqualTo(3); assertThat(test.get(0)).isEqualTo(CurrencyAmount.of(GBP, 1)); assertThat(test.get(1)).isEqualTo(CurrencyAmount.of(GBP, 2)); assertThat(test.get(2)).isEqualTo(CurrencyAmount.of(GBP, 3)); assertThat(test.ToList()).containsExactly(CurrencyAmount.of(GBP, 1), CurrencyAmount.of(GBP, 2), CurrencyAmount.of(GBP, 3)); }
//------------------------------------------------------------------------- public virtual void test_plus() { IList<CurrencyAmount> values = ImmutableList.of(CurrencyAmount.of(GBP, 1), CurrencyAmount.of(USD, 2), CurrencyAmount.of(GBP, 3)); assertThrowsIllegalArg(() => CurrencyAmountArray.of(3, i => values[i])); }
public virtual void test_of_CurrencyList_mixedCurrency() { IList<CurrencyAmount> values = ImmutableList.of(CurrencyAmount.of(GBP, 1), CurrencyAmount.of(USD, 2), CurrencyAmount.of(GBP, 3)); assertThrowsIllegalArg(() => CurrencyAmountArray.of(values)); }
public virtual void test_serialization() { CurrencyAmountArray test = CurrencyAmountArray.of(GBP, DoubleArray.of(1, 2, 3)); assertSerialization(test); }