Added unit test for recording outstanding entries when using DatabaseDao.update

pull/14/head
Sam Bosley 12 years ago
parent c18e305448
commit 55b2f827c0

@ -1,7 +1,5 @@
package com.todoroo.astrid.sync;
import android.text.TextUtils;
import com.todoroo.andlib.data.TodorooCursor;
import com.todoroo.andlib.sql.Criterion;
import com.todoroo.andlib.sql.Query;
@ -41,6 +39,31 @@ public class SyncModelTest extends NewSyncTestCase {
}
}
public void testUpdateMakesAllOutstandingEntries() {
String title = "Task Important";
createTask(title, true);
createTask("Task Not Important", true);
createTask(title, true);
Task template = new Task();
template.setValue(Task.IMPORTANCE, Task.IMPORTANCE_DO_OR_DIE);
taskDao.update(Task.TITLE.eq(title), template);
TodorooCursor<TaskOutstanding> cursor = taskOutstandingDao.query(Query.select(TaskOutstanding.PROPERTIES));
try {
assertEquals(2, cursor.getCount());
TaskOutstanding to = new TaskOutstanding();
for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
to.readPropertiesFromCursor(cursor);
assertEquals(Task.IMPORTANCE.name, to.getValue(TaskOutstanding.COLUMN_STRING));
assertEquals(Task.IMPORTANCE_DO_OR_DIE, Integer.parseInt(to.getValue(TaskOutstanding.VALUE_STRING)));
}
} finally {
cursor.close();
}
}
public void testChangeTagMakesOutstandingEntries() {
TagData tag = createTagData();
String newName = "changing tag name";

Loading…
Cancel
Save