public void SqlBagTest() { var whereBuilder = new SqlWhereClauseBuilder(); this._operators.ForEach(o => { whereBuilder.AddParameterValue(o.Item1, o.Item2, o.Item3); }); var parameters = whereBuilder.GetParameterAndValues(); var parameterBuilder = new SqlParameterBuilder(); foreach (var p in parameters) { parameterBuilder.AddParameterValue(p.Key, p.Value); } var parames = parameterBuilder.GetParameters(); var result = new StringBuilder(); foreach (var p in parames) { result.AppendFormat("{0}:{1};", p.ParameterName, p.Value); } Assert.Fail(result.ToString(), result); }
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); }
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); }