-
Notifications
You must be signed in to change notification settings - Fork 20
/
FranceValidatorTests.cs
63 lines (56 loc) · 1.99 KB
/
FranceValidatorTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using CountryValidation.Countries;
using Xunit;
namespace CountryValidation.Tests
{
public class FranceValidatorTests
{
private readonly FranceValidator _franceValidator;
public FranceValidatorTests()
{
_franceValidator = new FranceValidator();
}
[Theory]
[InlineData("295109912611193", true)]
[InlineData("253072B07300470", true)]
[InlineData("253072A07300443", true)]
[InlineData("295109912611199", false)]
[InlineData("253072C07300443", false)]
public void TestNationalId(string code, bool isValid)
{
Assert.Equal(isValid, _franceValidator.ValidateNationalIdentity(code).IsValid);
}
[Theory]
[InlineData("0701987765432", true)]
[InlineData("07 01 987 765 432", true)]
[InlineData("070198776543", false)]
public void TestIndividualCode(string code, bool isValid)
{
Assert.Equal(isValid, _franceValidator.ValidateIndividualTaxCode(code).IsValid);
}
[Theory]
[InlineData("552 008 443", true)]
[InlineData("404833048", true)]
[InlineData("404833047", false)]
public void TestCorrectEntityCode(string code, bool isValid)
{
Assert.Equal(isValid, _franceValidator.ValidateEntity(code).IsValid);
}
[Theory]
[InlineData("Fr 40 303 265 045", true)]
[InlineData("23334175221", true)]
[InlineData("K7399859412", true)]
[InlineData("84 323 140 391", false)]
public void TestCorrectVatCode(string code, bool isValid)
{
Assert.Equal(isValid, _franceValidator.ValidateVAT(code).IsValid);
}
[Theory]
[InlineData("33380", true)]
[InlineData("34092", true)]
[InlineData("3321", false)]
public void TestPostalCode(string code, bool isValid)
{
Assert.Equal(isValid, _franceValidator.ValidatePostalCode(code).IsValid);
}
}
}