Skip to content

Commit

Permalink
# This is a combination of 2 commits.
Browse files Browse the repository at this point in the history
# This is the 1st commit message:

melhoria nos testes, usando DataRow

adicionando validação de CEP

melhoria nos testes, usando DataRow

# This is the commit message #2:

adicionando validação de CEP
  • Loading branch information
MarcosCostaDev committed Feb 14, 2018
1 parent fb21b31 commit b243f58
Showing 1 changed file with 14 additions and 38 deletions.
52 changes: 14 additions & 38 deletions tests/Flunt.Br.Tests/FluntBrTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,49 +72,25 @@ public void IsCellPhone_Valid()
}

[TestMethod]
public void IsCep_InValid()
[DataRow("99999")]
[DataRow("abcde-999")]
[DataRow("99999-fgh")]
[DataRow("abcde-fgh")]
[DataRow("abcde999")]
[DataRow("99999fgh")]
[DataRow("abcdefgh")]
public void IsCep_InValid(string cep)
{
var wrong = new Contract();
wrong.IsCep("99999", "Cep", "Invalid Cep");
Assert.IsFalse(wrong.Valid);

wrong = new Contract();
wrong.IsCep("abcde-999", "Cep", "Invalid Cep");
Assert.IsFalse(wrong.Valid);

wrong = new Contract();
wrong.IsCep("99999-fgh", "Cep", "Invalid Cep");
Assert.IsFalse(wrong.Valid);

wrong = new Contract();
wrong.IsCep("abcde-fgh", "Cep", "Invalid Cep");
Assert.IsFalse(wrong.Valid);

wrong = new Contract();
wrong.IsCep("abcdef", "Cep", "Invalid Cep");
Assert.IsFalse(wrong.Valid);

wrong = new Contract();
wrong.IsCep("abcde999", "Cep", "Invalid Cep");
Assert.IsFalse(wrong.Valid);

wrong = new Contract();
wrong.IsCep("99999fgh", "Cep", "Invalid Cep");
Assert.IsFalse(wrong.Valid);

wrong = new Contract();
wrong.IsCep("abcdefgh", "Cep", "Invalid Cep");
Assert.IsFalse(wrong.Valid);
var wrong = new Contract().IsCep(cep, "Cep", "Invalid Cep");
Assert.IsFalse(wrong.Valid);
}

[TestMethod]
public void IsCep_Valid()
[DataRow("99999-999")]
[DataRow("99999999")]
public void IsCep_Valid(string cep)
{
var right = new Contract();
right.IsCep("99999-999", "Cep", "Invalid Cep");
Assert.IsTrue(right.Valid);

right.IsCep("99999999", "Cep", "Invalid Cep");
var right = new Contract().IsCep(cep, "Cep", "Invalid Cep");
Assert.IsTrue(right.Valid);
}
}
Expand Down

0 comments on commit b243f58

Please sign in to comment.