示例#1
0
        public void FormattingWithSqlParameterThatIsNotNull()
        {
            var cmd = new SqlCommand();

            cmd.Parameters.Add(new SqlParameter("Test", SqlDbType.NVarChar));
            var db = new MyDb();

            Assert.AreEqual("DECLARE @0 NVarChar[4000] = 'value'\n\nsql @0", db.FormatCommand("sql @0", new object[] { "value" }));
            Assert.AreEqual("DECLARE @0 Int = '32'\n\nsql @0", db.FormatCommand("sql @0", new object[] { 32 }));
            Assert.AreEqual("DECLARE @0 DateTime = '" + DateTime.Today + "'\n\nsql @0", db.FormatCommand("sql @0", new object[] { DateTime.Today }));

            var guid = Guid.NewGuid();

            Assert.AreEqual("DECLARE @0 UniqueIdentifier = '" + guid + "'\n\nsql @0", db.FormatCommand("sql @0", new object[] { guid }));
        }
示例#2
0
 public void FormattingWithSqlParameterThatIsNotNull()
 {
     var cmd = new SqlCommand();
     cmd.Parameters.Add(new SqlParameter("Test", SqlDbType.NVarChar));
     var db = new MyDb();
     Assert.AreEqual("\n\t -> @0 [SqlParameter, String] = \"\"", db.FormatCommand(cmd));
 }
示例#3
0
        public void FormattingWithSqlParameterThatIsNotNull()
        {
            var cmd = new SqlCommand();

            cmd.Parameters.Add(new SqlParameter("Test", SqlDbType.NVarChar));
            var db = new MyDb();

            Assert.AreEqual("\n\t -> @0 [SqlParameter, String] = \"\"", db.FormatCommand(cmd));
        }
示例#4
0
 public void FormattingWithStringValue()
 {
     var db = new MyDb();
     Assert.AreEqual("sql @0\n\t -> @0 [String] = \"value\"", db.FormatCommand("sql @0", new object [] {"value"}));
 }
示例#5
0
 public void FormattingWithNullValue()
 {
     var db = new MyDb();
     Assert.AreEqual("sql @0\n\t -> @0 [] = \"\"", db.FormatCommand("sql @0", new object[] { null }));
 }
示例#6
0
        public void FormattingWithStringValue()
        {
            var db = new MyDb();

            Assert.AreEqual("sql @0\n\t -> @0 [String] = \"value\"", db.FormatCommand("sql @0", new object [] { "value" }));
        }
示例#7
0
        public void FormattingWithNullValue()
        {
            var db = new MyDb();

            Assert.AreEqual("sql @0\n\t -> @0 [] = \"\"", db.FormatCommand("sql @0", new object[] { null }));
        }
示例#8
0
        public void FormattingWithStringValue()
        {
            var db = new MyDb();

            Assert.AreEqual("DECLARE @0 NVarChar[4000] = 'value'\n\nsql @0", db.FormatCommand("sql @0", new object[] { "value" }));
        }
示例#9
0
        public void FormattingWithNullValue()
        {
            var db = new MyDb();

            Assert.AreEqual("DECLARE @0 NVarChar = null\n\nsql @0", db.FormatCommand("sql @0", new object[] { null }));
        }