示例#1
0
文件: sql.cs 项目: Jonjump/dcp
        public void emptyString2nonNullableInt()
        {
            schema.Add(new dcp.lib.Formatters.Sql.Column(1, false, "int", "colname"));
            var row = new dcp.lib.Row();

            row.Add("");
            Assert.Equal("INSERT INTO [testTable] VALUES (DEFAULT);", formatter.Format(row));
        }
示例#2
0
文件: sql.cs 项目: Jonjump/dcp
        public void datetime2datetime()
        {
            schema.Add(new dcp.lib.Formatters.Sql.Column(1, false, "datetime", "colname"));
            var row = new dcp.lib.Row();

            row.Add(new DateTime(1961, 3, 14, 1, 2, 3));
            Assert.Equal("INSERT INTO [testTable] VALUES ('1961-03-14 01:02:03');", formatter.Format(row));
        }
示例#3
0
文件: sql.cs 项目: Jonjump/dcp
        public void null2nullableInt()
        {
            schema.Add(new dcp.lib.Formatters.Sql.Column(1, true, "int", "colname"));
            var row = new dcp.lib.Row();

            row.Add(null);
            Assert.Equal("INSERT INTO [testTable] VALUES (NULL);", formatter.Format(row));
        }
示例#4
0
文件: sql.cs 项目: Jonjump/dcp
        public void string2int()
        {
            schema.Add(new dcp.lib.Formatters.Sql.Column(1, false, "int", "colname"));
            var row = new dcp.lib.Row();

            row.Add("1");
            Assert.Equal("INSERT INTO [testTable] VALUES (1);", formatter.Format(row));
        }
示例#5
0
文件: sql.cs 项目: Jonjump/dcp
        public void emptyString2nullableDatetime()
        {
            schema.Add(new dcp.lib.Formatters.Sql.Column(1, true, "datetime", "colname"));
            var row = new dcp.lib.Row();

            row.Add(" ");
            Assert.Equal("INSERT INTO [testTable] VALUES (NULL);", formatter.Format(row));
        }
示例#6
0
文件: sql.cs 项目: Jonjump/dcp
        public void EscapesStringWithSingleQuote()
        {
            schema.Add(new dcp.lib.Formatters.Sql.Column(1, true, "varchar", "colname"));
            var row = new dcp.lib.Row();

            row.Add("tw'o");

            Assert.Equal("INSERT INTO [testTable] VALUES ('tw''o');", formatter.Format(row));
        }
示例#7
0
文件: sql.cs 项目: Jonjump/dcp
        public void DoesNotQuoteStringTwice()
        {
            schema.Add(new dcp.lib.Formatters.Sql.Column(1, true, "varchar", "colname"));
            var row = new dcp.lib.Row();

            row.Add("\"here\"");

            Assert.Equal("INSERT INTO [testTable] VALUES ('here');", formatter.Format(row));
        }
示例#8
0
文件: sql.cs 项目: Jonjump/dcp
        public void whitespaceString2string()
        {
            schema.Add(new dcp.lib.Formatters.Sql.Column(1, true, "varchar", "colname"));
            var row = new dcp.lib.Row();

            row.Add(" ");

            Assert.Equal("INSERT INTO [testTable] VALUES (' ');", formatter.Format(row));
        }
示例#9
0
文件: sql.cs 项目: Jonjump/dcp
        public void null2nonNullableInt()
        {
            schema.Add(new dcp.lib.Formatters.Sql.Column(1, false, "int", "colname"));
            var row = new dcp.lib.Row();

            row.Add(null);
            var ex = Record.Exception(() => formatter.Format(row));

            Assert.IsType <ArgumentNullException>(ex);
            Assert.Contains(schema[0].columnName, ex.Message);
        }