public void ParseString(string input, SqlTypeCode typeCode) { var sqlType = SqlType.Parse(input); Assert.IsNotNull(sqlType); Assert.IsInstanceOf <DateType>(sqlType); Assert.AreEqual(typeCode, sqlType.TypeCode); }
public void ParseString(string input, SqlTypeCode expected) { var type = SqlType.Parse(input); Assert.IsNotNull(type); Assert.IsInstanceOf <IntervalType>(type); Assert.AreEqual(expected, type.TypeCode); }
public void GeometryWithSrid() { const string typeString = "GEOMETRY(SRID = '2029')"; SqlType type = null; Assert.DoesNotThrow(() => type = SqlType.Parse(Query.Context, typeString)); Assert.IsNotNull(type); Assert.IsInstanceOf <SpatialType>(type); Assert.AreEqual(2029, ((SpatialType)type).Srid); }
public void SimpleGeometry() { const string typeString = "GEOMETRY"; SqlType type = null; Assert.DoesNotThrow(() => type = SqlType.Parse(Query.Context, typeString)); Assert.IsNotNull(type); Assert.IsInstanceOf <SpatialType>(type); Assert.AreEqual(-1, ((SpatialType)type).Srid); }
public void SimpleNumeric() { const string typeString = "NUMERIC"; SqlType type = null; Assert.DoesNotThrow(() => type = SqlType.Parse(typeString)); Assert.IsNotNull(type); Assert.IsInstanceOf <NumericType>(type); Assert.AreEqual(-1, ((NumericType)type).Size); }
public void SizedVarChar_Parse() { const string typeString = "VARCHAR(255)"; SqlType sqlType = null; Assert.DoesNotThrow(() => sqlType = SqlType.Parse(typeString)); Assert.IsNotNull(sqlType); Assert.IsInstanceOf <StringType>(sqlType); Assert.AreEqual(SqlTypeCode.VarChar, sqlType.TypeCode); var stringType = (StringType)sqlType; Assert.AreEqual(255, stringType.MaxSize); Assert.AreEqual(null, stringType.Locale); }
public void SizedWithEncoding_Parse() { const string typeString = "VARCHAR(255) ENCODING 'UTF-16'"; SqlType sqlType = null; Assert.DoesNotThrow(() => sqlType = SqlType.Parse(typeString)); Assert.IsNotNull(sqlType); Assert.IsInstanceOf <StringType>(sqlType); Assert.AreEqual(SqlTypeCode.VarChar, sqlType.TypeCode); var stringType = (StringType)sqlType; Assert.AreEqual(255, stringType.MaxSize); Assert.IsNull(stringType.Locale); Assert.AreEqual(Encoding.Unicode.WebName, stringType.Encoding.WebName); }
public void LocalizedVarChar_Parse() { const string typeString = "VARCHAR(255) LOCALE 'en-Us'"; SqlType sqlType = null; Assert.DoesNotThrow(() => sqlType = SqlType.Parse(typeString)); Assert.IsNotNull(sqlType); Assert.IsInstanceOf <StringType>(sqlType); Assert.AreEqual(SqlTypeCode.VarChar, sqlType.TypeCode); var stringType = (StringType)sqlType; Assert.AreEqual(255, stringType.MaxSize); Assert.AreEqual(CultureInfo.GetCultureInfo("en-US"), stringType.Locale); Assert.IsNotNull(stringType.Encoding); Assert.AreEqual(Encoding.Unicode.WebName, stringType.Encoding.WebName); }
public void SimpleGeometryWithNoContext() { const string typeString = "GEOMETRY"; Assert.Throws <NotSupportedException>(() => SqlType.Parse(typeString)); }