Microsoft.Protocols.TestSuites.MS_ASEMAIL.TestSuiteBase.GetSyncResult C# (CSharp) Method

GetSyncResult() protected method

Get the specified email item.
protected GetSyncResult ( string emailSubject, string folderCollectionId, Request bodyPreference ) : SyncStore
emailSubject string The subject of the email item.
folderCollectionId string The serverId of the default folder.
bodyPreference Microsoft.Protocols.TestSuites.Common.Request The preference information related to the type and size of information that is returned from fetching.
return Microsoft.Protocols.TestSuites.Common.DataStructures.SyncStore
        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;
        }