public static IbanParts Build(string countryCode, string bban) { Require.NotNull(countryCode, nameof(countryCode)); Require.NotNull(bban, nameof(bban)); Require.True(CountryPart.Validate(countryCode), nameof(countryCode)); Require.True(BbanPart.Validate(bban), nameof(bban)); string checkDigits = IbanCheckDigits.Compute(countryCode, bban); return(new IbanParts(countryCode, checkDigits, bban)); }
public static void Compute3(string value) { var iban = IbanParts.Parse(value).Value; Assert.Equal(iban.CheckDigits, IbanCheckDigits.Compute(iban.CountryCode, iban.Bban, true)); }
public static void Compute0b(string value) { Assert.Throws <ArgumentOutOfRangeException>("countryCode", () => IbanCheckDigits.Compute(value, "bban", true)); }
public static void Compute0a() { Assert.Throws <ArgumentNullException>("bban", () => IbanCheckDigits.Compute("countryCode", null, true)); Assert.Throws <ArgumentNullException>("countryCode", () => IbanCheckDigits.Compute(null, "bban", true)); }