public static void CastToBoolean(byte singleByte, bool expected)
        {
            var type = new SqlBinaryType(SqlTypeCode.Binary);

            var value = new SqlBinary(new[] { singleByte });

            Assert.True(type.CanCastTo(value, PrimitiveTypes.Bit()));

            var result = type.Cast(value, PrimitiveTypes.Bit());

            Assert.NotNull(result);
            Assert.IsType <SqlBoolean>(result);

            Assert.Equal(expected, (bool?)((SqlBoolean)result));
        }
Ejemplo n.º 2
0
 public static SqlObject Bit(SqlBoolean?value)
 => new SqlObject(PrimitiveTypes.Bit(), value);