use of com.instructure.canvasapi2.models.Assignment in project instructure-android by instructure.
the class AssignmentUtils2Test method getAssignmentState_stateSubmitted.
@Test
public void getAssignmentState_stateSubmitted() throws Exception {
Assignment assignment = new Assignment();
Submission submission = new Submission();
long time = Calendar.getInstance().getTimeInMillis() + 100000;
Date date = new Date(time);
submission.setAttempt(1);
assignment.setSubmission(submission);
assignment.setDueAt(APIHelper.dateToString(date));
int testValue = AssignmentUtils2.getAssignmentState(assignment, submission);
assertEquals("", testValue, AssignmentUtils2.ASSIGNMENT_STATE_SUBMITTED);
}
use of com.instructure.canvasapi2.models.Assignment in project instructure-android by instructure.
the class ViewUtilsTest method getAssignmentIconOrder.
@Test
public void getAssignmentIconOrder() throws Exception {
/**
* Tests the order that the icons are retrieved.
* Quizzes, Discussion Topics, Assignment icons in that order
*
* To properly test the order we need to test the method 3 times for each icon type
*/
Assignment assignment = new Assignment();
List<String> types = new ArrayList<>();
@DrawableRes int iconRes = 0;
// Add all other submission types
types.add(submissionTypeToAPIString(Assignment.SUBMISSION_TYPE.NONE));
types.add(submissionTypeToAPIString(Assignment.SUBMISSION_TYPE.ON_PAPER));
types.add(submissionTypeToAPIString(Assignment.SUBMISSION_TYPE.EXTERNAL_TOOL));
types.add(submissionTypeToAPIString(Assignment.SUBMISSION_TYPE.ONLINE_UPLOAD));
types.add(submissionTypeToAPIString(Assignment.SUBMISSION_TYPE.ONLINE_TEXT_ENTRY));
types.add(submissionTypeToAPIString(Assignment.SUBMISSION_TYPE.ONLINE_URL));
types.add(submissionTypeToAPIString(Assignment.SUBMISSION_TYPE.MEDIA_RECORDING));
types.add(submissionTypeToAPIString(Assignment.SUBMISSION_TYPE.ATTENDANCE));
types.add(submissionTypeToAPIString(Assignment.SUBMISSION_TYPE.NOT_GRADED));
assignment.setSubmissionTypes(types);
iconRes = ViewUtils.getAssignmentIcon(assignment);
assertTrue(iconRes == R.drawable.ic_cv_assignments_fill);
// Add the one we want to test
types.add(submissionTypeToAPIString(Assignment.SUBMISSION_TYPE.DISCUSSION_TOPIC));
assignment.setSubmissionTypes(types);
iconRes = ViewUtils.getAssignmentIcon(assignment);
assertTrue(iconRes == R.drawable.ic_cv_discussions_fill);
// Add the next one we want to test
types.add(submissionTypeToAPIString(Assignment.SUBMISSION_TYPE.ONLINE_QUIZ));
assignment.setSubmissionTypes(types);
iconRes = ViewUtils.getAssignmentIcon(assignment);
assertTrue(iconRes == R.drawable.ic_cv_quizzes_fill);
}
use of com.instructure.canvasapi2.models.Assignment in project instructure-android by instructure.
the class ViewUtilsTest method getAssignmentIcon_DISCUSSION_TOPIC.
@Test
public void getAssignmentIcon_DISCUSSION_TOPIC() throws Exception {
Assignment assignment = new Assignment();
List<String> types = new ArrayList<>();
types.add(submissionTypeToAPIString(Assignment.SUBMISSION_TYPE.DISCUSSION_TOPIC));
assignment.setSubmissionTypes(types);
@DrawableRes int iconRes = ViewUtils.getAssignmentIcon(assignment);
assertTrue(iconRes == R.drawable.ic_cv_discussions_fill);
}
use of com.instructure.canvasapi2.models.Assignment in project instructure-android by instructure.
the class ViewUtilsTest method getAssignmentIcon_ONLINE_QUIZ.
@Test
public void getAssignmentIcon_ONLINE_QUIZ() throws Exception {
Assignment assignment = new Assignment();
List<String> types = new ArrayList<>();
types.add(submissionTypeToAPIString(Assignment.SUBMISSION_TYPE.ONLINE_QUIZ));
assignment.setSubmissionTypes(types);
@DrawableRes int iconRes = ViewUtils.getAssignmentIcon(assignment);
assertTrue(iconRes == R.drawable.ic_cv_quizzes_fill);
}
use of com.instructure.canvasapi2.models.Assignment in project instructure-android by instructure.
the class AssignmentTest method isLocked_TestNullLockInfo.
// region isLocked
@Test
public void isLocked_TestNullLockInfo() {
Assignment assignment = new Assignment();
assignment.setLockInfo(null);
assertEquals(false, assignment.isLocked());
}
Aggregations