Search in sources :

Example 46 with Course

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

the class CourseTest method getLicense_CC_ATTRIBUTION.

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

Example 47 with Course

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

the class CourseTest method addEnrollment.

@Test
public void addEnrollment() {
    Course course = new Course();
    course.setEnrollments(null);
    Enrollment enrollment = new Enrollment();
    course.addEnrollment(enrollment);
    assertEquals(true, course.getEnrollments().contains(enrollment));
}
Also used : Enrollment(com.instructure.canvasapi2.models.Enrollment) Course(com.instructure.canvasapi2.models.Course) Test(org.junit.Test)

Example 48 with Course

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

the class CourseTest method isCourseGradeLocked_hideAllGradingPeriods.

@Test
public void isCourseGradeLocked_hideAllGradingPeriods() {
    Course course = new Course();
    course.setHasGradingPeriods(true);
    Enrollment enrollment = new Enrollment();
    enrollment.setType("student");
    enrollment.setCurrentGradingPeriodId(0);
    enrollment.setMultipleGradingPeriodsEnabled(true);
    enrollment.setTotalsForAllGradingPeriodsOption(false);
    ArrayList<Enrollment> enrollments = new ArrayList<>();
    enrollments.add(enrollment);
    course.setEnrollments(enrollments);
    assertTrue(course.getCourseGrade(false).isLocked());
}
Also used : ArrayList(java.util.ArrayList) Enrollment(com.instructure.canvasapi2.models.Enrollment) Course(com.instructure.canvasapi2.models.Course) Test(org.junit.Test)

Example 49 with Course

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

the class CourseTest method isTeacher_noEnrollments.

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

Example 50 with Course

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

the class CourseTest method courseHasFinalGrade.

@Test
public void courseHasFinalGrade() {
    Course course = new Course();
    Enrollment enrollment = new Enrollment();
    enrollment.setType("student");
    enrollment.setComputedFinalGrade("A");
    enrollment.setComputedFinalScore(95.0);
    ArrayList<Enrollment> enrollments = new ArrayList<>();
    enrollments.add(enrollment);
    course.setEnrollments(enrollments);
    assertFalse(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)

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