From 30c0c92ee8ab2a7cb590f620e7b377f4f3e1a90e Mon Sep 17 00:00:00 2001 From: Christian Iwata Nilsson Date: Fri, 23 Aug 2024 11:41:30 +0200 Subject: [PATCH] Migrate EE testcases to XML comments --- VatValidation.Tests/CountryEeTests.cs | 40 --------------------------- VatValidation/Countries/EE.cs | 18 ++++++++++++ 2 files changed, 18 insertions(+), 40 deletions(-) delete mode 100644 VatValidation.Tests/CountryEeTests.cs diff --git a/VatValidation.Tests/CountryEeTests.cs b/VatValidation.Tests/CountryEeTests.cs deleted file mode 100644 index cd02be7..0000000 --- a/VatValidation.Tests/CountryEeTests.cs +++ /dev/null @@ -1,40 +0,0 @@ -namespace VatValidation.Tests; - -public class CountryEeTests -{ - [Theory] - [InlineData(true, "100931558", "100931558", "EE 100931558")] - [InlineData(true, "100 931 558", "100931558", "EE 100931558")] - [InlineData(true, "100594102", "100594102", "EE 100594102")] - [InlineData(false, "100594103", "100594103", "EE 100594103")] - [InlineData(false, "999999999", "999999999", "EE 999999999")] - [InlineData(false, "999 999 999", "999 999 999", "EE 999 999 999")] - [InlineData(false, "999 999 99", "999 999 99", "EE 999 999 99")] - [InlineData(false, "99999999", "99999999", "EE 99999999")] - [InlineData(false, "099999999", "099999999", "EE 099999999")] - public void VatTest(bool expectedValid, string input, string expectNational, string expectVat) - { - var vat = new VatNumber(Countries.EE.Instance, input); - Console.WriteLine($"cc: {vat.CC} nat: {vat.FormatNational} vat: {vat.FormatVat}"); - Assert.Equal(expectedValid, vat.Valid); - Assert.Equal(expectNational, vat.FormatNational); - Assert.Equal(expectVat, vat.FormatVat); - } - - [Theory] - [InlineData(true, "EE 100931558", "100931558")] - [InlineData(true, "EE 100 931 558", "100931558")] - [InlineData(false, "EE 999 999 999", "")] - [InlineData(false, "EE999999990", "")] - [InlineData(true, "EE 100594102", "100594102")] - [InlineData(true, "100931558", "100931558")] - [InlineData(true, "100594102", "100594102")] // matches EE & NO - public void TryParseTest(bool expectedValid, string input, string expectNational) - { - Assert.Equal(expectedValid, VatNumber.TryParse(input, out var vat)); - Console.WriteLine($"cc: {vat.CC} nat: {vat.FormatNational} vat: {vat.FormatVat}"); - Assert.Equal(expectedValid ? nameof(Countries.EE) : null, vat.CC); - Assert.Equal(expectedValid, vat.Valid); - Assert.Equal(expectNational, vat.FormatNational); - } -} diff --git a/VatValidation/Countries/EE.cs b/VatValidation/Countries/EE.cs index 7b01219..d50d93d 100644 --- a/VatValidation/Countries/EE.cs +++ b/VatValidation/Countries/EE.cs @@ -1,5 +1,23 @@ + namespace VatValidation.Countries; +/// +/// valid, in: 100931558, national: 100931558, vat: EE 100931558, stripped: 100931558, vatstripped: EE 100931558 +/// valid, in: 100 931 558, national: 100931558, vat: EE 100931558, stripped: 100931558, vatstripped: EE 100931558 +/// valid, in: 100594102, national: 100594102, vat: EE 100594102, stripped: 100594102, comment: matches both EE and NO +/// invalid, in: 100 594 102x, strippedvalid, national: 100594102, vat: EE 100594102, stripped: 100594102 +/// invalid, in: 100594103, national: 100594103, vat: EE 100594103, stripped: 100594103, vatstripped: EE 100594103 +/// invalid, in: 999999999, national: 999999999, vat: EE 999999999, stripped: 999999999, vatstripped: EE 999999999, dontTryParse +/// invalid, in: 999 999 999, national: 999 999 999, vat: EE 999 999 999, stripped: 999999999, vatstripped: EE 999999999, dontTryParse +/// invalid, in: 999 999 99, national: 999 999 99, vat: EE 999 999 99, stripped: 99999999, vatstripped: EE 99999999 +/// invalid, in: 99999999, national: 99999999, vat: EE 99999999, stripped: 99999999, vatstripped: EE 99999999 +/// invalid, in: 099999999, national: 099999999, vat: EE 099999999, stripped: 099999999, vatstripped: EE 099999999 +/// valid, in: EE100931558, national: 100931558, vat: EE 100931558, stripped: 100931558, vatstripped: EE 100931558 +/// valid, in: EE 100 931 558, national: 100931558, vat: EE 100931558, stripped: 100931558, vatstripped: EE 100931558 +/// invalid, in: EE 999 999 999, national: EE 999 999 999, vat: EE EE 999 999 999, stripped: 999999999, vatstripped: EE 999999999 +/// invalid, in: EE999999999, national: EE999999999, vat: EE EE999999999, stripped: 999999999, vatstripped: EE 999999999 +/// valid, in: EE 100594102, national: 100594102, vat: EE 100594102, stripped: 100594102 +/// public class EE : CountryBase { private EE() { }