Inheritance: BaseRequestType
示例#1
0
 /// <remarks/>
 public void MarkAsJunkAsync(MarkAsJunkType MarkAsJunk1, object userState)
 {
     if ((this.MarkAsJunkOperationCompleted == null))
     {
         this.MarkAsJunkOperationCompleted = new System.Threading.SendOrPostCallback(this.OnMarkAsJunkOperationCompleted);
     }
     this.InvokeAsync("MarkAsJunk", new object[] {
             MarkAsJunk1}, this.MarkAsJunkOperationCompleted, userState);
 }
示例#2
0
 /// <remarks/>
 public void MarkAsJunkAsync(MarkAsJunkType MarkAsJunk1)
 {
     this.MarkAsJunkAsync(MarkAsJunk1, null);
 }
        /// <summary>
        /// The MarkAsJunk operation marks an item as junk.
        /// </summary>
        /// <param name="markAsJunkRequest">Specify a request for a MarkAsJunk operation.</param>
        /// <returns>A response to MarkAsJunk operation request.</returns>
        public MarkAsJunkResponseType MarkAsJunk(MarkAsJunkType markAsJunkRequest)
        {
            MarkAsJunkResponseType markAsJunkReponse = this.exchangeServiceBinding.MarkAsJunk(markAsJunkRequest);
            Site.Assert.IsNotNull(markAsJunkReponse, "If the operation is successful, the response should not be null.");

            // SOAP version is set to 1.1, if a response can be received from server, then it means SOAP 1.1 is supported.
            this.VerifySoapVersion();

            // Verify transport type related requirement.
            this.VerifyTransportType();

            this.VerifyServerVersionInfo(this.exchangeServiceBinding.ServerVersionInfoValue, this.exchangeServiceBinding.IsSchemaValidated);
            this.VerifyMarkAsJunkResponse(markAsJunkReponse, this.exchangeServiceBinding.IsSchemaValidated);
            return markAsJunkReponse;
        }
