use of org.liberty.android.fantastischmemo.dao.CardDao in project AnyMemo by helloworld1.
the class CardDaoTest method testGetRandomReviewedCards.
@SmallTest
@Test
public void testGetRandomReviewedCards() throws Exception {
CardDao cardDao = helper.getCardDao();
List<Card> cards = cardDao.getRandomReviewedCards(null, 10);
assertEquals(0, cards.size());
}
use of org.liberty.android.fantastischmemo.dao.CardDao in project AnyMemo by helloworld1.
the class CardDaoTest method testGetScheduledCardCount.
@SmallTest
@Test
public void testGetScheduledCardCount() throws Exception {
CardDao cardDao = helper.getCardDao();
assertEquals(0L, cardDao.getScheduledCardCount(null));
setupThreeCategories();
CategoryDao categoryDao = helper.getCategoryDao();
List<Category> cts = categoryDao.queryForEq("name", "My category");
Category ct = cts.get(0);
assertEquals(0L, cardDao.getScheduledCardCount(ct));
}
use of org.liberty.android.fantastischmemo.dao.CardDao in project AnyMemo by helloworld1.
the class CardDaoTest method testCreateCardMaintainOrdinal.
@SmallTest
@Test
public void testCreateCardMaintainOrdinal() throws Exception {
CardDao cardDao = helper.getCardDao();
// Create card has null ordinal, append to the end
Card nc = new Card();
assertNull(nc.getOrdinal());
cardDao.create(nc);
assertEquals(29, (int) nc.getOrdinal());
// Create card with an ordinal
nc = new Card();
nc.setOrdinal(14);
cardDao.create(nc);
Card c13 = cardDao.queryForId(13);
Card c14 = cardDao.queryForId(14);
Card c15 = cardDao.queryForId(15);
assertEquals(13, (int) c13.getOrdinal());
assertEquals(14, (int) nc.getOrdinal());
assertEquals(15, (int) c14.getOrdinal());
assertEquals(16, (int) c15.getOrdinal());
}
use of org.liberty.android.fantastischmemo.dao.CardDao in project AnyMemo by helloworld1.
the class CardDaoTest method testGetNewCardCount.
@SmallTest
@Test
public void testGetNewCardCount() throws Exception {
CardDao cardDao = helper.getCardDao();
assertEquals(28L, cardDao.getNewCardCount(null));
setupThreeCategories();
CategoryDao categoryDao = helper.getCategoryDao();
List<Category> cts = categoryDao.queryForEq("name", "My category");
Category ct = cts.get(0);
assertEquals(3L, cardDao.getNewCardCount(ct));
}
use of org.liberty.android.fantastischmemo.dao.CardDao in project AnyMemo by helloworld1.
the class CardDaoTest method testCreateCards.
@SmallTest
@Test
public void testCreateCards() throws Exception {
CardDao cardDao = helper.getCardDao();
Card c = new Card();
c.setOrdinal(29);
c.setCategory(new Category());
c.setLearningData(new LearningData());
Card c2 = new Card();
c2.setOrdinal(30);
c2.setCategory(new Category());
c2.setLearningData(new LearningData());
List<Card> cards = new ArrayList<Card>();
cards.add(c);
cards.add(c2);
cardDao.createCards(cards);
// Should create two new card
assertEquals(30, cardDao.countOf());
// The new card's id and ordinal should be correct
assertEquals(29, (int) c.getId());
assertEquals(29, (int) c.getOrdinal());
assertEquals(30, (int) c2.getId());
assertEquals(30, (int) c2.getOrdinal());
}
Aggregations