public void ReturnStringNotNullWhenRequestShowMeCode() { InterestCalculatorModel icModel = new InterestCalculatorModel(); var result = icModel.ShowMeCode(); Assert.NotNull(result); Assert.IsType <String>(result); }
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); }
public void ReturnSpecifiedValueOfFeeWhenRequestGetFeeValue() { InterestCalculatorModel icModel = new InterestCalculatorModel(); var result = icModel.GetFeeValue(); Assert.Equal(0.01M, result); Assert.IsType <decimal>(result); }
public async Task ShowMeTheCode() { var client = _factory.CreateClient(); var response = await client.GetAsync("interestCalculator/showmethecode"); var valueString = await response.Content.ReadAsStringAsync(); InterestCalculatorModel icModel = new InterestCalculatorModel(); response.EnsureSuccessStatusCode(); Assert.Equal(icModel.ShowMeCode(), valueString); }
public async Task GetFeeValue() { var client = _factory.CreateClient(); var response = await client.GetAsync("interestCalculator/taxaJuros"); var valueString = await response.Content.ReadAsStringAsync(); InterestCalculatorModel icModel = new InterestCalculatorModel(); response.EnsureSuccessStatusCode(); NumberStyles style = NumberStyles.AllowDecimalPoint; CultureInfo provider = new CultureInfo("en-US"); Assert.Equal(icModel.GetFeeValue(), Decimal.Parse(valueString, style, provider)); }
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)); }