示例#4
0
 /// <remarks/>
 public System.IAsyncResult BeginMarkAsJunk(MarkAsJunkType MarkAsJunk1, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("MarkAsJunk", new object[] {
             MarkAsJunk1}, callback, asyncState);
 }
        public void MSOXWSCORE_S04_TC18_MarkAsJunkSuccessfully()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled(1787, this.Site), "Exchange 2007 and Exchange 2010 do not use the MarkAsJunk operation");

            #region Create the successful message
            MessageType[] items = new MessageType[]
            {
                new MessageType
                {
                    Sender = new SingleRecipientType
                    {
                        Item = new EmailAddressType
                        {
                            EmailAddress = Common.GetConfigurationPropertyValue("User2Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site)
                        }
                    },

                    Subject = Common.GenerateResourceName(this.Site, TestSuiteHelper.SubjectForCreateItem),
                }
            };

            string itemSubject = items[0].Subject;
            string itemSender = items[0].Sender.Item.EmailAddress;

            CreateItemResponseType createItemResponse = this.CallCreateItemOperation(DistinguishedFolderIdNameType.drafts, items);

            // Check the operation response.
            Common.CheckOperationSuccess(createItemResponse, 1, this.Site);

            MarkAsJunkType markAsJunkRequest = new MarkAsJunkType();
            markAsJunkRequest.ItemIds = Common.GetItemIdsFromInfoResponse(createItemResponse);
            markAsJunkRequest.IsJunk = true;
            markAsJunkRequest.MoveItem = true;

            MarkAsJunkResponseType markAsJunkResponse = this.COREAdapter.MarkAsJunk(markAsJunkRequest);

            // Check the operation response.
            Common.CheckOperationSuccess(markAsJunkResponse, 1, this.Site);

            MarkAsJunkResponseMessageType markAsJunkResponseMessage = (MarkAsJunkResponseMessageType)markAsJunkResponse.ResponseMessages.Items[0];

            if (Common.IsRequirementEnabled(1787, this.Site))
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1787");

                // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1787
                this.Site.CaptureRequirementIfAreEqual<ResponseClassType>(
                    ResponseClassType.Success,
                    markAsJunkResponseMessage.ResponseClass,
                    1787,
                    @"[In Appendix C: Product Behavior] Implementation does use [The operation ""MarkAsJunk""] which Marks an item as junk. (Exchange 2013 and above follow this behavior.)");
            }

            if (Common.IsRequirementEnabled(1790, this.Site))
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1790");

                // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1790
                this.Site.CaptureRequirementIfAreEqual<ResponseClassType>(
                    ResponseClassType.Success,
                    markAsJunkResponseMessage.ResponseClass,
                    1790,
                    @"[In Appendix C: Product Behavior] Implementation does use the MarkAsJunk operation which marks an item as junk. (Exchange 2013 and above follow this behavior.)");
            }

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1844
            this.Site.CaptureRequirementIfIsNotNull(
                markAsJunkResponse,
                1844,
                @"[In m:MarkAsJunkResponseType Complex Type] This type [MarkAsJunkResponseType Complex Type] extends the BaseResponseMessageType, as specified in [MS-OXWSCDATA] section 2.2.4.16.");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1847
            this.Site.CaptureRequirementIfIsNotNull(
                markAsJunkResponseMessage,
                1847,
                @"[In m:MarkAsJunkResponseMessageType Complex Type] This type [MarkAsJunkResponseMessageType Complex Type] extends the ResponseMessageType complex type, as specified in [MS-OXWSCDATA] section 2.2.4.57.");

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

            // Verify MS-OXWSCDATA requirement: MS-OXWSCDATA_R3060
            this.Site.CaptureRequirementIfIsNotNull(
                markAsJunkResponseMessage,
                "MS-OXWSCDATA",
                3060,
                @"[In m:ArrayOfResponseMessagesType Complex Type] The element ""MarkAsJunkResponseMessage"" with type ""m:MarkAsJunkResponseMessageType ([MS-OXWSCORE] section 3.1.4.6.3.3)"" specifies the response message for the MarkAsJunk operation ([MS-OXWSCORE] section 3.1.4.6).");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1850
            this.Site.CaptureRequirementIfIsInstanceOfType(
                markAsJunkResponseMessage.MovedItemId,
                typeof(ItemIdType),
                1850,
                @"[In m:MarkAsJunkResponseMessageType Complex Type] The type of MovedItemId is t:ItemIdType (section 2.2.4.19).");

            ItemIdType[] getItemIds = new ItemIdType[] { markAsJunkResponseMessage.MovedItemId };
            GetItemResponseType getItemResponse = this.CallGetItemOperation(getItemIds);

            // Check the operation response.
            Common.CheckOperationSuccess(getItemResponse, 1, this.Site);

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1851
            // When use the MovedItemId to get item and only one item is returned in the response, it means that the MovedItemId specifies an identifier of the moved item, thus this requirement can be verified.
            this.Site.CaptureRequirement(
                1851,
                @"[In m:MarkAsJunkResponseMessageType Complex Type] [The child element ""MovedItemId""] Specifies the item identifier of the moved item. ");

            // Find the item in the Junk Email folder.
            ItemIdType[] foundItems = this.FindItemsInFolder(DistinguishedFolderIdNameType.junkemail, itemSubject, "User1");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1920
            // Since the value of IsJunk is true and the value of MoveItem is true, the item is moved to the Junk Email folder. Thus the response of FindItem should not be null, then this requirement can be verified.
            this.Site.CaptureRequirementIfIsNotNull(
                foundItems,
                1920,
                @"[In m:MarkAsJunkType Complex Type] [When the value of ""IsJunk"" is] True and [the value of ""MoveItem"" is] True, The operation moves the email item to the Junk Email folder. ");
            
            string blockedSender = null;
            string userName = Common.GetConfigurationPropertyValue("User1Name", this.Site);
            blockedSender = this.CORESUTControlAdapter.GetMailboxJunkEmailConfiguration(userName);

            bool isInBlockedSender = blockedSender.Contains(itemSender);

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1839
            this.Site.CaptureRequirementIfIsTrue(
                isInBlockedSender,
                1839,
                @"[In m:MarkAsJunkType Complex Type] [When the value of ""IsJunk"" is] True and [the value of ""MoveItem"" is] True, the operation adds the sender of the email to the blocked sender list and moves the email item to the Junk Email folder.");

            markAsJunkRequest.ItemIds = foundItems;
            markAsJunkRequest.IsJunk = true;
            markAsJunkRequest.MoveItem = false;
            markAsJunkResponse = this.COREAdapter.MarkAsJunk(markAsJunkRequest);

            // Check the operation response.
            Common.CheckOperationSuccess(markAsJunkResponse, 1, this.Site);

            // Find the item in the Junk Email folder.
            foundItems = this.FindItemsInFolder(DistinguishedFolderIdNameType.junkemail, itemSubject, "User1");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1921
            // Since the value of IsJunk is true and the value of MoveItem is false, the item is still in the Junk Email folder. Thus the response of FindItem should not be null, then this requirement can be verified.
            this.Site.CaptureRequirementIfIsNotNull(
                foundItems,
                1921,
                @"[In m:MarkAsJunkType Complex Type] [When the value of ""IsJunk"" is] True and [the value of ""MoveItem"" is] False,The email item is not moved.");

            blockedSender = this.CORESUTControlAdapter.GetMailboxJunkEmailConfiguration(userName);
            isInBlockedSender = blockedSender.Contains(itemSender);

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1840
            this.Site.CaptureRequirementIfIsTrue(
                isInBlockedSender,
                1840,
                @"[In m:MarkAsJunkType Complex Type] [When the value of ""IsJunk"" is] True and [the value of ""MoveItem"" is] False, the operation adds the sender of the email to the blocked sender list.");

            markAsJunkRequest.ItemIds = foundItems;
            markAsJunkRequest.IsJunk = false;
            markAsJunkRequest.MoveItem = true;
            markAsJunkResponse = this.COREAdapter.MarkAsJunk(markAsJunkRequest);

            // Check the operation response.
            Common.CheckOperationSuccess(markAsJunkResponse, 1, this.Site);

            // Find the item in the Inbox folder.
            foundItems = this.FindItemsInFolder(DistinguishedFolderIdNameType.inbox, itemSubject, "User1");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1922
            // Since the value of IsJunk is false and the value of MoveItem is true, the item is moved to the inbox folder. Thus the response of FindItem should not be null, then this requirement can be verified.
            this.Site.CaptureRequirementIfIsNotNull(
                foundItems,
                1922,
                @"[In m:MarkAsJunkType Complex Type] [When the value of ""IsJunk"" is] False and [the value of ""MoveItem"" is] True, The operation moves the email item back to the Inbox folder.");

            blockedSender = this.CORESUTControlAdapter.GetMailboxJunkEmailConfiguration(userName);
            isInBlockedSender = blockedSender.Contains(itemSender);

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1841
            this.Site.CaptureRequirementIfIsFalse(
                isInBlockedSender,
                1841,
                @"[In m:MarkAsJunkType Complex Type] [When the value of ""IsJunk"" is] False and [the value of ""MoveItem"" is] True, the operation removes the sender from the blocked sender list.");

            markAsJunkRequest.ItemIds = foundItems;
            markAsJunkRequest.IsJunk = false;
            markAsJunkRequest.MoveItem = false;
            markAsJunkResponse = this.COREAdapter.MarkAsJunk(markAsJunkRequest);

            // Check the operation response.
            Common.CheckOperationSuccess(markAsJunkResponse, 1, this.Site);

            // Find the item in the Inbox folder.
            foundItems = this.FindItemsInFolder(DistinguishedFolderIdNameType.inbox, itemSubject, "User1");

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1923
            // Since the value of IsJunk is false and the value of MoveItem is false, the item is still in the Inbox folder. Thus the response of FindItem should not be null, then this requirement can be verified.
            this.Site.CaptureRequirementIfIsNotNull(
                foundItems,
                1923,
                @"[In m:MarkAsJunkType Complex Type] [When the value of ""IsJunk"" is] False and [the value of ""MoveItem"" is] False, The email item is not moved.");

            blockedSender = this.CORESUTControlAdapter.GetMailboxJunkEmailConfiguration(userName);
            isInBlockedSender = blockedSender.Contains(itemSender);

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1842
            this.Site.CaptureRequirementIfIsFalse(
                isInBlockedSender,
                1842,
                @"[In m:MarkAsJunkType Complex Type] [When the value of ""IsJunk"" is] False and [the value of ""MoveItem"" is] False, the operation removes the sender from the blocked sender list.");

            this.ExistItemIds.Clear();
            this.ExistItemIds.Add(foundItems[0]);
            #endregion
        }