Search in sources :

Example 16 with Enrollment

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

the class CourseTest method isStudent_hasStudentEnrollment.

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

Example 17 with Enrollment

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

the class CourseTest method courseHasNoFinalGrade.

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

Example 18 with Enrollment

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

the class CourseTest method isStudent_noStudentEnrollment.

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

Example 19 with Enrollment

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

the class CourseTest method courseGrade_currentScoreNonMGP.

@Test
public void courseGrade_currentScoreNonMGP() {
    Course course = new Course();
    double currentScore = 96.0;
    double finalScore = 47.0;
    Enrollment enrollment = new Enrollment();
    enrollment.setType("student");
    enrollment.setCurrentGradingPeriodId(27);
    enrollment.setComputedCurrentScore(currentScore);
    enrollment.setComputedFinalScore(finalScore);
    ArrayList<Enrollment> enrollments = new ArrayList<>();
    enrollments.add(enrollment);
    course.setEnrollments(enrollments);
    assertTrue(course.getCourseGrade(false).getCurrentScore() == currentScore);
}
Also used : ArrayList(java.util.ArrayList) Enrollment(com.instructure.canvasapi2.models.Enrollment) Course(com.instructure.canvasapi2.models.Course) Test(org.junit.Test)

Example 20 with Enrollment

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

the class CourseTest method isTA_noEnrollments.

@Test
public void isTA_noEnrollments() {
    Course course = new Course();
    course.setEnrollments(new ArrayList<Enrollment>());
    assertEquals(false, course.isTA());
}
Also used : 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