Пример #1
0
        /// <summary>
        /// This method is used to verify whether the Method element is the expected value.
        /// </summary>
        /// <param name="email">The email item got from server.</param>
        /// <param name="methodValue">The expected value of Method element .</param>
        private void VerifyMethodElementValue(DataStructures.Email email, byte methodValue)
        {
            Site.Assert.IsNotNull(
                email.Attachments,
                "The Attachments element in response should not be null.");

            Site.Assert.IsNotNull(
                email.Attachments.Items,
                "The Attachment element in response should not be null.");

            Site.Assert.AreEqual <int>(
                1,
                email.Attachments.Items.Length,
                "There should be only one Attachment element in response.");

            Site.Assert.IsNotNull(
                email.Attachments.Items[0],
                "The Attachment element in response should not be null.");

            Site.Assert.AreEqual <byte>(
                methodValue,
                ((Response.AttachmentsAttachment)email.Attachments.Items[0]).Method,
                "The value of Method element in response should be equal to the expected value.");
        }
Пример #2
0
        public void MSASCON_S03_TC08_ItemOperations_MessagePart()
        {
            this.CheckActiveSyncVersionIsNot140();

            #region User2 sends an email to User1
            this.SwitchUser(this.User2Information, true);

            string subject             = Common.GenerateResourceName(Site, "Subject");
            string body                = Common.GenerateResourceName(Site, "Body");
            string user1MailboxAddress = Common.GetMailAddress(User1Information.UserName, User1Information.UserDomain);
            string user2MailboxAddress = Common.GetMailAddress(User2Information.UserName, User2Information.UserDomain);
            this.CallSendMailCommand(user2MailboxAddress, user1MailboxAddress, subject, body);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, User1Information.InboxCollectionId, subject, false);
            #endregion

            #region Call ItemOperations command without BodyPreference or BodyPartPreference element.
            this.SwitchUser(this.User1Information, false);

            // Get all of the email BodyPart data.
            BodyPartPreference bodyPartPreference = new BodyPartPreference()
            {
                Type = 2,
            };

            DataStructures.Sync syncItem        = this.SyncEmail(subject, User1Information.InboxCollectionId, true, bodyPartPreference, null);
            XmlElement          lastRawResponse = (XmlElement)this.CONAdapter.LastRawResponseXml;
            string allData = TestSuiteHelper.GetDataInnerText(lastRawResponse, "BodyPart", "Data", subject);

            DataStructures.Email email = this.ItemOperationsFetch(User1Information.InboxCollectionId, syncItem.ServerId, null, null);
            this.VerifyMessagePartWithoutPreference(email);

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

            // Verify MS-ASCON requirement: MS-ASCON_R340
            Site.CaptureRequirementIfIsNull(
                email.BodyPart,
                340,
                @"[In Sending a Message Part] The airsyncbase:BodyPart element is not present in the [ItemOperations command] response if the client did not request the message part, as specified in section 3.1.4.10.");
            #endregion

            #region Call ItemOperations command with only BodyPreference element.
            BodyPreference bodyPreference = new BodyPreference()
            {
                Type = 2,
            };

            email = this.ItemOperationsFetch(User1Information.InboxCollectionId, syncItem.ServerId, null, bodyPreference);
            this.VerifyMessagePartWithBodyPreference(email);
            #endregion

            #region Call ItemOperations command with only BodyPartPreference element.
            bodyPartPreference = new BodyPartPreference()
            {
                Type                    = 2,
                TruncationSize          = 12,
                TruncationSizeSpecified = true,
            };

            email           = this.ItemOperationsFetch(User1Information.InboxCollectionId, syncItem.ServerId, bodyPartPreference, null);
            lastRawResponse = (XmlElement)this.CONAdapter.LastRawResponseXml;
            string truncatedData = TestSuiteHelper.GetDataInnerText(lastRawResponse, "BodyPart", "Data", subject);
            this.VerifyMessagePartWithBodyPartPreference(email, truncatedData, allData, (int)bodyPartPreference.TruncationSize);

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

            // Verify MS-ASCON requirement: MS-ASCON_R236
            Site.CaptureRequirementIfIsNotNull(
                email.BodyPart,
                236,
                @"[In Sending a Message Part] If the client [Sync command request ([MS-ASCMD] section 2.2.1.21), Search command request ([MS-ASCMD] section 2.2.1.16) or] ItemOperations command request 9([MS-ASCMD] section 2.2.1.10) includes the airsyncbase:BodyPartPreference element (section 2.2.2.2), then the server uses the airsyncbase:BodyPart element (section 2.2.2.1) to encapsulate the message part in the response.");

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

            // A message part and its meta-data are encapsulated by BodyPart element in the ItemOperation response, so this requirement can be captured.
            Site.CaptureRequirement(
                39,
                @"[In BodyPart] The airsyncbase:BodyPart element ([MS-ASAIRS] section 2.2.2.10) encapsulates a message part and its meta-data in [a Sync command response ([MS-ASCMD] section 2.2.1.21),] an ItemOperations command response ([MS-ASCMD] section 2.2.1.10) [or a Search command response ([MS-ASCMD] section 2.2.1.16)].");
            #endregion

            #region Call ItemOperations command with both BodyPreference and BodyPartPreference elements.
            email = this.ItemOperationsFetch(User1Information.InboxCollectionId, syncItem.ServerId, bodyPartPreference, bodyPreference);
            this.VerifyMessagePartWithBothPreference(email);
            #endregion
        }