public void testTriangulatedLookup() { ExchangeRateManager rateManager = ExchangeRateManager.Instance; rateManager.clear(); Currency EUR = new EURCurrency(), USD = new USDCurrency(), ITL = new ITLCurrency(); ExchangeRate eur_usd1 = new ExchangeRate(EUR, USD, 1.1983); ExchangeRate eur_usd2 = new ExchangeRate(EUR, USD, 1.2042); rateManager.add(eur_usd1, new Date(4, Month.August, 2004)); rateManager.add(eur_usd2, new Date(5, Month.August, 2004)); Money m1 = 50000000.0 * ITL; Money m2 = 100000.0 * USD; Money.conversionType = Money.ConversionType.NoConversion; ExchangeRate itl_usd = rateManager.lookup(ITL, USD, new Date(4, Month.August, 2004)); Money calculated = itl_usd.exchange(m1); Money expected = new Money(m1.value * eur_usd1.rate / 1936.27, USD); if (!Utils.close(calculated, expected)) { Assert.Fail("Wrong result: expected: " + expected + " calculated: " + calculated); } itl_usd = rateManager.lookup(ITL, USD, new Date(5, Month.August, 2004)); calculated = itl_usd.exchange(m1); expected = new Money(m1.value * eur_usd2.rate / 1936.27, USD); if (!Utils.close(calculated, expected)) { Assert.Fail("Wrong result: expected: " + expected + " calculated: " + calculated); } ExchangeRate usd_itl = rateManager.lookup(USD, ITL, new Date(4, Month.August, 2004)); calculated = usd_itl.exchange(m2); expected = new Money(m2.value * 1936.27 / eur_usd1.rate, ITL); if (!Utils.close(calculated, expected)) { Assert.Fail("Wrong result: expected: " + expected + " calculated: " + calculated); } usd_itl = rateManager.lookup(USD, ITL, new Date(5, Month.August, 2004)); calculated = usd_itl.exchange(m2); expected = new Money(m2.value * 1936.27 / eur_usd2.rate, ITL); if (!Utils.close(calculated, expected)) { Assert.Fail("Wrong result: expected: " + expected + " calculated: " + calculated); } }
public void testTriangulatedLookup() { ExchangeRateManager rateManager = ExchangeRateManager.Instance; rateManager.clear(); Currency EUR = new EURCurrency(), USD = new USDCurrency(), ITL = new ITLCurrency(); ExchangeRate eur_usd1 = new ExchangeRate(EUR, USD, 1.1983); ExchangeRate eur_usd2 = new ExchangeRate(EUR, USD, 1.2042); rateManager.Add(eur_usd1, new Date(4,Month.August,2004)); rateManager.Add(eur_usd2, new Date(5,Month.August,2004)); Money m1 = 50000000.0 * ITL; Money m2 = 100000.0 * USD; Money.conversionType = Money.ConversionType.NoConversion; ExchangeRate itl_usd = rateManager.lookup(ITL, USD,new Date(4,Month.August,2004)); Money calculated = itl_usd.exchange(m1); Money expected = new Money(m1.value*eur_usd1.rate/1936.27, USD); if (!Utils.close(calculated, expected)) { Assert.Fail("Wrong result: expected: " + expected + " calculated: " + calculated); } itl_usd = rateManager.lookup(ITL, USD,new Date(5,Month.August,2004)); calculated = itl_usd.exchange(m1); expected = new Money(m1.value*eur_usd2.rate/1936.27, USD); if (!Utils.close(calculated, expected)) { Assert.Fail("Wrong result: expected: " + expected + " calculated: " + calculated); } ExchangeRate usd_itl = rateManager.lookup(USD, ITL, new Date(4, Month.August, 2004)); calculated = usd_itl.exchange(m2); expected = new Money(m2.value*1936.27/eur_usd1.rate, ITL); if (!Utils.close(calculated, expected)) { Assert.Fail("Wrong result: expected: " + expected + " calculated: " + calculated); } usd_itl = rateManager.lookup(USD, ITL, new Date(5, Month.August, 2004)); calculated = usd_itl.exchange(m2); expected = new Money(m2.value*1936.27/eur_usd2.rate, ITL); if (!Utils.close(calculated, expected)) { Assert.Fail("Wrong result: expected: " + expected + " calculated: " + calculated); } }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ITLCurrency obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ITLCurrency obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; }