Search in sources :

Example 6 with ParentFragment

use of com.instructure.candroid.fragment.ParentFragment in project instructure-android by instructure.

the class ModuleUtilityTest method testGetFragment_subheader.

@Test
public void testGetFragment_subheader() {
    ModuleItem moduleItem = new ModuleItem();
    moduleItem.setType("SubHeader");
    Course course = new Course();
    ParentFragment parentFragment = callGetFragment(moduleItem, course, null);
    assertNull(parentFragment);
}
Also used : ModuleItem(com.instructure.canvasapi2.models.ModuleItem) ParentFragment(com.instructure.candroid.fragment.ParentFragment) Course(com.instructure.canvasapi2.models.Course) Test(org.junit.Test)

Example 7 with ParentFragment

use of com.instructure.candroid.fragment.ParentFragment in project instructure-android by instructure.

the class ModuleUtilityTest method testGetFragment_assignment.

@Test
public void testGetFragment_assignment() {
    String url = "https://mobile.canvas.net/api/v1/courses/222/assignments/123456789";
    ModuleItem moduleItem = new ModuleItem();
    moduleItem.setType("Assignment");
    moduleItem.setId(4567);
    moduleItem.setUrl(url);
    Course course = new Course();
    Bundle expectedBundle = new Bundle();
    expectedBundle.putSerializable(Const.CANVAS_CONTEXT, course);
    expectedBundle.putLong(Const.ASSIGNMENT_ID, 123456789);
    ParentFragment parentFragment = callGetFragment(moduleItem, course, null);
    assertNotNull(parentFragment);
    assertEquals(AssignmentFragment.class, parentFragment.getClass());
    assertEquals(expectedBundle.toString(), parentFragment.getArguments().toString());
}
Also used : ModuleItem(com.instructure.canvasapi2.models.ModuleItem) ParentFragment(com.instructure.candroid.fragment.ParentFragment) Bundle(android.os.Bundle) Course(com.instructure.canvasapi2.models.Course) Test(org.junit.Test)

Example 8 with ParentFragment

use of com.instructure.candroid.fragment.ParentFragment in project instructure-android by instructure.

the class ModuleUtilityTest method testGetFragment_discussion.

@Test
public void testGetFragment_discussion() {
    String url = "https://mobile.canvas.net/api/v1/courses/222/discussion_topics/123456789";
    ModuleItem moduleItem = new ModuleItem();
    moduleItem.setType("Discussion");
    moduleItem.setId(4567);
    moduleItem.setUrl(url);
    Course course = new Course();
    Bundle expectedBundle = new Bundle();
    expectedBundle.putSerializable(Const.CANVAS_CONTEXT, course);
    expectedBundle.putLong(Const.TOPIC_ID, 123456789);
    expectedBundle.putBoolean(Const.ANNOUNCEMENT, false);
    ParentFragment parentFragment = callGetFragment(moduleItem, course, null);
    assertNotNull(parentFragment);
    assertEquals(DiscussionDetailsFragment.class, parentFragment.getClass());
    assertEquals(expectedBundle.toString(), parentFragment.getArguments().toString());
}
Also used : ModuleItem(com.instructure.canvasapi2.models.ModuleItem) ParentFragment(com.instructure.candroid.fragment.ParentFragment) Bundle(android.os.Bundle) Course(com.instructure.canvasapi2.models.Course) Test(org.junit.Test)

Aggregations

ParentFragment (com.instructure.candroid.fragment.ParentFragment)8 Bundle (android.os.Bundle)7 Course (com.instructure.canvasapi2.models.Course)7 ModuleItem (com.instructure.canvasapi2.models.ModuleItem)7 Test (org.junit.Test)7 AssignmentListFragment (com.instructure.candroid.fragment.AssignmentListFragment)1 FileListFragment (com.instructure.candroid.fragment.FileListFragment)1 ModuleListFragment (com.instructure.candroid.fragment.ModuleListFragment)1 NotificationListFragment (com.instructure.candroid.fragment.NotificationListFragment)1 PageListFragment (com.instructure.candroid.fragment.PageListFragment)1 QuizListFragment (com.instructure.candroid.fragment.QuizListFragment)1 UnSupportedTabFragment (com.instructure.candroid.fragment.UnSupportedTabFragment)1 ModuleObject (com.instructure.canvasapi2.models.ModuleObject)1