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

MSASEMAIL_S01_TC16_ForwardEmail() private method

private MSASEMAIL_S01_TC16_ForwardEmail ( ) : void
return void
        public void MSASEMAIL_S01_TC16_ForwardEmail()
        {
            Site.Assume.AreNotEqual<string>("12.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The email2:LastVerbExecuted element, email2:LastVerbExecutedTime element and ConversationIndex element are not supported when the ActiveSyncProtocolVersion is 12.1.");

            #region The sender calls SendMail method to send the email to recipient.
            string emailSubject = Common.GenerateResourceName(Site, "subject");
            this.SendPlaintextEmail(emailSubject, string.Empty, string.Empty, Common.GetMailAddress(this.User2Information.UserName, this.User2Information.UserDomain), null, null, null);
            #endregion

            #region Record user name, folder collectionId and item subject that are used in this case.
            this.SwitchUser(this.User2Information, true);
            this.RecordCaseRelativeItems(this.User2Information.UserName, this.User2Information.InboxCollectionId, emailSubject);
            #endregion

            #region The recipient calls Sync command to synchronize the email items on the server.
            SyncStore syncChangeResult = this.GetSyncResult(emailSubject, this.User2Information.InboxCollectionId, null);
            Sync item = TestSuiteHelper.GetSyncAddItem(syncChangeResult, emailSubject);
            #endregion

            #region The recipient calls SmartForward method to forward the received email to the second recipient.
            string forwardFromUser = Common.GetMailAddress(this.User2Information.UserName, this.User2Information.UserDomain);
            string forwardToUser = Common.GetMailAddress(this.User3Information.UserName, this.User3Information.UserDomain);
            string forwardSubject = string.Format("FW: {0}", emailSubject);
            string forwardContent = Common.GenerateResourceName(Site, "forward: body");

            string forwardMime = TestSuiteHelper.CreatePlainTextMime(
                forwardFromUser,
                forwardToUser,
                string.Empty,
                string.Empty,
                forwardSubject,
                forwardContent);

            SmartForwardRequest forwardRequest = TestSuiteHelper.CreateSmartForwardRequest(this.User2Information.InboxCollectionId, item.ServerId, forwardMime);
            this.EMAILAdapter.SmartForward(forwardRequest);
            #endregion

            #region Record user name, folder collectionId and item subject that are used in this case.
            this.SwitchUser(this.User3Information, true);
            this.RecordCaseRelativeItems(this.User3Information.UserName, this.User3Information.InboxCollectionId, forwardSubject);
            #endregion

            #region The second recipient calls Sync method to synchronize the email item on the server.
            syncChangeResult = this.GetSyncResult(forwardSubject, this.User3Information.InboxCollectionId, null);
            Sync forwardItem = TestSuiteHelper.GetSyncAddItem(syncChangeResult, forwardSubject);
            #endregion

            #region Verify requirement
            byte[] firstEmailIndex = Convert.FromBase64String(item.Email.ConversationIndex);
            byte[] forwardEmailIndex = Convert.FromBase64String(forwardItem.Email.ConversationIndex);

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R352");

            // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R352
            // The ConversationIndex of first email only have 5 bytes Conversation Index Header and the later reply or forward email will add the extra 5 bytes response level. So the second email index is 2 times of the first email.
            Site.CaptureRequirementIfAreEqual<int>(
                2,
                forwardEmailIndex.Length / firstEmailIndex.Length,
                352,
                @"[In ConversationIndex] Additional timestamps are added when the message is forwarded [or replied to].");
            #endregion
        }
        #endregion