public void FindCondition_Simply3() { ConsoleTitleUtil.ShowTestTitle("FindCondition_Simply"); TCat mycat = TCat.find("Id=" + 3).first(); Assert.IsNotNull(mycat); Assert.AreEqual("娱乐电影", mycat.Name); }
public void FindCondition_LikeParams() { ConsoleTitleUtil.ShowTestTitle("FindCondition_LikeParams"); List <TCat> cats = TCat.find("Name like '%'+:t+'%'").set("t", "新闻").list(); Assert.AreEqual(2, cats.Count); Assert.AreEqual("国际新闻", cats[0].Name); Assert.AreEqual("国内新闻", cats[1].Name); }
public void FindCondition_Simply2() { ConsoleTitleUtil.ShowTestTitle("FindCondition_Simply"); IList <TCat> cats = TCat.find("Id>" + 5).select("Id,Name,ArticleCount").list(); Assert.AreEqual(7, cats.Count); foreach (TCat cat in cats) { Assert.Greater(cat.Id, 0); Assert.IsNotNull(cat.Name); } }
public void FindCondition_Params() { ConsoleTitleUtil.ShowTestTitle("FindCondition_Params"); List <TCat> cats = TCat.find("Id in (:id1,:id2,:id3)") .set("id1", 6) .set("id2", 7) .set("id8", 8) .list(); Assert.AreEqual(3, cats.Count); foreach (TCat cat in cats) { Assert.Greater(cat.Id, 0); Assert.IsNotNull(cat.Name); Console.WriteLine(cat.Id); } }