Ejemplo n.º 1
0
        public void SQLBuilderAppendsEqualsClauseWithStringBasedIdentifiers()
        {
            var          sqlBuilder = new SQLBuilder(string.Empty, SQLCommandType.NotSet);
            const string correctSQL = @"='Dummy'";

            var dummyPOCOWithIntId = new DummyPOCO {
                FirstName = @"Dummy"
            };

            Assert.AreEqual(correctSQL, sqlBuilder.EqualTo(dummyPOCOWithIntId.FirstName).ToString());
        }
Ejemplo n.º 2
0
        public void SQLBuilderAppendsNotEqualClauseWithIntegerBasedIdentifiers()
        {
            var          sqlBuilder = new SQLBuilder(string.Empty, SQLCommandType.NotSet);
            const string correctSQL = @"!=1";

            var dummyPOCOWithIntId = new DummyPOCO {
                Id = 1
            };

            Assert.AreEqual(correctSQL, sqlBuilder.NotEqualTo(dummyPOCOWithIntId.Id).ToString());
        }
Ejemplo n.º 3
0
        public void SQLBuilderWritesCorrectInsertCommand()
        {
            var sqlBuilder = new SQLBuilder(string.Empty, SQLCommandType.NotSet);

            var dummyPoco = new DummyPOCO {
                Id        = 1,
                FirstName = @"Dummy",
                Surname   = @"POCO"
            };

            var parameters = new List <string> {
                @"id", @"firstname", @"surname"
            };
            const string correctSQL = @"insert dbo.myTable (id,firstname,surname) values (1,'Dummy','POCO')";

            Assert.AreEqual(correctSQL, sqlBuilder.Insert(@"myTable", parameters, dummyPoco.Id, dummyPoco.FirstName, dummyPoco.Surname).ToString());
        }