public void SelectString_쿼리_가져오기() { OracleORMHelper helper = new OracleORMHelper(); OracleRepositoryString RepositoryString = new OracleRepositoryString(helper); TestClass t = new TestClass(); Test2Class t2 = new Test2Class(); string expect = "SELECT * FROM Test WHERE 1=1"; var actual = RepositoryString.SelectString(t); Assert.Equal(expect, actual); t.Id = 1; string expect2 = "SELECT * FROM Test WHERE 1=1 AND Test.Id = :Id"; var actual2 = RepositoryString.SelectString(t); Assert.Equal(expect2, actual2); }
public void SelectString_연산자_이용해서_쿼리_가져오기() { OracleORMHelper helper = new OracleORMHelper(); OracleRepositoryString RepositoryString = new OracleRepositoryString(helper); TestClass t = new TestClass(); string expect = "SELECT * FROM Test WHERE 1=1 AND Test.Id < 1"; var actual = RepositoryString.SelectString(t, new ParamColumn("Id", "<", "1")); Assert.Equal(expect, actual); string expect2 = "SELECT * FROM Test WHERE 1=1 AND Test.Id >= 6 AND Test.Data BETWEEN 1 AND 8"; var actual2 = RepositoryString.SelectString(t, new ParamColumn(nameof(t.Id), ">=", "6"), new ParamColumn(nameof(t.Data), "between", "1", "8")); Assert.Equal(expect2, actual2); string expect3 = "SELECT * FROM Test WHERE 1=1 AND Test.RealColumnName IS NOT NULL AND Test.Data LIKE '%TEST'"; var actual3 = RepositoryString.SelectString(t, new ParamColumn(helper.ColumnName(t, nameof(t.FakeNameColumn)), "is not null"), new ParamColumn(nameof(t.Data), "like", "'%TEST'")); Assert.Equal(expect3, actual3); }