示例#1
0
        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));
        }
示例#2
0
        public static void Compute3(string value)
        {
            var iban = IbanParts.Parse(value).Value;

            Assert.Equal(iban.CheckDigits, IbanCheckDigits.Compute(iban.CountryCode, iban.Bban, true));
        }
示例#3
0
 public static void Compute0b(string value)
 {
     Assert.Throws <ArgumentOutOfRangeException>("countryCode", () => IbanCheckDigits.Compute(value, "bban", true));
 }
示例#4
0
 public static void Compute0a()
 {
     Assert.Throws <ArgumentNullException>("bban", () => IbanCheckDigits.Compute("countryCode", null, true));
     Assert.Throws <ArgumentNullException>("countryCode", () => IbanCheckDigits.Compute(null, "bban", true));
 }