Microsoft.Protocols.TestSuites.MS_ASEMAIL.S01_Email.MSASEMAIL_S01_TC27_CreateDraftEMailAndSend C# (CSharp) Method

MSASEMAIL_S01_TC27_CreateDraftEMailAndSend() private method

private MSASEMAIL_S01_TC27_CreateDraftEMailAndSend ( ) : void
return void
        public void MSASEMAIL_S01_TC27_CreateDraftEMailAndSend()
        {
            Site.Assume.AreEqual<string>("16.0", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The Bcc element is supported when the ActiveSyncProtocolVersion is 16.0.");

            #region Add an email item with Sync command and send it.
            // Call FolderSync command to synchronize the collection hierarchy.
            FolderSyncRequest folderSyncRequest = Common.CreateFolderSyncRequest("0");
            FolderSyncResponse folderSyncResponse = this.EMAILAdapter.FolderSync(folderSyncRequest);

            string draftCollectionId = Common.GetDefaultFolderServerId(folderSyncResponse, FolderType.Drafts, this.Site);

            string subject = Common.GenerateResourceName(Site, "subject");
            string to = Common.GetMailAddress(this.User2Information.UserName, this.User1Information.UserDomain);
            Request.SyncCollectionAdd syncAddCollection = new Request.SyncCollectionAdd();
           
            string clientId = TestSuiteHelper.GetClientId();
            syncAddCollection.ClientId = clientId;
            syncAddCollection.ApplicationData = new Request.SyncCollectionAddApplicationData();
            List<object> items = new List<object>();
            List<Request.ItemsChoiceType8> itemsElementName = new List<Request.ItemsChoiceType8>();
            itemsElementName.Add(Request.ItemsChoiceType8.Subject3);
            items.Add(subject);
            itemsElementName.Add(Request.ItemsChoiceType8.To);
            items.Add(to);

            syncAddCollection.ApplicationData.Items = items.ToArray();
            syncAddCollection.ApplicationData.ItemsElementName = itemsElementName.ToArray();
            syncAddCollection.Class = "Email";
            syncAddCollection.Send = string.Empty;

            SyncStore initSyncResponse = this.InitializeSync(draftCollectionId);
            SyncRequest addEMailRequest = TestSuiteHelper.CreateSyncAddRequest(initSyncResponse.SyncKey, draftCollectionId, syncAddCollection);
            this.EMAILAdapter.Sync(addEMailRequest);
            #endregion

            #region Call Sync command wihtout including BodyPreference to synchronize the e-mail items with server.
            this.SwitchUser(this.User2Information, true);
            // Get the new added email item
            SyncStore syncChangeResult = this.GetSyncResult(subject, User2Information.InboxCollectionId, null);
            Sync item = TestSuiteHelper.GetSyncAddItem(syncChangeResult, subject);
            
            this.Site.CaptureRequirementIfAreEqual<bool>(
                false,
                item.Email.IsDraft.Value,
                1279,
                @"[In IsDraft] The value 0 (FALSE) indicates that the email is not a draft.");
            #endregion
        }
        #endregion