Beispiel #1
0
        public void ResolveSqlNoParams()
        {
            var    query = new ActiveEmployees();
            string sql   = QueryUtil.ResolveSql(query.Sql, query);

            Assert.IsTrue(sql.Equals("SELECT * FROM [Employee] WHERE [IsActive]=@isActive  ORDER BY [Nothing]"));
        }
Beispiel #2
0
        public void ResolveSqlWithQuery()
        {
            var query = new ActiveEmployees()
            {
                LastName = "hello"
            };
            string sql = QueryUtil.ResolveSql(query.Sql, query);

            Assert.IsTrue(sql.Equals("SELECT * FROM [Employee] WHERE [IsActive]=@isActive AND [LastName] LIKE @lastName ORDER BY [Nothing]"));
        }
Beispiel #3
0
        public void ResolveSqlWithParams()
        {
            var query = new ActiveEmployees()
            {
                LastName = "hello", IsActive = true
            };
            string sql = QueryUtil.ResolveSql(query.Sql, query, out DynamicParameters queryParams);

            Assert.IsTrue(queryParams.Get <string>("LastName").Equals("hello"));
            Assert.IsTrue(queryParams.Get <bool>("IsActive").Equals(true));
        }