Ejemplo n.º 1
0
        public void ToString_NullTableName()
        {
            //Arrange
            var q = new UpdateQuery();

            //Act
            q.ToString();
        }
Ejemplo n.º 2
0
        public void ToString_NullValues()
        {
            //Arrange
            var q = new UpdateQuery()
            {
                TableName = "t"
            };

            //Act
            q.ToString();
        }
Ejemplo n.º 3
0
        public void ToString_EmptyTableName()
        {
            //Arrange
            var q = new UpdateQuery()
            {
                TableName = ""
            };

            //Act
            q.ToString();
        }
        public void test_Update()
        {
            var u = new UpdateQuery()
            {
                Table  = "TestTable",
                Values =
                {
                    { "Column1",      1 },
                    { "Column2", true   },
                    { "Column3", "test" }
                }
            };

            Assert.AreEqual("UPDATE TestTable SET Column1 = 1, Column2 = 1, Column3 = 'test';", u.ToString());
        }
        public void test_Update_Where()
        {
            var u = new UpdateQuery()
            {
                Table  = "TestTable",
                Values =
                {
                    { "Column1",      1 },
                    { "Column2", true   },
                    { "Column3", "test" }
                },
                Where = new Equals
                {
                    Left  = "Column1",
                    Right = 1
                }
            };

            Assert.AreEqual("UPDATE TestTable SET Column1 = 1, Column2 = 1, Column3 = 'test' WHERE ( Column1 = 1 );", u.ToString());

            u.Where = new And
            {
                Left = new Equals
                {
                    Left  = "Column1",
                    Right = 1
                },
                Right = new Equals
                {
                    Left  = "Column2",
                    Right = 1
                },
            };

            Assert.AreEqual("UPDATE TestTable SET Column1 = 1, Column2 = 1, Column3 = 'test' WHERE ( ( Column1 = 1 ) AND ( Column2 = 1 ) );", u.ToString());
        }