Exemple #1
0
        public void CreateMetaData()
        {
            Assert.Throws<TypeCannotBeUsedAsAClrTypeException>(() => SqlDecimal.GetTypeHandler().CreateMetaData("Test"));

            SqlTypeHandler col = new SqlDecimal(5.27m, null, null, ParameterDirection.Input);
            Assert.Throws<TypePropertiesMustBeSetExplicitlyException>(() => col.CreateMetaData("Test"));

            col = new SqlDecimal(5.27m, 10, 5, ParameterDirection.Input);
            var meta = col.CreateMetaData("Test");
            Assert.AreEqual(SqlDbType.Decimal, meta.SqlDbType);
            Assert.AreEqual(10, meta.Precision);
            Assert.AreEqual(5, meta.Scale);
            Assert.AreEqual("Test", meta.Name);
        }
Exemple #2
0
        public void CreateMetaData()
        {
            Assert.Throws <TypeCannotBeUsedAsAClrTypeException>(() => SqlDecimal.GetTypeHandler().CreateMetaData("Test"));

            SqlTypeHandler col = new SqlDecimal(5.27m, null, null, ParameterDirection.Input);

            Assert.Throws <TypePropertiesMustBeSetExplicitlyException>(() => col.CreateMetaData("Test"));

            col = new SqlDecimal(5.27m, 10, 5, ParameterDirection.Input);
            var meta = col.CreateMetaData("Test");

            Assert.AreEqual(SqlDbType.Decimal, meta.SqlDbType);
            Assert.AreEqual(10, meta.Precision);
            Assert.AreEqual(5, meta.Scale);
            Assert.AreEqual("Test", meta.Name);
        }