public void Equals_FormattedAndUnformatted_IsTrue() { var l = InternationalBankAccountNumber.Parse("NL20 INGB 0001 2345 67"); var r = InternationalBankAccountNumber.Parse("nl20ingb0001234567"); Assert.IsTrue(l.Equals(r)); }
/// <summary>Converts a string to an IBAN, using the specified /// context and culture information. /// </summary> /// <param name="context"> /// An System.ComponentModel.ITypeDescriptorContext that provides a format context. /// </param> /// <param name="culture"> /// The System.Globalization.CultureInfo to use as the current culture. /// </param> /// <param name="value"> /// The System.Object to convert. /// </param> /// <returns> /// An System.Object that represents the converted value. /// </returns> /// <exception cref="NotSupportedException"> /// The conversion cannot be performed. /// </exception> public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { var str = value as string; if (value == null || str != null) { return(InternationalBankAccountNumber.Parse(str, culture)); } return(base.ConvertFrom(context, culture, value)); }
public void Parse_InvalidInput_ThrowsFormatException() { using (new CultureInfoScope("en-GB")) { Assert.Catch <FormatException> (() => { InternationalBankAccountNumber.Parse("InvalidInput"); }, "Not a valid IBAN"); } }
public void OrderByDescending_InternationalBankAccountNumber_AreEqual() { var item0 = InternationalBankAccountNumber.Parse("AE950210000000693123456"); var item1 = InternationalBankAccountNumber.Parse("BH29BMAG1299123456BH00"); var item2 = InternationalBankAccountNumber.Parse("CY17002001280000001200527600"); var item3 = InternationalBankAccountNumber.Parse("DK5000400440116243"); var inp = new List <InternationalBankAccountNumber> { InternationalBankAccountNumber.Empty, item3, item2, item0, item1, InternationalBankAccountNumber.Empty }; var exp = new List <InternationalBankAccountNumber> { item3, item2, item1, item0, InternationalBankAccountNumber.Empty, InternationalBankAccountNumber.Empty }; var act = inp.OrderByDescending(item => item).ToList(); CollectionAssert.AreEqual(exp, act); }