Ejemplo n.º 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 }));
        }
Ejemplo n.º 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));
 }
Ejemplo n.º 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));
        }
Ejemplo n.º 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"}));
 }
Ejemplo n.º 5
0
 public void FormattingWithNullValue()
 {
     var db = new MyDb();
     Assert.AreEqual("sql @0\n\t -> @0 [] = \"\"", db.FormatCommand("sql @0", new object[] { null }));
 }
Ejemplo n.º 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" }));
        }
Ejemplo n.º 7
0
        public void FormattingWithNullValue()
        {
            var db = new MyDb();

            Assert.AreEqual("sql @0\n\t -> @0 [] = \"\"", db.FormatCommand("sql @0", new object[] { null }));
        }
Ejemplo n.º 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" }));
        }
Ejemplo n.º 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 }));
        }