public void DeleteCat() { ConsoleTitleUtil.ShowTestTitle("DeleteCat"); int retval = TCat.delete(30); Assert.AreEqual(1, retval); // 删除了一条记录 Console.WriteLine("\n删除 {0} 条记录 \n", retval); TCat mycat = TCat.findById(30); Assert.IsNull(mycat); }
public void FindPropertyNull() { string artIds = ""; string catIds = ""; ArrayList list = new ArrayList(); IList arts = new ArrayList(); for (int i = 0; i < 5; i++) { TCat cat = new TCat(); cat.Name = "tempCat1"; cat.insert(); list.Add(cat); catIds += cat.Id + ","; TArticle art = new TArticle(); art.Title = "这是什么地方的测试" + i; art.Cat = cat; art.insert(); arts.Add(art); artIds += art.Id + ","; cat.delete(); } catIds = catIds.TrimEnd(','); artIds = artIds.TrimEnd(','); IList <TArticle> results = TArticle.find("Id in (" + artIds + ")").list(); foreach (TArticle art in results) { Assert.IsNull(art.Cat); Console.WriteLine(art.Title); //Console.WriteLine( "Id:" + art.Cat.Id + " catNull:" + art.Cat.IsNull() + " nameNull:" + strUtil.IsNullOrEmpty( art.Cat.Name ) ); } }
public void FindPropertyNull() { string artIds = ""; string catIds = ""; ArrayList list = new ArrayList(); IList arts = new ArrayList(); for (int i = 0; i < 5; i++) { TCat cat = new TCat(); cat.Name = "tempCat1"; cat.insert(); list.Add( cat ); catIds += cat.Id + ","; TArticle art = new TArticle(); art.Title = "这是什么地方的测试" + i; art.Cat = cat; art.insert(); arts.Add( art ); artIds += art.Id + ","; cat.delete(); } catIds = catIds.TrimEnd( ',' ); artIds = artIds.TrimEnd( ',' ); IList<TArticle> results = TArticle.find( "Id in (" + artIds + ")" ).list(); foreach (TArticle art in results) { Assert.IsNull( art.Cat ); Console.WriteLine( art.Title ); //Console.WriteLine( "Id:" + art.Cat.Id + " catNull:" + art.Cat.IsNull() + " nameNull:" + strUtil.IsNullOrEmpty( art.Cat.Name ) ); } }