From 2f477f31ccc545bca5358c357f13abc2f732ce98 Mon Sep 17 00:00:00 2001 From: Anahi Hojnadel Date: Wed, 19 Nov 2014 11:31:14 -0300 Subject: [PATCH] Added test for select in single entities --- .../test/integration/tests/ExchangeTests.java | 52 +++++++++++++++++-- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/ExchangeTests.java b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/ExchangeTests.java index 45810e7e..552a2652 100644 --- a/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/ExchangeTests.java +++ b/tests/e2e-test-app/app/src/main/java/com/microsoft/office365/test/integration/tests/ExchangeTests.java @@ -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)); } @@ -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; + } }