Ejemplo n.º 1
0
        public async Task TestLive()
        {
            var ecb = new GetECBExchange();

            foreach (var e in await ecb.GetActualRates())
            {
                if (e.ExchangeFrom == "RON")
                {
                    Assert.True(true);
                    return;
                }
            }
            Assert.True(false, "Should find RON");
        }
Ejemplo n.º 2
0
        public async Task TestParsing()
        {
            var response = await File.ReadAllTextAsync(Path.Combine("Data", "20191208bce.txt"));

            var m = new MockHttpMessageHandler();

            m.When("https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml")
            .Respond("application/text", response);

            var bce = new GetECBExchange(m);

            foreach (var e in await bce.GetActualRates())
            {
                if (e.ExchangeFrom == "RON")
                {
                    Assert.Equal(4.7800m, e.ExchangeValue, 4);
                    return;
                }
            }
            Assert.True(false, "Should find EUR");
        }