예제 #1
0
        public void ReturnInterestValueWhenRequestCalculateInterest(decimal initialValue, int period, decimal expectedValue)
        {
            InterestCalculatorModel icModel = new InterestCalculatorModel();

            var result = icModel.CalculateInterest(initialValue, period);

            Assert.Equal(expectedValue, result);
            Assert.IsType <decimal>(result);
        }
예제 #2
0
        public async Task CalculateInterest()
        {
            var client = _factory.CreateClient();

            var response = await client.GetAsync("interestCalculator/calculaJuros?valorinicial=100&meses=5");

            var valueString = await response.Content.ReadAsStringAsync();

            InterestCalculatorModel icModel = new InterestCalculatorModel();

            response.EnsureSuccessStatusCode();

            NumberStyles style    = NumberStyles.AllowDecimalPoint;
            CultureInfo  provider = new CultureInfo("en-US");

            Console.WriteLine(response);
            Assert.Equal(icModel.CalculateInterest(100, 5), Decimal.Parse(valueString, style, provider));
        }