Search in sources :

Example 31 with Student

use of com.instructure.canvasapi2.models.Student 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 32 with Student

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

the class CourseTest method courseGrade_finalGradeNonMGP.

@Test
public void courseGrade_finalGradeNonMGP() {
    Course course = new Course();
    String currentGrade = "A";
    String finalGrade = "C";
    Enrollment enrollment = new Enrollment();
    enrollment.setType("student");
    enrollment.setComputedFinalGrade(finalGrade);
    enrollment.setComputedCurrentGrade(currentGrade);
    ArrayList<Enrollment> enrollments = new ArrayList<>();
    enrollments.add(enrollment);
    course.setEnrollments(enrollments);
    assertTrue(course.getCourseGrade(false).getFinalGrade().equals(finalGrade));
}
Also used : ArrayList(java.util.ArrayList) Enrollment(com.instructure.canvasapi2.models.Enrollment) Course(com.instructure.canvasapi2.models.Course) Test(org.junit.Test)

Example 33 with Student

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

the class CourseTest method courseGrade_currentGradeMGP.

@Test
public void courseGrade_currentGradeMGP() {
    Course course = new Course();
    course.setHasGradingPeriods(true);
    String currentGrade = "A";
    String finalGrade = "C";
    Enrollment enrollment = new Enrollment();
    enrollment.setType("student");
    enrollment.setCurrentGradingPeriodId(27);
    enrollment.setMultipleGradingPeriodsEnabled(true);
    enrollment.setCurrentPeriodComputedCurrentGrade(currentGrade);
    enrollment.setCurrentPeriodComputedFinalGrade(finalGrade);
    ArrayList<Enrollment> enrollments = new ArrayList<>();
    enrollments.add(enrollment);
    course.setEnrollments(enrollments);
    assertTrue(course.getCourseGrade(false).getCurrentGrade().equals(currentGrade));
}
Also used : ArrayList(java.util.ArrayList) Enrollment(com.instructure.canvasapi2.models.Enrollment) Course(com.instructure.canvasapi2.models.Course) Test(org.junit.Test)

Example 34 with Student

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

the class EnrollmentTest method isStudent_Student.

@Test
public void isStudent_Student() {
    Enrollment enrollment = new Enrollment();
    enrollment.setType("student");
    assertEquals(true, enrollment.isStudent());
}
Also used : Enrollment(com.instructure.canvasapi2.models.Enrollment) Test(org.junit.Test)

Example 35 with Student

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

the class EnrollmentTest method getType.

@Test
public void getType() {
    Enrollment enrollment = new Enrollment();
    enrollment.setType("studentenrollment");
    assertEquals("student", enrollment.getType());
}
Also used : Enrollment(com.instructure.canvasapi2.models.Enrollment) Test(org.junit.Test)

Aggregations

Enrollment (com.instructure.canvasapi2.models.Enrollment)24 Course (com.instructure.canvasapi2.models.Course)23 Test (org.junit.Test)22 ArrayList (java.util.ArrayList)21 Student (com.instructure.canvasapi2.models.Student)6 LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)6 ApiPrefs (com.instructure.canvasapi2.utils.ApiPrefs)4 ApiType (com.instructure.canvasapi2.utils.ApiType)4 Prefs (com.instructure.pandautils.utils.Prefs)4 JsonNode (com.fasterxml.jackson.databind.JsonNode)3 RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)3 Student (models.Student)3 Before (org.junit.Before)3 NonNull (android.support.annotation.NonNull)2 StatusCallback (com.instructure.canvasapi2.StatusCallback)2 BlockedStudentResponse (com.instructure.canvasapi2.models.BlockedStudentResponse)2 MismatchedRegionResponse (com.instructure.canvasapi2.models.MismatchedRegionResponse)2 ParentResponse (com.instructure.canvasapi2.models.ParentResponse)2 RevokedTokenResponse (com.instructure.canvasapi2.models.RevokedTokenResponse)2 Response (okhttp3.Response)2