public Amount Convert(Amount amount, Currency from, Currency to)
        {
            var pathFinder = new DijkstraPathFinder(this.exchangeRates);

            return(pathFinder
                   .FindSequence(from, to)
                   .Convert(amount));
        }
Exemplo n.º 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);
        }