Microsoft.Protocols.TestSuites.MS_ASRM.S01_Settings_SendMail_Sync.MSASRM_S01_TC02_Sync_Owner_RightsManagedEmailMessages C# (CSharp) Method

MSASRM_S01_TC02_Sync_Owner_RightsManagedEmailMessages() private method

        public void MSASRM_S01_TC02_Sync_Owner_RightsManagedEmailMessages()
        {
            this.CheckPreconditions();

            #region The client logs on User1's account, calls Settings command to get a templateID with all rights denied except view rights.
            string templateID = this.GetTemplateID("MSASRM_View_AllowedTemplate");
            #endregion

            #region The client logs on User1's account, calls SendMail command with the templateID to send a rights-managed e-mail message to User2, switches to User2, and call FolderSync command.
            string subject = this.SendMailAndFolderSync(templateID, true, null);
            #endregion

            #region The client logs on User2's account, calls Sync command with RightsManagementSupport element set to true to synchronize changes of Inbox folder in User2's mailbox, and gets the decompressed and decrypted rights-managed e-mail message, checks the Owner element.
            Sync item = this.SyncEmail(subject, this.UserTwoInformation.InboxCollectionId, true, true);
            Site.Assert.IsNotNull(item, "The returned item should not be null.");
            Site.Assert.IsNotNull(item.Email.RightsManagementLicense, "The RightsManagementLicense element in expected rights-managed e-mail message should not be null.");

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

            // Verify MS-ASRM requirement: MS-ASRM_R330
            Site.CaptureRequirementIfIsFalse(
                item.Email.RightsManagementLicense.Owner,
                330,
                @"[In Owner] if the value is FALSE (0), the user is not the owner of the e-mail message.");

            #endregion

            #region The client logs on User1's account, calls Sync command with RightsManagementSupport element set to true to synchronize changes of SentItems folder in User1's mailbox, and gets the decompressed and decrypted rights-managed e-mail message, checks the Owner element.
            this.SwitchUser(this.UserOneInformation, false);
            item = this.SyncEmail(subject, this.UserOneInformation.SentItemsCollectionId, true, true);

            Site.Assert.IsNotNull(item, "The returned item should not be null.");
            Site.Assert.IsNotNull(item.Email.RightsManagementLicense, "The RightsManagementLicense element in expected rights-managed e-mail message should not be null.");

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

            // Verify MS-ASRM requirement: MS-ASRM_R72
            Site.CaptureRequirementIfIsTrue(
                item.Email.RightsManagementLicense.Owner,
                72,
                @"[In Owner] If the value is TRUE (1), the user is the owner of the e-mail message.");

            Site.Assert.AreEqual<string>(Common.GetMailAddress(this.UserOneInformation.UserName, this.UserOneInformation.UserDomain).ToUpper(CultureInfo.CurrentCulture), item.Email.RightsManagementLicense.ContentOwner.ToUpper(CultureInfo.CurrentCulture), "The value of ContentOwner element should be equal to the User1's e-mail address.");

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

            // Verify MS-ASRM requirement: MS-ASRM_R31
            Site.CaptureRequirementIfIsTrue(
                item.Email.RightsManagementLicense.Owner,
                31,
                @"[In ContentOwner] The Owner element is set to TRUE for the user specified by the ContentOwner element.");
            #endregion
        }
        #endregion