Search in sources :

Example 46 with Assignment

use of com.instructure.canvasapi2.models.Assignment in project instructure-android by instructure.

the class CalendarListRecyclerAdapterTest method testAreContentsTheSame_differentAssignment.

@Test
public void testAreContentsTheSame_differentAssignment() {
    ScheduleItem scheduleItem1 = new ScheduleItem();
    scheduleItem1.setTitle("ScheduleItem1");
    Date date = new Date();
    scheduleItem1.setStartAt(date);
    Assignment assignment1 = new Assignment();
    assignment1.setDueAt(APIHelper.dateToString(new Date(Calendar.getInstance().getTimeInMillis() - 1000)));
    scheduleItem1.setAssignment(assignment1);
    ScheduleItem scheduleItem2 = new ScheduleItem();
    scheduleItem2.setTitle("ScheduleItem1");
    scheduleItem2.setStartAt(date);
    Assignment assignment2 = new Assignment();
    assignment2.setDueAt(APIHelper.dateToString(new Date(Calendar.getInstance().getTimeInMillis() + 1000)));
    scheduleItem2.setAssignment(assignment2);
    assertFalse(mAdapter.createItemCallback().areContentsTheSame(scheduleItem1, scheduleItem2));
}
Also used : Assignment(com.instructure.canvasapi2.models.Assignment) ScheduleItem(com.instructure.canvasapi2.models.ScheduleItem) Date(java.util.Date) Test(org.junit.Test)

Example 47 with Assignment

use of com.instructure.canvasapi2.models.Assignment in project instructure-android by instructure.

the class CalendarListRecyclerAdapterTest method testAreContentsTheSame_nullAssignment.

@Test
public void testAreContentsTheSame_nullAssignment() {
    ScheduleItem scheduleItem1 = new ScheduleItem();
    scheduleItem1.setTitle("ScheduleItem1");
    Date date = new Date();
    scheduleItem1.setStartAt(date);
    Assignment assignment1 = new Assignment();
    assignment1.setDueAt(APIHelper.dateToString(date));
    scheduleItem1.setAssignment(assignment1);
    ScheduleItem scheduleItem2 = new ScheduleItem();
    scheduleItem2.setTitle("ScheduleItem1");
    scheduleItem2.setStartAt(date);
    Assignment assignment2 = null;
    scheduleItem2.setAssignment(assignment2);
    assertFalse(mAdapter.createItemCallback().areContentsTheSame(scheduleItem1, scheduleItem2));
}
Also used : Assignment(com.instructure.canvasapi2.models.Assignment) ScheduleItem(com.instructure.canvasapi2.models.ScheduleItem) Date(java.util.Date) Test(org.junit.Test)

Example 48 with Assignment

use of com.instructure.canvasapi2.models.Assignment in project instructure-android by instructure.

the class GradesListRecyclerAdapterTest method testAreContentsTheSame_DifferentName.

@Test
public void testAreContentsTheSame_DifferentName() {
    Assignment assignment1 = new Assignment();
    assignment1.setName("assignment1");
    assignment1.setPointsPossible(0.0);
    Assignment assignment2 = new Assignment();
    assignment2.setName("assignment2");
    assignment2.setPointsPossible(0.0);
    assertFalse(mAdapter.createItemCallback().areContentsTheSame(assignment1, assignment2));
}
Also used : Assignment(com.instructure.canvasapi2.models.Assignment) Test(org.junit.Test)

Example 49 with Assignment

use of com.instructure.canvasapi2.models.Assignment in project instructure-android by instructure.

the class GradesListRecyclerAdapterTest method testAreContentsTheSame_SameWithSubmission.

@Test
public void testAreContentsTheSame_SameWithSubmission() {
    Assignment assignment = new Assignment();
    assignment.setName("assignment");
    assignment.setPointsPossible(0.0);
    Submission submission = new Submission();
    submission.setGrade("A");
    assignment.setSubmission(submission);
    assertTrue(mAdapter.createItemCallback().areContentsTheSame(assignment, assignment));
}
Also used : Assignment(com.instructure.canvasapi2.models.Assignment) Submission(com.instructure.canvasapi2.models.Submission) Test(org.junit.Test)

Example 50 with Assignment

use of com.instructure.canvasapi2.models.Assignment in project instructure-android by instructure.

the class TodoListRecyclerAdapterTest method testAreContentsTheSame_SameTitleFromAssignment.

@Test
public void testAreContentsTheSame_SameTitleFromAssignment() {
    ToDo item = new ToDo();
    Assignment assignment = new Assignment();
    assignment.setName("item");
    item.setAssignment(assignment);
    assertTrue(mAdapter.createItemCallback().areContentsTheSame(item, item));
}
Also used : Assignment(com.instructure.canvasapi2.models.Assignment) ToDo(com.instructure.canvasapi2.models.ToDo) Test(org.junit.Test)

Aggregations

Assignment (com.instructure.canvasapi2.models.Assignment)62 Test (org.junit.Test)46 Submission (com.instructure.canvasapi2.models.Submission)25 Date (java.util.Date)18 ArrayList (java.util.ArrayList)15 View (android.view.View)10 RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)10 Course (com.instructure.canvasapi2.models.Course)9 RestParams (com.instructure.canvasapi2.builders.RestParams)7 Bundle (android.os.Bundle)6 ScheduleItem (com.instructure.canvasapi2.models.ScheduleItem)6 LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)6 Navigation (com.instructure.interactions.Navigation)5 DrawableRes (android.support.annotation.DrawableRes)4 AdapterView (android.widget.AdapterView)4 TextView (android.widget.TextView)4 Request (okhttp3.Request)4 Response (okhttp3.Response)4 Paint (android.graphics.Paint)3 Drawable (android.graphics.drawable.Drawable)3