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

MSASEMAIL_S01_TC19_ItemOperations_OnlyIncludedSubjectInResponse() private method

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

            #region Call ItemOperations command without including BodyPreference element to fetch all the information about the e-mail
            SyncStore syncChangeResult = this.GetSyncResult(emailSubject, this.User2Information.InboxCollectionId, null);
            Sync item = TestSuiteHelper.GetSyncAddItem(syncChangeResult, emailSubject);

            // Just including subject element in schema
            Request.Schema schema = new Request.Schema();
            List<object> elements = new List<object> { string.Empty };

            List<Request.ItemsChoiceType4> names = new List<Request.ItemsChoiceType4>
            {
                Request.ItemsChoiceType4.Subject1
            };

            schema.Items = elements.ToArray();
            schema.ItemsElementName = names.ToArray();

            ItemOperationsRequest itemOperationRequest = TestSuiteHelper.CreateItemOperationsFetchRequest(this.User2Information.InboxCollectionId, item.ServerId, null, null, schema);
            ItemOperationsStore itemOperationResult = this.EMAILAdapter.ItemOperations(itemOperationRequest);
            ItemOperations itemOperationsItem = TestSuiteHelper.GetItemOperationsItem(itemOperationResult, emailSubject);
            Site.Assert.IsNotNull(itemOperationsItem, "The email item with subject '{0}' should be found in the {1} folder of user {2}.", emailSubject, FolderType.Inbox.ToString(), this.User2Information.UserName);
            #endregion

            #region Verify requirements
            // If the server responds with an ItemOperations response, then MS-ASEMAIL_R61 can be captured.
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R61");

            // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R61
            Site.CaptureRequirementIfAreEqual<string>(
                "1",
                itemOperationResult.Status,
                61,
                @"[In ItemOperations Command Response] When a client uses an ItemOperations command request ([MS-ASCMD] section 2.2.2.9), as specified in section 3.1.5.1, to retrieve data from the server for one or more specific e-mail items, the server responds with an ItemOperations command response.");

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

            // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R63
            Site.CaptureRequirementIfIsTrue(
                TestSuiteHelper.IsOnlySpecifiedElement((XmlElement)this.EMAILAdapter.LastRawResponseXml, "Properties", "Subject"),
                63,
                @"[In ItemOperations Command Response] If an airsync:Schema element ([MS-ASCMD] section 2.2.3.149) is included in the ItemOperations command request, then the elements returned in the ItemOperations command response MUST be restricted to the elements that were included as child elements of the airsync:Schema element in the command request.");
            #endregion
        }
        #endregion