public void GetRawValue() { SqlType type = new SqlReal(5.27f, ParameterDirection.Input); Assert.AreEqual(5.27f, type.GetRawValue()); type = new SqlReal(null, ParameterDirection.Input); Assert.Null(type.GetRawValue()); }
public void GetParameter() { SqlType type = new SqlReal(5.27f, ParameterDirection.Input); TestHelper.AssertSqlParameter(type.GetParameter(), SqlDbType.Real, 5.27f); type = new SqlReal(null, ParameterDirection.Input); TestHelper.AssertSqlParameter(type.GetParameter(), SqlDbType.Real, DBNull.Value); }
public void CreateMetaData() { Assert.Throws<TypeCannotBeUsedAsAClrTypeException>(() => SqlReal.GetTypeHandler().CreateMetaData(null)); SqlTypeHandler col = new SqlReal(5.27f, ParameterDirection.Input); var meta = col.CreateMetaData("Test"); Assert.AreEqual(SqlDbType.Real, meta.SqlDbType); Assert.AreEqual(24, meta.Precision); Assert.AreEqual("Test", meta.Name); }
public void CreateMetaData() { Assert.Throws <TypeCannotBeUsedAsAClrTypeException>(() => SqlReal.GetTypeHandler().CreateMetaData(null)); SqlTypeHandler col = new SqlReal(5.27f, ParameterDirection.Input); var meta = col.CreateMetaData("Test"); Assert.AreEqual(SqlDbType.Real, meta.SqlDbType); Assert.AreEqual(24, meta.Precision); Assert.AreEqual("Test", meta.Name); }
protected override string GetColumnCreationMethod(SqlColumn column) { var type = column.Types[Version]; return(type.SqlTypeInfo switch { SqlInteger _ => $"{nameof(SqLite3Columns.AddInteger)}(\"{column.Name}\"", SqlReal _ => $"{nameof(SqLite3Columns.AddReal)}(\"{column.Name}\"", SqlText _ => $"{nameof(SqLite3Columns.AddText)}(\"{column.Name}\"", SqlBlob _ => $"{nameof(SqLite3Columns.AddBlob)}(\"{column.Name}\"", _ => throw new NotImplementedException($"Unmapped type: {type.SqlTypeInfo}"), });
public void CreateParamFromValue() { Assert.Throws <TypeCannotBeUsedAsAClrTypeException>(() => SqlReal.GetTypeHandler().CreateParamFromValue("Test", null)); }
public void GetTypeHandler() { Assert.IsInstanceOf <SqlTypeHandler>(SqlReal.GetTypeHandler()); }