Exemple #1
0
        public void SqlClauseBuilderTest()
        {
            var selectBuilder = new SqlSelectClauseBuilder(this._tableName, SelectClauseBuildMode.StringWithAlias);

            foreach (var field in this._fields)
            {
                selectBuilder.AddField(field.Item1, field.Item2);
            }

            var whereBuilder = new SqlWhereClauseBuilder();

            this._operators.ForEach(o =>
            {
                whereBuilder.AddParameterValue(o.Item1, o.Item2, o.Item3);
            });

            var sqlResult = selectBuilder.ToString() + whereBuilder.ToString();

            Assert.IsNull(sqlResult, sqlResult);
        }
Exemple #2
0
        public void SqlWhereClauseBuilderTest()
        {
            var whereBuilder = new SqlWhereClauseBuilder();

            this._operators.ForEach(o =>
            {
                whereBuilder.AddParameterValue(o.Item1, o.Item2, o.Item3);
            });

            var whereResult = whereBuilder.ToString();
            //Assert.IsTrue(String.IsNullOrWhiteSpace(whereResult), whereResult);

            var paramResult = new StringBuilder();
            var parameters  = whereBuilder.GetParameterAndValues();

            foreach (var p in parameters)
            {
                paramResult.AppendFormat("{0}:{1};", p.Key, p.Value);
            }

            var result = whereResult + paramResult.ToString();

            Assert.Fail(result, result);
        }