Ejemplo n.º 1
0
        public void GetExchangedValueReturnsANumberRoundedBy8()
        {
            var er        = new ExchangeRate(5999999M, "R$/BTC", DateTime.Now, CultureInfo.InvariantCulture);
            var valueFiat = 15M;

            var result = er.ExchangeValueTo(valueFiat);

            var numberOfDecimals = result.ToString(CultureInfo.InvariantCulture).Split('.').Last().Length;

            Assert.Equal(numberOfDecimals, Constants.BitcoinDecimals);

            var roundValue = Math.Round(valueFiat / er.Rate, Constants.BitcoinDecimals, MidpointRounding.AwayFromZero);

            Assert.Equal(result, roundValue);
        }