Search in sources :

Example 56 with Course

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

the class CourseTest method courseGrade_finalScoreNonMGP.

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

Example 57 with Course

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

the class CourseTest method isTA_hasTaEnrollment.

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

Example 58 with Course

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

the class CourseTest method isTeacher_noTeacherEnrollment.

@Test
public void isTeacher_noTeacherEnrollment() {
    Course course = new Course();
    Enrollment enrollment = new Enrollment();
    enrollment.setType("student");
    ArrayList<Enrollment> enrollments = new ArrayList<>();
    enrollments.add(enrollment);
    course.setEnrollments(enrollments);
    assertEquals(false, 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 59 with Course

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

the class CourseTest method getLicense_CC_ATTRIBUTION_SHARE_ALIKE.

@Test
public void getLicense_CC_ATTRIBUTION_SHARE_ALIKE() {
    Course course = new Course();
    course.setLicense("cc_by_sa");
    assertEquals(Course.LICENSE.CC_ATTRIBUTION_SHARE_ALIKE, course.getLicense());
}
Also used : Course(com.instructure.canvasapi2.models.Course) Test(org.junit.Test)

Example 60 with Course

use of com.instructure.canvasapi2.models.Course 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)

Aggregations

Course (com.instructure.canvasapi2.models.Course)106 Test (org.junit.Test)70 ArrayList (java.util.ArrayList)39 Enrollment (com.instructure.canvasapi2.models.Enrollment)29 RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)17 RestParams (com.instructure.canvasapi2.builders.RestParams)17 View (android.view.View)13 Bundle (android.os.Bundle)10 TextView (android.widget.TextView)10 NonNull (android.support.annotation.NonNull)8 AdapterView (android.widget.AdapterView)8 ModuleItem (com.instructure.canvasapi2.models.ModuleItem)8 ParentFragment (com.instructure.candroid.fragment.ParentFragment)7 CanvasContext (com.instructure.canvasapi2.models.CanvasContext)7 ImageView (android.widget.ImageView)6 LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)6 List (java.util.List)6 BindView (butterknife.BindView)5 RecyclerView (android.support.v7.widget.RecyclerView)4 StatusCallback (com.instructure.canvasapi2.StatusCallback)4