/// <summary>Converts a string to a cryptographic seed, 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(CryptographicSeed.Parse(str)); } return(base.ConvertFrom(context, culture, value)); }
public void Parse_InvalidInput_ThrowsFormatException() { using (new CultureInfoScope("en-GB")) { Assert.Catch <FormatException> (() => { CryptographicSeed.Parse("!"); }, "Not a valid cryptographic seed"); } }