From 830bf27a69f9f49dcebf4199e6f7a8283a82e071 Mon Sep 17 00:00:00 2001 From: cboiam Date: Thu, 10 Dec 2020 13:08:01 -0300 Subject: [PATCH 1/2] Validacao de cpf com literal --- src/Flunt.Br/Validations/Cpf.cs | 4 +++- tests/Flunt.Br.Tests/PersonContractTest.cs | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Flunt.Br/Validations/Cpf.cs b/src/Flunt.Br/Validations/Cpf.cs index d18405a..832f515 100644 --- a/src/Flunt.Br/Validations/Cpf.cs +++ b/src/Flunt.Br/Validations/Cpf.cs @@ -22,6 +22,8 @@ public bool Validate(string value) int resto; value = value.Trim(); value = value.Replace(".", "").Replace("-", ""); + if(!long.TryParse(value, out var parsed)) + return false; if (value.Length != 11 || cpfInvalid.Contains(value)) return false; tempCpf = value.Substring(0, 9); @@ -43,4 +45,4 @@ public bool Validate(string value) return value.EndsWith(digito); } } -} \ No newline at end of file +} diff --git a/tests/Flunt.Br.Tests/PersonContractTest.cs b/tests/Flunt.Br.Tests/PersonContractTest.cs index 3bc5566..0e59515 100644 --- a/tests/Flunt.Br.Tests/PersonContractTest.cs +++ b/tests/Flunt.Br.Tests/PersonContractTest.cs @@ -20,6 +20,7 @@ public class PersonContractTest [DataRow("777.777.777-77")] [DataRow("888.888.888-88")] [DataRow("999.999.999-99")] + [DataRow("999.999.abc-99")] [DataRow(null)] public void IsCpf_Invalid(string value) { From 5eb5c2b6a187b12b9a7d1a459a79fe991bc8006e Mon Sep 17 00:00:00 2001 From: Alan Lira Date: Wed, 10 Feb 2021 21:30:33 -0300 Subject: [PATCH 2/2] release 1.4.1 --- global.json | 4 ++-- src/Flunt.Br/Flunt.Br.csproj | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/global.json b/global.json index 810dc7b..b0df253 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "projects": [ "src", "test" ], "sdk": { - "version": "3.1.300" + "version": "3.1.404" } -} +} \ No newline at end of file diff --git a/src/Flunt.Br/Flunt.Br.csproj b/src/Flunt.Br/Flunt.Br.csproj index 21c3525..4ed96bb 100644 --- a/src/Flunt.Br/Flunt.Br.csproj +++ b/src/Flunt.Br/Flunt.Br.csproj @@ -2,14 +2,14 @@ netstandard2.0 - 1.4.0 + 1.4.1 Alan Lira Extensions of Flunt for Brazilian projects MIT https://github.com/lira92/flunt.br https://github.com/lira92/flunt.br - 1.4.0.0 - 1.4.0.0 + 1.4.1.0 + 1.4.1.0 flunt-icon-br_compressed.png Validation;Flunt.Br;Flunt;Cnpj;Cpf;Telefone;Cep