protected SyncStore GetSyncResult(string emailSubject, string folderCollectionId, Request.BodyPreference bodyPreference)
{
SyncStore syncItemResult;
Sync item = null;
int counter = 0;
int waitTime = int.Parse(Common.GetConfigurationPropertyValue("WaitTime", this.Site));
int retryCount = int.Parse(Common.GetConfigurationPropertyValue("RetryCount", this.Site));
do
{
Thread.Sleep(waitTime);
// Get the new added email item
SyncStore initSyncResult = this.InitializeSync(folderCollectionId);
syncItemResult = this.SyncChanges(initSyncResult.SyncKey, folderCollectionId, bodyPreference);
if (syncItemResult != null && syncItemResult.CollectionStatus == 1)
{
item = TestSuiteHelper.GetSyncAddItem(syncItemResult, emailSubject);
}
counter++;
}
while ((syncItemResult == null || item == null) && counter < retryCount);
Site.Assert.IsNotNull(item, "The email item with subject {0} should be found. Retry count: {1}", emailSubject, counter);
// Verify sync result
Site.Assert.AreEqual<byte>(
1,
syncItemResult.CollectionStatus,
"If the Sync command executes successfully, the status in response should be 1.");
return syncItemResult;
}