Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

Commit

Permalink
Merge branch 'dev' of github.com:OfficeDev/Office-365-SDK-for-Android…
Browse files Browse the repository at this point in the history
… into dev

* 'dev' of github.com:OfficeDev/Office-365-SDK-for-Android:
  Added test for select in single entities
  • Loading branch information
Marcos Torres committed Nov 19, 2014
2 parents aca1b55 + 2f477f3 commit 6288ecc
Showing 1 changed file with 48 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,12 @@ public ExchangeTests() {
this.addTest(canUpdateContact("Can update contacts", true));

//Select, top, filter
this.addTest(canFilterMessages("Can use filter in messages", true));
this.addTest(canSelectMessages("Can use select in messages", true));
this.addTest(canTopMessages("Can use top in messages", true));
this.addTest(canFilterMessages("Can use filter in messages list", true));
this.addTest(canSelectMessages("Can use select in messages list", true));
this.addTest(canTopMessages("Can use top in messages list", true));
this.addTest(canExpandMessages("Can use expand in messages list", true));
this.addTest(canExpandMessages("Can use expand in message", true));
this.addTest(canExpandMessage("Can use expand in message", true));
this.addTest(canSelectMessage("Can use select in message", true));
}


Expand Down Expand Up @@ -2463,4 +2464,47 @@ public TestResult executeTest() {
test.setEnabled(enabled);
return test;
}

private TestCase canSelectMessage(String name, boolean enabled) {
TestCase test = new TestCase() {

@Override
public TestResult executeTest() {
try {
TestResult result = new TestResult();
result.setStatus(TestStatus.Failed);
result.setTestCase(this);

String subject = "Test Subject " + UUID.randomUUID().toString();
Message message = getSampleMessage(subject, ApplicationContext.getTestMail(), "");

OutlookClient client = ApplicationContext.getMailCalendarContactClient();

//Prepare
Message addedMessage = client.getMe().getFolders().getById("Drafts").getMessages().add(message).get();

//Act
Message messageWithSelect = client.getMe()
.getMessage(addedMessage.getId())
.select("Subject,DateTimeCreated")
.read().get();

//Assert
if (messageWithSelect != null && messageWithSelect.getSubject().equals(subject) && messageWithSelect.getDateTimeReceived() == null)
result.setStatus(TestStatus.Passed);

//Cleanup
client.getMe().getMessages().getById(addedMessage.getId()).delete().get();

return result;
} catch (Exception e) {
return createResultFromException(e);
}
}
};

test.setName(name);
test.setEnabled(enabled);
return test;
}
}

0 comments on commit 6288ecc

Please sign in to comment.