public void IntConverterTest01() { const string val = "123.43"; var pattern = new Regex(@"(?<value>[0-9]*)", RegexOptions.Compiled); Assert.AreEqual(123, IntegerTypeHandler.Convert(DataItemUtilities.ProcessPattern(val, pattern))); }
/// <summary> /// Adds instances of type handlers to the internal cache. /// </summary> static TypeHandlerFactory() { CACHE[typeof(Boolean)] = new BooleanTypeHandler(); CACHE[typeof(Char)] = new CharTypeHandler(); CACHE[typeof(DateTime)] = new DateTimeTypeHandler(); CACHE[typeof(Decimal)] = new DecimalTypeHandler(); CACHE[typeof(Double)] = new DoubleTypeHandler(); CACHE[typeof(float)] = new FloatTypeHandler(); CACHE[typeof(int)] = new IntegerTypeHandler(); CACHE[typeof(long)] = new LongTypeHandler(); CACHE[typeof(short)] = new ShortTypeHandler(); }
public void IntConverterTest03() { const string val = "foo123"; Assert.IsNull(IntegerTypeHandler.Convert(DataItemUtilities.ProcessPattern(val, null))); }
public void IntConverterTest02() { const string val = "123"; Assert.AreEqual(123, IntegerTypeHandler.Convert(DataItemUtilities.ProcessPattern(val, null))); }