Skip to content

Commit

Permalink
Outcommented regex matchings for all countries and removed skip optio…
Browse files Browse the repository at this point in the history
…n on some tests which failed before
  • Loading branch information
Lovro Biljeskovic committed Nov 20, 2019
1 parent b353062 commit 05aee7f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 43 deletions.
80 changes: 40 additions & 40 deletions src/Utility/VatNumberCleaner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,50 +17,50 @@ public string CheckVATNumber(string toCheck)

var vatexp = new string[]
{
//"^(AT)(U\\d{8})$",
//"^(BE)(0?\\d{9})$",
//"^(BG)(\\d{9,10})$",
//"^(CHE)(\\d{9})(MWST)?$",
//"^(CY)([0-59]\\d{7}[A-Z])$",
//"^(CZ)(\\d{8,10})(\\d{3})?$",
//"^(DE)([1-9]\\d{8})$",
//"^(DK)(\\d{8})$",
//"^(EE)(10\\d{7})$",
//"^(EL)(\\d{9})$",
//"^(ES)([A-Z]\\d{8})$",
//"^(ES)([A-HN-SW]\\d{7}[A-J])$",
//"^(ES)([0-9YZ]\\d{7}[A-Z])$",
//"^(ES)([KLMX]\\d{7}[A-Z])$",
//"^(EU)(\\d{9})$",
//"^(FI)(\\d{8})$",
"^(AT)(U\\d{8})$",
"^(BE)(0?\\d{9})$",
"^(BG)(\\d{9,10})$",
"^(CHE)(\\d{9})(MWST)?$",
"^(CY)([0-59]\\d{7}[A-Z])$",
"^(CZ)(\\d{8,10})(\\d{3})?$",
"^(DE)([1-9]\\d{8})$",
"^(DK)(\\d{8})$",
"^(EE)(10\\d{7})$",
"^(EL)(\\d{9})$",
"^(ES)([A-Z]\\d{8})$",
"^(ES)([A-HN-SW]\\d{7}[A-J])$",
"^(ES)([0-9YZ]\\d{7}[A-Z])$",
"^(ES)([KLMX]\\d{7}[A-Z])$",
"^(EU)(\\d{9})$",
"^(FI)(\\d{8})$",
"^(FR)(\\d{11})$",
"^(FR)([A-HJ-NP-Z]\\d{10})$",
"^(FR)(\\d[A-HJ-NP-Z]\\d{9})$",
"^(FR)([A-HJ-NP-Z]{2}\\d{9})$",
////"^(GB)?(\\d{9})$",
////"^(GB)?(\\d{12})$",
////"^(GB)?(GD\\d{3})$",
////"^(GB)?(HA\\d{3})$",
////"^(HR)(\\d{11})$",
////"^(HU)(\\d{8})$",
////"^(IE)(\\d{7}[A-W])$",
////"^(IE)([7-9][A-Z\\*\\+)]\\d{5}[A-W])$",
////"^(IE)(\\d{7}[A-W][AH])$",
////"^(IT)(\\d{11})$",
////"^(LV)(\\d{11})$",
////"^(LT)(\\d{9}|\\d{12})$",
////"^(LU)(\\d{8})$",
////"^(MT)([1-9]\\d{7})$",
////"^(NL)(\\d{9})B\\d{2}$",
////"^(NO)(\\d{9})$",
////"^(PL)(\\d{10})$",
////"^(PT)(\\d{9})$",
////"^(RO)([1-9]\\d{1,9})$",
////"^(RU)(\\d{10}|\\d{12})$",
////"^(RS)(\\d{9})$",
////"^(SI)([1-9]\\d{7})$",
////"^(SK)([1-9]\\d[2346-9]\\d{7})$",
////"^(SE)(\\d{10}01)$"
"^(GB)?(\\d{9})$",
"^(GB)?(\\d{12})$",
"^(GB)?(GD\\d{3})$",
"^(GB)?(HA\\d{3})$",
"^(HR)(\\d{11})$",
"^(HU)(\\d{8})$",
"^(IE)(\\d{7}[A-W])$",
"^(IE)([7-9][A-Z\\*\\+)]\\d{5}[A-W])$",
"^(IE)(\\d{7}[A-W][AH])$",
"^(IT)(\\d{11})$",
"^(LV)(\\d{11})$",
"^(LT)(\\d{9}|\\d{12})$",
"^(LU)(\\d{8})$",
"^(MT)([1-9]\\d{7})$",
"^(NL)(\\d{9})B\\d{2}$",
"^(NO)(\\d{9})$",
"^(PL)(\\d{10})$",
"^(PT)(\\d{9})$",
"^(RO)([1-9]\\d{1,9})$",
"^(RU)(\\d{10}|\\d{12})$",
"^(RS)(\\d{9})$",
"^(SI)([1-9]\\d{7})$",
"^(SK)([1-9]\\d[2346-9]\\d{7})$",
"^(SE)(\\d{10}01)$"
};

var VATNumber = toCheck.ToUpper();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public VatNumberCleanerTests()
_sut = new VatNumberCleaner();
}

[Theory(Skip = "Test is Failing")]
[Theory]
[InlineData("BE -/0888533955", "BE0888533955")]
public void TestCheckVatNumber(string vatNumber, string expected)
{
Expand Down Expand Up @@ -242,7 +242,7 @@ public void TestHuCheckDigit(string vatNumber)
// If you want to test for the whole VatNumber format(including country code) you call the CheckVATNumber function - returns string
// If you want to test for only the digit part of VatNumber, you can each individual country check digit function - returns bool

[Theory(Skip = "Test is Failing")]
[Theory]
[InlineData("CHE-108.315.241", "CHE108315241")]
public void TestChePattern(string vatNumber, string expected)
{
Expand All @@ -256,7 +256,7 @@ public void TestFrPattern(string vatNumber, string expected)
Assert.Equal(expected, _sut.CheckVATNumber(vatNumber));
}

[Theory(Skip = "Test is Failing")]
[Theory]
[InlineData("NL802353794B01", "NL802353794B01")]
public void TestNlCheckDigit2(string vatNumber, string expected)
{
Expand Down

0 comments on commit 05aee7f

Please sign in to comment.