예제 #1
0
        private void AssertConversion(string from, string to, decimal initialAmount, decimal expectedAmount)
        {
            var table     = ExchangeRateTableCreator.From("AUD:CHF:0.9661, JPY:KWU:13.1151, EUR:CHF:1.2053, AUD:JPY:86.0305, EUR:USD:1.2989, JPY:INR:0.6571");
            var converter = new Lucca.CurrencyConverter.CurrencyConverter(table);

            var convertedAmount = converter.Convert(new Amount(initialAmount), new Currency(from), new Currency(to));

            convertedAmount.Should().Be(new Amount(expectedAmount));
        }
예제 #2
0
        private void AssertShortestPath(string exchangeRatesDescription, string expectedRateSequence)
        {
            var table = ExchangeRateTableCreator.From(exchangeRatesDescription);

            var pathFinder = new DijkstraPathFinder(table);
            var sequence   = pathFinder.FindSequence(new Currency("EUR"), new Currency("JPY"));

            sequence.ToString().Should().Be(expectedRateSequence);
        }