Пример #1
0
        /// <inheritdoc />
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            switch (value)
            {
            case null:
                return(null);

            case string strValue:
                if (Iban.TryParse(strValue, out var iban))
                {
                    return(iban);
                }

                break;
            }

            return(base.ConvertFrom(context, culture, value));
        }
Пример #2
0
 public void TryParse_Iban_That_Has_Incorrect_CheckDigit_Returns_False()
 {
     Iban.TryParse("BE72 0961 2345 6769", out var _).Should().BeFalse();
 }
Пример #3
0
 public void TryParse_Iban_That_Is_Correct_Returns_True()
 {
     Iban.TryParse("BE71 0961 2345 6769", out var _).Should().BeTrue();
     new Iban("BE71 0961 2345 6769");
 }
Пример #4
0
 public void TryParse_Iban_That_Has_Letters_As_Check_Digits_Returns_False()
 {
     Iban.TryParse("NLA1 3456789", out var _).Should().BeFalse();
 }
Пример #5
0
 public void TryParse_Iban_That_Has_Other_Characters_As_Bank_Account_Number_Returns_False()
 {
     Iban.TryParse("NLA1 34$56789", out var _).Should().BeFalse();
 }
Пример #6
0
 public void TryParse_Iban_That_Has_LowerCase_CountryCode_Returns_False()
 {
     Iban.TryParse("nl12 3456789", out var _).Should().BeFalse();
 }
Пример #7
0
 public void TryParse_Iban_That_Is_In_Wrong_Format_Returns_False()
 {
     Iban.TryParse(new string('1', 30), out var _).Should().BeFalse();
 }
Пример #8
0
 public void TryParse_Iban_That_Is_Too_Short_Returns_False()
 {
     Iban.TryParse(new string('1', 3), out var _).Should().BeFalse();
 }
Пример #9
0
 public void TryParse_String_Empty_Returns_True()
 {
     Iban.TryParse(string.Empty, out var _).Should().BeTrue();
 }
Пример #10
0
 public void TryParse_Null_Returns_True()
 {
     Iban.TryParse(null, out var _).Should().BeTrue();
 }