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

MSASEMAIL_S01_TC02_SyncMail_MetadataAndBody() private method

private MSASEMAIL_S01_TC02_SyncMail_MetadataAndBody ( ) : void
return void
        public void MSASEMAIL_S01_TC02_SyncMail_MetadataAndBody()
        {
            #region Call method SendMail to send an email.
            string emailSubject = Common.GenerateResourceName(Site, "subject");
            this.SendPlaintextEmail(emailSubject, string.Empty, string.Empty);
            #endregion

            #region Call Sync command including BodyPreference element to synchronize the e-mail items with server.
            // Call method Sync to synchronize(add or change) the e-mail items with the server.
            Request.BodyPreference bodyPreference = new Request.BodyPreference
            {
                AllOrNone = false,
                AllOrNoneSpecified = true,
                TruncationSize = 5120,
                TruncationSizeSpecified = true,
                Type = 1
            };

            // Get the new added email item
            SyncStore syncChangeResult = this.GetSyncResult(emailSubject, this.User2Information.InboxCollectionId, bodyPreference);
            Sync item = TestSuiteHelper.GetSyncAddItem(syncChangeResult, emailSubject);
            #endregion

            #region Verify requirements.
            // If the Data element is included in Sync command response, then requirement MS-ASEAMIL_R1057 can be captured.
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R1057");

            // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R1057
            Site.CaptureRequirementIfIsNotNull(
                item.Email.Body.Data,
                1057,
                @"[In Body (Airsyncbase Namespace)] [When[airsyncbase:Body] included in a Sync command response ([MS-ASCMD] section 2.2.2.20), a Search command response ([MS-ASCMD] section 2.2.2.15), or an ItemOperations command response ([MS-ASCMD] section 2.2.2.9), the airsyncbase:Body element can contain the following child element: airsyncbase:Data] This element [airsyncbase:Data] is only included if a nonzero airsyncbase:TruncationSize ([MS-ASAIRS] section 2.2.2.40.2) element value was included in the request and the airsyncbase:AllOrNone ([MS-ASAIRS] section 2.2.2.3.2) element value included in the request does not restrict content from being returned in the response.");

            if (Common.IsRequirementEnabled(439, this.Site))
            {
                // The client doesn't set the flag of the email item, so if the Flag element is included in Sync command response, then MS-ASEMAIL_R439 can be captured
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R439");

                // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R439
                Site.CaptureRequirementIfIsTrue(
                    ((XmlElement)this.EMAILAdapter.LastRawResponseXml).InnerXml.Contains("<Flag xmlns=\"Email\" />"),
                    439,
                    @"[In Appendix B: Product Behavior] If no flags are present on the e-mail item, the Flag element is included in the command as an empty container element (that is, <Flag/>). (Exchange Server 2007 SP1 and above follow this behavior.)");
            }

            if (!Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("12.1"))
            {
                // If the server responds with a Sync command response and it contains an empty Categories, then MS-ASEMAIL_R318 can be captured.
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R318");

                // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R318
                Site.CaptureRequirementIfIsTrue(
                    item.Email.CategoriesIsInclude && item.Email.Categories.Category == null,
                    318,
                    @"[In Categories] An empty Categories element is included as a child of the Add ([MS-ASCMD] section 2.2.3.7.2) element in a Sync ([MS-ASCMD] section 2.2.2.20) command if no child Category elements have been set on the message.");
            }
            #endregion
        }
        #endregion