/// <summary> /// Converts argument to specified type. /// Supported types similar to StringConverter. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="index"></param> /// <returns></returns> public T As<T>( int index ) { return (T)StringConverter.ConvertFromString( typeof(T), args[index] ); }
public void should_not_change_other_text_than_none_literal() { var converter = new StringConverter(); converter.ConvertFromString("text_other_than_none", Mock.Of <IReaderRow>(), null).Should().Be("text other than none"); }
/// <summary> /// Sets config variable from text value. /// </summary> /// <param name="value"></param> public void Set(string value) { TargetProperty.SetValue(TargetObject, StringConverter.ConvertFromString(TargetProperty.PropertyType, value)); }
public void should_convert_none_literal_to_null() { var converter = new StringConverter(); converter.ConvertFromString(TimetableLiterals.None, Mock.Of <IReaderRow>(), null).Should().BeNull(); }