Search in sources :

Example 16 with Student

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

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

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

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

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

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