-
Notifications
You must be signed in to change notification settings - Fork 480
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1572 from AgnaldoSilva0/Branch_21158
Padronizado métodos de arredondamento nas classes DFe e NFe
- Loading branch information
Showing
4 changed files
with
51 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace DFe.Testes.Valores.DadosDeTeste | ||
{ | ||
public class ValorDadosDeTeste | ||
{ | ||
public static IEnumerable<object[]> ObterValoresDecimaisParaArredondar() | ||
{ | ||
return new List<object[]> | ||
{ | ||
new object[] { 20.35m * 15.90m, 2 }, | ||
new object[] { 0.35m * 15.90m, 2 }, | ||
new object[] { 3.665m, 2 }, | ||
new object[] { 4.775m, 2 }, | ||
|
||
new object[] { 20.35m * 15.90m, 3 }, | ||
new object[] { 0.35m * 15.90m, 3 }, | ||
new object[] { 4.77575m, 4 }, | ||
new object[] { 5.445545m, 5 }, | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using DFe.Testes.Valores.DadosDeTeste; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using NFe.Classes; | ||
|
||
namespace DFe.Testes.Valores | ||
{ | ||
[TestClass] | ||
public class ValorTesteUnitario | ||
{ | ||
[TestMethod(displayName: "Dado um valor e uma quantidade de casas decimais, quando o arredondamento for feito utilizando os métodos da DFe e NFe, então o valor arredondado deve ser igual em ambos os casos")] | ||
[DynamicData(nameof(ValorDadosDeTeste.ObterValoresDecimaisParaArredondar), typeof(ValorDadosDeTeste), DynamicDataSourceType.Method)] | ||
public void DadoUmValorEUmaQuantidadeDeCasasDecimaisQuandoOArredondamentoForFeitoUtilizandoOsMetodosDaDfeENfeEntaoOValorArredondadoDeveSerIgualEmAmbosOsCasos(decimal valor, int casasDecimais) | ||
{ | ||
var valorArredondadoDfe = Classes.Valor.Arredondar(valor, casasDecimais); | ||
var valorArredondadoNfe = Valor.Arredondar(valor, casasDecimais); | ||
|
||
Assert.AreEqual(valorArredondadoDfe, valorArredondadoNfe); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters