public void testDelete() { Random rd = new Random(); for (int i = 0; i < 20; i++) { int id = rd.Next( 1, 11 ); Console.WriteLine( "随机ID:" + id ); Book book = new Book().findById( id ) as Book; if (book != null) { book.delete(); Console.WriteLine( "删除:" + id ); } } }
public void testDelete() { Random rd = new Random(); for (int i = 0; i < 20; i++) { int id = rd.Next(1, 11); Console.WriteLine("随机ID:" + id); Book book = new Book().findById(id) as Book; if (book != null) { book.delete(); Console.WriteLine("删除:" + id); } } }
public void testFindBy_Delete() { IList books = new Book().findBy("Name", "zhangsan5"); Assert.AreEqual(1, books.Count); Book book = books[0] as Book; book.delete(); IList newBooks = new Book().findBy("Name", "zhangsan5"); Assert.AreEqual(0, newBooks.Count); int allCount = new Book().findAll().Count; Assert.AreEqual(9, allCount); }
public void testDelete3() { Book mybook = new Book(); IList all = mybook.findAll(); Assert.AreEqual(10, all.Count); int deleteCount = 0; int bookCount = all.Count; for (int i = 0; i < bookCount; i++) { Book book = all[i] as Book; book.delete(); deleteCount++; } Assert.AreEqual(bookCount, deleteCount); IList results = mybook.findAll(); Assert.AreEqual(0, results.Count); }