public virtual void GenerateSqlLiteral_returns_NullableInt_literal_when_null()
        {
#pragma warning disable IDE0034 // Simplify 'default' expression - Causes inference of default(object) due to parameter being object type
            var literal = new IntTypeMapping("int?", DbType.Int32).GenerateSqlLiteral(default(int?));
#pragma warning restore IDE0034 // Simplify 'default' expression
            Assert.Equal("NULL", literal);
        }
        public virtual void Int_literal_generated_correctly()
        {
            var typeMapping = new IntTypeMapping("int", DbType.Int32);

            Test_GenerateSqlLiteral_helper(typeMapping, int.MinValue, "-2147483648");
            Test_GenerateSqlLiteral_helper(typeMapping, int.MaxValue, "2147483647");
        }
        public virtual void NullableInt_literal_generated_correctly()
        {
            var typeMapping = new IntTypeMapping("int?", DbType.Int32);

            Test_GenerateSqlLiteral_helper(typeMapping, default(int?), "NULL");
            Test_GenerateSqlLiteral_helper(typeMapping, (int?)123, "123");
        }
        public virtual void GenerateSqlLiteral_for_Int_works_for_range_limits()
        {
            var typeMapping = new IntTypeMapping("int", DbType.Int32);
            var literal     = typeMapping.GenerateSqlLiteral(int.MinValue);

            Assert.Equal("-2147483648", literal);

            literal = typeMapping.GenerateSqlLiteral(int.MaxValue);
            Assert.Equal("2147483647", literal);
        }
        public void Can_create_simple_nullable_parameter_with_DbType()
        {
            var parameter = new IntTypeMapping("int", DbType.Int32)
                            .CreateParameter(CreateTestCommand(), "Name", 17, nullable: true);

            Assert.Equal(ParameterDirection.Input, parameter.Direction);
            Assert.Equal("Name", parameter.ParameterName);
            Assert.Equal(17, parameter.Value);
            Assert.Equal(DbType.Int32, parameter.DbType);
            Assert.True(parameter.IsNullable);
        }
        public void Can_create_simple_parameter()
        {
            var parameter = new IntTypeMapping("int")
                            .CreateParameter(CreateTestCommand(), "Name", 17, nullable: false);

            Assert.Equal(ParameterDirection.Input, parameter.Direction);
            Assert.Equal("Name", parameter.ParameterName);
            Assert.Equal(17, parameter.Value);
            Assert.Equal(DefaultParameterType, parameter.DbType);
            Assert.False(parameter.IsNullable);
        }
        public virtual void GenerateSqlLiteral_returns_NullableInt_literal_when_not_null()
        {
            var literal = new IntTypeMapping("int?", DbType.Int32).GenerateSqlLiteral((int?)123);

            Assert.Equal("123", literal);
        }