Example #1
0
        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());
        }
Example #2
0
        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);
        }
Example #3
0
        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());
        }
Example #4
0
        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);
        }
Example #5
0
        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);
        }
Example #6
0
        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}"),
            });
Example #8
0
 public void CreateParamFromValue()
 {
     Assert.Throws <TypeCannotBeUsedAsAClrTypeException>(() => SqlReal.GetTypeHandler().CreateParamFromValue("Test", null));
 }
Example #9
0
 public void GetTypeHandler()
 {
     Assert.IsInstanceOf <SqlTypeHandler>(SqlReal.GetTypeHandler());
 }