public void IbanGetLegnthShouldReturnValidLength() { string testIban = "CZ6508000000192000145399"; Iban testObject = new IbanBuilder().CountryCode(CountryCode.GetCountryCode("CZ")).BankCode("0800").AccountNumberPrefix("000019").AccountNumber("2000145399").Build(); Assert.AreEqual(testIban.Length, IbanUtils.GetIbanLength(testObject.GetCountryCode())); }
public void IbanUtilChangeAccountNumberShouldPadItself() { string iban = "CZ6508000000999999999999"; string changed = IbanUtils.ChangeAccountNumber(iban, "145399"); Assert.AreEqual("CZ4508000000990000145399", changed); }
public void IbanUtilChangeAccountPrefix() { string iban = "CZ6508000000999999999999"; string changed = IbanUtils.ChangeAccountNumberPrefix(iban, "145388"); Assert.AreEqual("CZ8308001453889999999999", changed); }
public void IbanUtilChangeBankCode() { string iban = "CZ6511110000192000145399"; string changed = IbanUtils.ChangeBankCode(iban, "0800"); Assert.AreEqual("CZ6508000000192000145399", changed); }
public void IbanUtilChangeAccountNumber() { string iban = "CZ6508000000999999999999"; string changed = IbanUtils.ChangeAccountNumber(iban, "2000145399"); Assert.AreEqual("CZ5208000000992000145399", changed); }
public void IbanUtilChangeAccountPrefixShouldPadItself() { string iban = "CZ6508000000999999999999"; string changed = IbanUtils.ChangeAccountNumberPrefix(iban, "8"); Assert.AreEqual("CZ1508000000089999999999", changed); }
public void IbanIsValidWithUnsupportedCountryShouldReturnRightResult() { IbanFormatViolation validationResult = IbanFormatViolation.NO_VIOLATION; IbanUtils.IsValid("AM611904300234573201", out validationResult); Assert.AreEqual(IbanFormatViolation.COUNTRY_CODE_UNSUPPORTED, validationResult); }
public void IbanIsValidWithValidIbanShouldReturnRightResult() { IbanFormatViolation validationResult = IbanFormatViolation.NO_VIOLATION; IbanUtils.IsValid("CZ6508000000192000145399", out validationResult); Assert.AreEqual(IbanFormatViolation.NO_VIOLATION, validationResult); }
public void IbanIsValidWithInvalidAccountNumberShouldReturnRightResult() { IbanFormatViolation validationResult = IbanFormatViolation.NO_VIOLATION; IbanUtils.IsValid("DE8937040044053201300A", out validationResult); Assert.AreEqual(IbanFormatViolation.BBAN_ONLY_DIGITS, validationResult); }
public void FromSameBank_validIbansSameBank_ShouldReturnTrue3() { string iban1 = "ES2121003642162200113323"; string iban2 = "ES2121005744850200020333"; string errorDescription; Assert.IsTrue(IbanUtils.FromSameBank(iban1, iban2, out errorDescription)); }
public void FromSameBankAndBranch_invalidIbans_ShouldReturnfalse() { string iban1 = ""; string iban2 = "PT50001000004999022000169"; string errorDescription; Assert.IsFalse(IbanUtils.FromSameBankAndBranch(iban1, iban2, out errorDescription)); }
public void FromSameBankAndBranch_validIbansSameBankDifferentBranch_ShouldReturnFalse() { string iban1 = "PT50001000010000000012313"; string iban2 = "PT50001000000000000012328"; string errorDescription; Assert.IsFalse(IbanUtils.FromSameBankAndBranch(iban1, iban2, out errorDescription)); }
public void FromSameBank_validIbansOtherBank_ShouldReturnFalse() { string iban1 = "PT50001000004999022000169"; string iban2 = "PT50002300004521167555794"; string errorDescription; Assert.IsFalse(IbanUtils.FromSameBank(iban1, iban2, out errorDescription)); }
public void IbanIsValidWithEmptyCountryCodeShouldReturnRightResult() { IbanFormatViolation validationResult = IbanFormatViolation.NO_VIOLATION; IbanUtils.IsValid(" _6508000000192000145399", out validationResult); Assert.AreEqual(IbanFormatViolation.COUNTRY_CODE_UPPER_CASE_LETTERS, validationResult); }
public void IbanIsValidWithCountryCodeAndCheckDigitOnlyShouldReturnRightResult() { IbanFormatViolation validationResult = IbanFormatViolation.NO_VIOLATION; IbanUtils.IsValid("CZ48", out validationResult); Assert.AreEqual(IbanFormatViolation.BBAN_LENGTH, validationResult); }
public void IbanIsValidWithNonDigitCheckDigitShouldReturnRightResult() { IbanFormatViolation validationResult = IbanFormatViolation.NO_VIOLATION; IbanUtils.IsValid("CZ4T", out validationResult); Assert.AreEqual(IbanFormatViolation.CHECK_DIGIT_ONLY_DIGITS, validationResult); }
public void IbanIsValidWithCountryCodeOnlyShouldReturnRightResult() { IbanFormatViolation validationResult = IbanFormatViolation.NO_VIOLATION; IbanUtils.IsValid("CZ", out validationResult); Assert.AreEqual(IbanFormatViolation.CHECK_DIGIT_TWO_DIGITS, validationResult); }
public void IbanIsValidWithOneCharStringShouldReturnRightResult() { IbanFormatViolation validationResult = IbanFormatViolation.NO_VIOLATION; IbanUtils.IsValid("A", out validationResult); Assert.AreEqual(IbanFormatViolation.COUNTRY_CODE_TWO_LETTERS, validationResult); }
public void IbanIsValidWithEmptyIBANShouldReturnRightResult() { IbanFormatViolation validationResult = IbanFormatViolation.NO_VIOLATION; IbanUtils.IsValid("", out validationResult); Assert.AreEqual(IbanFormatViolation.IBAN_NOT_EMPTY_OR_NULL, validationResult); }
public void CheckDigitCalculationWithIbanObject() { string testIban = "CZ6508000000192000145399"; Iban testObject = new IbanBuilder().CountryCode(CountryCode.GetCountryCode("CZ")).BankCode("0800").AccountNumberPrefix("000019").AccountNumber("2000145399").Build(); string checkDigit = IbanUtils.CalculateCheckDigit(testIban); Assert.AreEqual(testIban.Substring(2, 2), checkDigit); }
public void IbanIsValidWithNonExistingCountryShouldReturnRightResult() { IbanFormatViolation validationResult = IbanFormatViolation.NO_VIOLATION; IbanUtils.IsValid("JJ611904300234573201", out validationResult); Assert.AreEqual(IbanFormatViolation.COUNTRY_CODE_EXISTS, validationResult); }
public void FromSameBank_invalidIbans_ShouldReturnfalse4() { string iban1 = null; string iban2 = null; string errorDescription; Assert.IsFalse(IbanUtils.FromSameBank(iban1, iban2, out errorDescription)); }
public void IbanIsValidWithInvalidCheckDigitShouldReturnRightResult() { IbanFormatViolation validationResult = IbanFormatViolation.NO_VIOLATION; IbanUtils.IsValid("AT621904300234573201", out validationResult); Assert.AreEqual(IbanFormatViolation.IBAN_INVALID_CHECK_DIGIT_VALUE, validationResult); }
public void FromSameBankAndBranch_validIbansOtherBank_ShouldReturnFalse() { string iban1 = "PT50001000004999022000169"; string iban2 = "BE39103123456719"; string errorDescription; Assert.IsFalse(IbanUtils.FromSameBankAndBranch(iban1, iban2, out errorDescription)); }
public void IbanIsValidWithInvalidBBANLengthShouldReturnRightResult() { IbanFormatViolation validationResult = IbanFormatViolation.NO_VIOLATION; IbanUtils.IsValid("AT61190430023457320", out validationResult); Assert.AreEqual(IbanFormatViolation.BBAN_LENGTH, validationResult); }
public void FromSameBank_validIbansSameBank_ShouldReturnTrue2() { string iban1 = "PT50001000004999022000169"; string iban2 = "PT50001000005009751000128"; string errorDescription; Assert.IsTrue(IbanUtils.FromSameBank(iban1, iban2, out errorDescription)); }
public void IbanIsValidWithInvalidBankCodeShouldReturnRightResult() { IbanFormatViolation validationResult = IbanFormatViolation.NO_VIOLATION; IbanUtils.IsValid("AT611C04300234573201", out validationResult); Assert.AreEqual(IbanFormatViolation.BBAN_ONLY_DIGITS, validationResult); }
public void NuGet_IBAN4NET() { // ReSharper disable once ForCanBeConvertedToForeach for (int i = 0; i < _testData.Count; i++) { IbanUtils.IsValid(_testData[i], out IbanFormatViolation _); } }
public void IbanIsValidWithInvalidNationalCheckDigitShouldReturnRightResult() { IbanFormatViolation validationResult = IbanFormatViolation.NO_VIOLATION; IbanUtils.IsValid("IT6010542811101000000123456", out validationResult); Assert.AreEqual(IbanFormatViolation.BBAN_ONLY_UPPER_CASE_LETTERS, validationResult); }
public void AllSampleValidIBANsShouldWork() { var IBANs = System.IO.File.ReadAllLines(System.IO.Path.Combine("SampleData", "SampleValidIBANs.txt")); foreach (var iban in IBANs) { IbanUtils.IsValid(iban, out IbanFormatViolation result); Assert.IsTrue(result == IbanFormatViolation.NO_VIOLATION, $"{iban}: {result.ToString()}"); } }