Пример #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 ComputeInt32Checksum0b(string value)
 {
     Assert.Throws <ArgumentOutOfRangeException>("value", () => IbanCheckDigits.ComputeInt32Checksum(value));
 }
Пример #3
0
 public static void ComputeInt32Checksum0a()
 {
     Assert.Throws <ArgumentNullException>("value", () => IbanCheckDigits.ComputeInt32Checksum(null));
 }
Пример #4
0
 public static void Verify6(string value)
 => Assert.False(IbanCheckDigits.Verify(value, true));
Пример #5
0
 public static void Verify2(string value)
 => Assert.True(IbanCheckDigits.Verify(value, false));
Пример #6
0
        public static void Compute3(string value)
        {
            var iban = IbanParts.Parse(value).Value;

            Assert.Equal(iban.CheckDigits, IbanCheckDigits.Compute(iban.CountryCode, iban.Bban, true));
        }
Пример #7
0
 public static void Compute0b(string value)
 {
     Assert.Throws <ArgumentOutOfRangeException>("countryCode", () => IbanCheckDigits.Compute(value, "bban", true));
 }
Пример #8
0
 public static void Compute0a()
 {
     Assert.Throws <ArgumentNullException>("bban", () => IbanCheckDigits.Compute("countryCode", null, true));
     Assert.Throws <ArgumentNullException>("countryCode", () => IbanCheckDigits.Compute(null, "bban", true));
 }
Пример #9
0
 public static void ComputeInt64Checksum3(string value)
 => Assert.Throws <ArgumentException>(() => IbanCheckDigits.ComputeInt64Checksum(value));
Пример #10
0
 public static void ComputeInt64Checksum2(string value)
 => Assert.NotEqual(1, IbanCheckDigits.ComputeInt64Checksum(value));
Пример #11
0
 public static void ComputeInt32Checksum1(string value)
 => Assert.Equal(1, IbanCheckDigits.ComputeInt32Checksum(value));
Пример #12
0
 public static bool VerifyIntegrity(IbanParts parts) => IbanCheckDigits.Verify(parts.LiteralValue);