Search in sources :

Example 1 with DiscussionAttachment

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

the class DiscussionAttachmentTest method shouldShowToUser_lockedForUser_noUnlockDate.

@Test
public void shouldShowToUser_lockedForUser_noUnlockDate() {
    DiscussionAttachment attachment = new DiscussionAttachment();
    attachment.setLockedForUser(true);
    attachment.setUnlockAt(null);
    assertEquals(false, attachment.shouldShowToUser());
}
Also used : DiscussionAttachment(com.instructure.canvasapi2.models.DiscussionAttachment) Test(org.junit.Test)

Example 2 with DiscussionAttachment

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

the class DiscussionAttachmentTest method shouldShowToUser_hiddenForUser.

@Test
public void shouldShowToUser_hiddenForUser() {
    DiscussionAttachment attachment = new DiscussionAttachment();
    attachment.setHiddenForUser(true);
    assertEquals(false, attachment.shouldShowToUser());
}
Also used : DiscussionAttachment(com.instructure.canvasapi2.models.DiscussionAttachment) Test(org.junit.Test)

Example 3 with DiscussionAttachment

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

the class DiscussionAttachmentTest method shouldShowToUser_lockedForUser_unlockDatePassed.

@Test
public void shouldShowToUser_lockedForUser_unlockDatePassed() {
    Date lockDate = new Date(System.currentTimeMillis() - MILLIS_PER_DAY);
    DiscussionAttachment attachment = new DiscussionAttachment();
    attachment.setUnlockAt(APIHelper.dateToString(lockDate));
    attachment.setLockedForUser(true);
    assertEquals(true, attachment.shouldShowToUser());
}
Also used : DiscussionAttachment(com.instructure.canvasapi2.models.DiscussionAttachment) Date(java.util.Date) Test(org.junit.Test)

Example 4 with DiscussionAttachment

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

the class DiscussionAttachmentTest method shouldShowToUser_unlockedAndVisible.

@Test
public void shouldShowToUser_unlockedAndVisible() {
    DiscussionAttachment attachment = new DiscussionAttachment();
    attachment.setHidden(false);
    attachment.setHiddenForUser(false);
    attachment.setLocked(false);
    attachment.setLockedForUser(false);
    assertEquals(true, attachment.shouldShowToUser());
}
Also used : DiscussionAttachment(com.instructure.canvasapi2.models.DiscussionAttachment) Test(org.junit.Test)

Example 5 with DiscussionAttachment

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

the class DiscussionAttachmentTest method shouldShowToUser_lockedForUser_unlockDateNotPassed.

@Test
public void shouldShowToUser_lockedForUser_unlockDateNotPassed() {
    Date lockDate = new Date(System.currentTimeMillis() + MILLIS_PER_DAY);
    DiscussionAttachment attachment = new DiscussionAttachment();
    attachment.setUnlockAt(APIHelper.dateToString(lockDate));
    attachment.setLockedForUser(true);
    assertEquals(false, attachment.shouldShowToUser());
}
Also used : DiscussionAttachment(com.instructure.canvasapi2.models.DiscussionAttachment) Date(java.util.Date) Test(org.junit.Test)

Aggregations

DiscussionAttachment (com.instructure.canvasapi2.models.DiscussionAttachment)9 Test (org.junit.Test)9 Date (java.util.Date)4