コード例 #1
0
        public void Can_create_simple_parameter()
        {
            var parameter = new RelationalTypeMapping("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);
        }
コード例 #2
0
        public void Can_create_simple_nullable_parameter_with_DbType()
        {
            var parameter = new RelationalTypeMapping("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);
        }
コード例 #3
0
        public void Can_create_simple_nullable_parameter()
        {
            var parameter = new RelationalTypeMapping("int")
                .CreateParameter(new TestCommand(), "Name", 17, isNullable: true);

            Assert.Equal(ParameterDirection.Input, parameter.Direction);
            Assert.Equal("Name", parameter.ParameterName);
            Assert.Equal(17, parameter.Value);
            Assert.Equal(DbType.AnsiString, parameter.DbType);
            Assert.True(parameter.IsNullable);
        }