use of org.liberty.android.fantastischmemo.dao.CardDao in project AnyMemo by helloworld1.
the class CardDaoTest method testGetAllCardWithoutFilteringCategory.
@SmallTest
@Test
public void testGetAllCardWithoutFilteringCategory() throws SQLException {
setupThreeCategories();
CardDao cardDao = helper.getCardDao();
List<Card> cards = cardDao.getAllCards(null);
assertEquals(28, (int) cards.size());
}
use of org.liberty.android.fantastischmemo.dao.CardDao in project AnyMemo by helloworld1.
the class CategoryTest method testRemoveCategories.
@SmallTest
@Test
public void testRemoveCategories() throws Exception {
CardDao cardDao = helper.getCardDao();
CategoryDao categoryDao = helper.getCategoryDao();
Category c1 = categoryDao.createOrReturn("c1");
categoryDao.create(c1);
Card nc = new Card();
nc.setCategory(c1);
cardDao.create(nc);
categoryDao.refresh(nc.getCategory());
assertEquals("c1", nc.getCategory().getName());
categoryDao.removeCategory(c1);
nc = cardDao.queryForId(nc.getId());
categoryDao.refresh(nc.getCategory());
assertEquals("", nc.getCategory().getName());
}
use of org.liberty.android.fantastischmemo.dao.CardDao in project AnyMemo by helloworld1.
the class NewDbTest method testCreateFirstCardWithCorrectOrdinal.
@SmallTest
@Test
public void testCreateFirstCardWithCorrectOrdinal() throws Exception {
CardDao cardDao = newDbHelper.getCardDao();
// Create card has null ordinal, append to the end
Card nc = new Card();
assertNull(nc.getOrdinal());
cardDao.create(nc);
assertEquals(1, (int) nc.getOrdinal());
}
use of org.liberty.android.fantastischmemo.dao.CardDao in project AnyMemo by helloworld1.
the class LearnQueuingManagerTest method testGetNewCardQueuingWithCategory.
@SmallTest
@Test
public void testGetNewCardQueuingWithCategory() throws Exception {
CardDao cardDao = helper.getCardDao();
Card c10 = cardDao.queryForId(10);
assertNotNull(c10);
Category cat = new Category();
cat.setName("tt");
c10.setCategory(cat);
cardDao.update(c10);
QueueManager queueManager = new LearnQueueManager.Builder(getContext(), TestHelper.SAMPLE_DB_PATH).setLearnQueueSize(10).setFilterCategory(cat).setCacheSize(50).build();
Card cqueue = queueManager.dequeue();
assertEquals(10, (int) cqueue.getId());
queueManager.release();
}
use of org.liberty.android.fantastischmemo.dao.CardDao in project AnyMemo by helloworld1.
the class QuizQueuingManagerTest method testFilterCategory.
@SmallTest
@Test
public void testFilterCategory() throws Exception {
CardDao cardDao = helper.getCardDao();
Card c10 = cardDao.queryForId(10);
assertNotNull(c10);
Category cat = new Category();
cat.setName("tt");
c10.setCategory(cat);
cardDao.update(c10);
QueueManager queueManager = new QuizQueueManager.Builder().setDbOpenHelper(helper).setFilterCategory(cat).build();
Card cqueue = queueManager.dequeue();
assertEquals(10, (int) cqueue.getId());
}
Aggregations