public void Quando_informar_ValorInicial_Meses_Invalidos(double valorInicial, int meses) { // arrange double taxaJuro = 0.01; var juro = new Juro(valorInicial, meses, taxaJuro); // act var isValid = juro.IsValid(); // assert Assert.False(isValid); }
public ResultDTO ObterValorJuroComposto(double valorInicial, int meses) { var taxaJuroResult = _taxaJurotService.ObterTaxaJuro(); var taxaJuro = !string.IsNullOrEmpty(taxaJuroResult) ? Convert.ToDecimal(taxaJuroResult) : 0; var juro = new Juro(valorInicial, meses, (double)taxaJuro); var resultDTO = new ResultDTO(); // Validar a entidade if (!juro.IsValid()) { resultDTO.Failure(juro.ValidationResult); } else { resultDTO.Success(juro.CalcularJuroComposto()); } return(resultDTO); }