コード例 #1
0
        public void ConverterRealParaDolar()
        {
            CurrencyLayerService = new CurrencyLayerService(mockConfiguration);
            decimal quote      = CurrencyLayerService.GetListQuotes().quotes.FirstOrDefault(x => x.Key == $"USDBRL").Value;
            var     controller = new CurrenciesController(CurrencyLayerService);
            var     result     = controller.GetToBRL("USD", 1);

            var res = Assert.IsType <OkObjectResult>(result);

            Assert.Equal(200, res.StatusCode);
            var currenciesResponse = Assert.IsType <ConvertResponse>(res.Value);

            Assert.Equal(Math.Round(quote), Math.Round(currenciesResponse.result));
        }