Search in sources :

Example 41 with Enrollment

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

the class CourseTest method isTeacher_hasTeacherEnrollment.

@Test
public void isTeacher_hasTeacherEnrollment() {
    Course course = new Course();
    Enrollment enrollment = new Enrollment();
    enrollment.setType("teacher");
    ArrayList<Enrollment> enrollments = new ArrayList<>();
    enrollments.add(enrollment);
    course.setEnrollments(enrollments);
    assertEquals(true, course.isTeacher());
}
Also used : ArrayList(java.util.ArrayList) Enrollment(com.instructure.canvasapi2.models.Enrollment) Course(com.instructure.canvasapi2.models.Course) Test(org.junit.Test)

Example 42 with Enrollment

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

the class CourseTest method courseHasNoCurrentGrade.

@Test
public void courseHasNoCurrentGrade() {
    Course course = new Course();
    Enrollment enrollment = new Enrollment();
    enrollment.setType("student");
    enrollment.setComputedCurrentGrade("");
    enrollment.setComputedCurrentScore(null);
    ArrayList<Enrollment> enrollments = new ArrayList<>();
    enrollments.add(enrollment);
    course.setEnrollments(enrollments);
    assertTrue(course.getCourseGrade(false).getNoCurrentGrade());
}
Also used : ArrayList(java.util.ArrayList) Enrollment(com.instructure.canvasapi2.models.Enrollment) Course(com.instructure.canvasapi2.models.Course) Test(org.junit.Test)

Example 43 with Enrollment

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

the class CourseTest method isObserver_noEnrollments.

@Test
public void isObserver_noEnrollments() {
    Course course = new Course();
    course.setEnrollments(new ArrayList<Enrollment>());
    assertEquals(false, course.isObserver());
}
Also used : Enrollment(com.instructure.canvasapi2.models.Enrollment) Course(com.instructure.canvasapi2.models.Course) Test(org.junit.Test)

Example 44 with Enrollment

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

the class CourseTest method courseHasCurrentGrade.

@Test
public void courseHasCurrentGrade() {
    Course course = new Course();
    Enrollment enrollment = new Enrollment();
    enrollment.setType("student");
    enrollment.setComputedCurrentGrade("A");
    enrollment.setComputedCurrentScore(95.0);
    ArrayList<Enrollment> enrollments = new ArrayList<>();
    enrollments.add(enrollment);
    course.setEnrollments(enrollments);
    assertFalse(course.getCourseGrade(false).getNoCurrentGrade());
}
Also used : ArrayList(java.util.ArrayList) Enrollment(com.instructure.canvasapi2.models.Enrollment) Course(com.instructure.canvasapi2.models.Course) Test(org.junit.Test)

Example 45 with Enrollment

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

the class CourseTest method isObserver_hasObserverEnrollment.

@Test
public void isObserver_hasObserverEnrollment() {
    Course course = new Course();
    Enrollment enrollment = new Enrollment();
    enrollment.setType("observer");
    ArrayList<Enrollment> enrollments = new ArrayList<>();
    enrollments.add(enrollment);
    course.setEnrollments(enrollments);
    assertEquals(true, course.isObserver());
}
Also used : ArrayList(java.util.ArrayList) Enrollment(com.instructure.canvasapi2.models.Enrollment) Course(com.instructure.canvasapi2.models.Course) Test(org.junit.Test)

Aggregations

Enrollment (com.instructure.canvasapi2.models.Enrollment)55 Test (org.junit.Test)46 Course (com.instructure.canvasapi2.models.Course)30 ArrayList (java.util.ArrayList)25 RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)7 RestParams (com.instructure.canvasapi2.builders.RestParams)7 NonNull (android.support.annotation.NonNull)4 Grades (com.instructure.canvasapi2.models.Grades)4 StatusCallback (com.instructure.canvasapi2.StatusCallback)3 ExhaustiveListCallback (com.instructure.canvasapi2.utils.ExhaustiveListCallback)3 List (java.util.List)3 GradingPeriod (com.instructure.canvasapi2.models.GradingPeriod)2 User (com.instructure.canvasapi2.models.User)2 Application (android.app.Application)1 PackageInfo (android.content.pm.PackageInfo)1 PackageManager (android.content.pm.PackageManager)1 View (android.view.View)1 BasicUser (com.instructure.canvasapi2.models.BasicUser)1 ErrorReportResult (com.instructure.canvasapi2.models.ErrorReportResult)1 ApiType (com.instructure.canvasapi2.utils.ApiType)1