private SyncStore GetSyncResult(string emailSubject, string folderCollectionId, Request.BodyPreference bodyPreference)
{
SyncStore syncItemResult;
Microsoft.Protocols.TestSuites.Common.DataStructures.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
syncItemResult = this.SyncChanges(this.GetInitialSyncKey(folderCollectionId), 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;
}