public void AndLess() { WhereList w = new WhereList(global::SqlBuilder.Format.MsSQL); w.Less("a", "b", "c"); string result = w.GetSql(); string sql = "[a]<@a AND [b]<@b AND [c]<@c"; Assert.AreEqual(sql, result); }
public void AndEqualSimple1() { WhereList w = new WhereList(global::SqlBuilder.Format.MsSQL); w.Equal("a", "b", "c"); string result = w.GetSql(); string sql = "[a]=@a AND [b]=@b AND [c]=@c"; Assert.AreEqual(sql, result); }
public void IsNotNullSimple() { WhereList w = new WhereList(global::SqlBuilder.Format.MsSQL); w.IsNotNULL("a", "b", "c"); string result = w.GetSql(); string sql = "[a] IS NOT NULL AND [b] IS NOT NULL AND [c] IS NOT NULL"; Assert.AreEqual(sql, result); }
public void InSimple3() { WhereList w = new WhereList(global::SqlBuilder.Format.MsSQL); w.In("id_user", "SELECT id FROM tab_users"); string result = w.GetSql(); string sql = "[id_user] IN (SELECT id FROM tab_users)"; Assert.AreEqual(sql, result); }
public void RawSimple1() { WhereList w = new WhereList(global::SqlBuilder.Format.MsSQL); w.Raw("[a] IS NULL AND [b]=2 AND [c] NOT LIKE '%text%'"); string result = w.GetSql(); string sql = "[a] IS NULL AND [b]=2 AND [c] NOT LIKE '%text%'"; Assert.AreEqual(sql, result); }
public void WhereParenthesis4() { WhereList w = new WhereList(global::SqlBuilder.Format.MsSQL); w.RawParenthesis("[a] IS NULL OR [b] IS NULL"); string result = w.GetSql(); string sql = "([a] IS NULL OR [b] IS NULL)"; Assert.AreEqual(sql, result); }
public void ComboAndGreaterAndLess() { WhereList w = new WhereList(global::SqlBuilder.Format.MsSQL); w.Greater("a"); w.Less("b"); string result = w.GetSql(); string sql = "[a]>@a AND [b]<@b"; Assert.AreEqual(sql, result); }
public void RawSimple2() { WhereList w = new WhereList(global::SqlBuilder.Format.MsSQL); w.Raw("[a] NOT LIKE '%text%'"); w.Equal("id"); string result = w.GetSql(); string sql = "[a] NOT LIKE '%text%' AND [id]=@id"; Assert.AreEqual(sql, result); }
public void ComboAndEqualAndNotEqual() { WhereList w = new WhereList(global::SqlBuilder.Format.MsSQL); w.EqualValue("a", "1"); w.NotEqualValue("b", "2"); string result = w.GetSql(); string sql = "[a]=1 AND [b]!=2"; Assert.AreEqual(sql, result); }
public void AndNotEqualParamValue() { WhereList w = new WhereList(global::SqlBuilder.Format.MsSQL); w.NotEqualValue("a", "1"); w.NotEqualValue("b", "2"); w.NotEqualValue("c", "3"); string result = w.GetSql(); string sql = "[a]!=1 AND [b]!=2 AND [c]!=3"; Assert.AreEqual(sql, result); }
public void IsNullSimple() { SuperSql.DefaultFormatter = FormatterLibrary.MsSql; var w = new WhereList(SuperSql.DefaultFormatter); w.IsNULL("a", "b", "c"); var result = w.GetSql(); var sql = "[a] IS NULL AND [b] IS NULL AND [c] IS NULL"; Assert.Equal(sql, result); }
public void RawSimple1() { SuperSql.DefaultFormatter = FormatterLibrary.MsSql; var w = new WhereList(SuperSql.DefaultFormatter); w.Raw("[a] IS NULL AND [b]=2 AND [c] NOT LIKE '%text%'"); var result = w.GetSql(); var sql = "[a] IS NULL AND [b]=2 AND [c] NOT LIKE '%text%'"; Assert.Equal(sql, result); }
public void InSimple2() { SuperSql.DefaultFormatter = FormatterLibrary.MsSql; var w = new WhereList(SuperSql.DefaultFormatter); w.In("id_user", "SELECT id FROM tab_users"); var result = w.GetSql(); var sql = "[id_user] IN (SELECT id FROM tab_users)"; Assert.Equal(sql, result); }
public void AndLessParam() { WhereList w = new WhereList(global::SqlBuilder.Format.MsSQL); w.LessValue("a", "1"); w.LessValue("b", "2"); w.LessValue("c", "3"); string result = w.GetSql(); string sql = "[a]<1 AND [b]<2 AND [c]<3"; Assert.AreEqual(sql, result); }
public void AndGreaterParam() { WhereList w = new WhereList(global::SqlBuilder.Format.MsSQL); w.GreaterValue("a", "1"); w.GreaterValue("b", "2"); w.GreaterValue("c", "3"); string result = w.GetSql(); string sql = "[a]>1 AND [b]>2 AND [c]>3"; Assert.AreEqual(sql, result); }
public void WhereParenthesis4() { SuperSql.DefaultFormatter = FormatterLibrary.MsSql; var w = new WhereList(SuperSql.DefaultFormatter); w.RawParenthesis("[a] IS NULL OR [b] IS NULL"); var result = w.GetSql(); var sql = "([a] IS NULL OR [b] IS NULL)"; Assert.Equal(sql, result); }
public void InSimple1() { WhereList w = new WhereList(global::SqlBuilder.Format.MsSQL); w.Equal("a"); w.In("b", "1", "2", "3"); w.Equal("c"); string result = w.GetSql(); string sql = "[a]=@a AND [b] IN (1, 2, 3) AND [c]=@c"; Assert.AreEqual(sql, result); }
public void AndEqualGreater() { SuperSql.DefaultFormatter = FormatterLibrary.MsSql; var w = new WhereList(SuperSql.DefaultFormatter); w.EqualGreater("a", "b", "c"); var result = w.GetSql(); var sql = "[a]>=@a AND [b]>=@b AND [c]>=@c"; Assert.Equal(sql, result); }
public void AndEqualSimple2() { SuperSql.DefaultFormatter = FormatterLibrary.MsSql; var w = new WhereList(SuperSql.DefaultFormatter); w.Equal("a", "b", "c"); var result = w.GetSql("t"); var sql = "[t].[a]=@a AND [t].[b]=@b AND [t].[c]=@c"; Assert.Equal(sql, result); }
public void AndEqualSimple1() { SqlBuilder.DefaultFormatter = FormatterLibrary.MsSql; WhereList w = new WhereList(SqlBuilder.DefaultFormatter); w.Equal("a", "b", "c"); string result = w.GetSql(); string sql = "[a]=@a AND [b]=@b AND [c]=@c"; Assert.AreEqual(sql, result); }
public void AndNotEqualSimple() { SuperSql.DefaultFormatter = FormatterLibrary.MsSql; var w = new WhereList(SuperSql.DefaultFormatter); w.NotEqual("a", "b", "c"); var result = w.GetSql(); var sql = "[a]!=@a AND [b]!=@b AND [c]!=@c"; Assert.Equal(sql, result); }
public void WhereParenthesis4() { SqlBuilder.DefaultFormatter = FormatterLibrary.MsSql; WhereList w = new WhereList(SqlBuilder.DefaultFormatter); w.RawParenthesis("[a] IS NULL OR [b] IS NULL"); string result = w.GetSql(); string sql = "([a] IS NULL OR [b] IS NULL)"; Assert.AreEqual(sql, result); }
public void InSimple2() { SqlBuilder.DefaultFormatter = FormatterLibrary.MsSql; WhereList w = new WhereList(SqlBuilder.DefaultFormatter); w.In("id_user", "SELECT id FROM tab_users"); string result = w.GetSql(); string sql = "[id_user] IN (SELECT id FROM tab_users)"; Assert.AreEqual(sql, result); }
public void RawSimple1() { SqlBuilder.DefaultFormatter = FormatterLibrary.MsSql; WhereList w = new WhereList(SqlBuilder.DefaultFormatter); w.Raw("[a] IS NULL AND [b]=2 AND [c] NOT LIKE '%text%'"); string result = w.GetSql(); string sql = "[a] IS NULL AND [b]=2 AND [c] NOT LIKE '%text%'"; Assert.AreEqual(sql, result); }
public void IsNotNullSimple() { SqlBuilder.DefaultFormatter = FormatterLibrary.MsSql; WhereList w = new WhereList(SqlBuilder.DefaultFormatter); w.IsNotNULL("a", "b", "c"); string result = w.GetSql(); string sql = "[a] IS NOT NULL AND [b] IS NOT NULL AND [c] IS NOT NULL"; Assert.AreEqual(sql, result); }
public void ComboAndGreaterAndLess() { SqlBuilder.DefaultFormatter = FormatterLibrary.MsSql; WhereList w = new WhereList(SqlBuilder.DefaultFormatter); w.Greater("a"); w.Less("b"); string result = w.GetSql(); string sql = "[a]>@a AND [b]<@b"; Assert.AreEqual(sql, result); }
public void RawSimple2() { SqlBuilder.DefaultFormatter = FormatterLibrary.MsSql; WhereList w = new WhereList(SqlBuilder.DefaultFormatter); w.Raw("[a] NOT LIKE '%text%'"); w.Equal("id"); string result = w.GetSql(); string sql = "[a] NOT LIKE '%text%' AND [id]=@id"; Assert.AreEqual(sql, result); }
public void ComboAndEqualAndNotEqual() { SqlBuilder.DefaultFormatter = FormatterLibrary.MsSql; WhereList w = new WhereList(SqlBuilder.DefaultFormatter); w.EqualValue("a", "1"); w.NotEqualValue("b", "2"); string result = w.GetSql(); string sql = "[a]=1 AND [b]!=2"; Assert.AreEqual(sql, result); }
public void RawSimple2() { SuperSql.DefaultFormatter = FormatterLibrary.MsSql; var w = new WhereList(SuperSql.DefaultFormatter); w.Raw("[a] NOT LIKE '%text%'"); w.Equal("id"); var result = w.GetSql(); var sql = "[a] NOT LIKE '%text%' AND [id]=@id"; Assert.Equal(sql, result); }
public void WhereParenthesis1() { WhereList w = new WhereList(global::SqlBuilder.Format.MsSQL); w.OpenParenthesis(); w.Or(); w.IsNULL("a", "b", "c"); w.CloseParenthesis(); string result = w.GetSql(); string sql = "([a] IS NULL OR [b] IS NULL OR [c] IS NULL)"; Assert.AreEqual(sql, result); }