Microsoft.Protocols.TestSuites.MS_ASEMAIL.S03_EmailFlag.MSASEMAIL_S03_TC30_MarkTaskComplete C# (CSharp) Method

MSASEMAIL_S03_TC30_MarkTaskComplete() private method

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

            #region Call Sync command with Change element to add flag task.
            Request.Flag flag = new Request.Flag
            {
                Status = "2",
                FlagType = "Flag for follow up",
                Subject = Common.GenerateResourceName(Site, "FlagSubject"),
                StartDate = DateTime.Now,
                StartDateSpecified = true,
                UtcStartDate = DateTime.Now,
                UtcStartDateSpecified = true,
                DueDate = DateTime.Now.AddDays(20),
                DueDateSpecified = true,
                UtcDueDate = DateTime.Now.AddDays(20),
                UtcDueDateSpecified = true,
                ReminderSet = 1,
                ReminderSetSpecified = true,
                ReminderTime = DateTime.Now,
                ReminderTimeSpecified = true
            };

            // Get the email item
            SyncStore getEmailItem = this.GetSyncResult(emailSubject, this.User2Information.InboxCollectionId, null);
            Sync item = TestSuiteHelper.GetSyncAddItem(getEmailItem, emailSubject);

            // Add flag to an email item
            SyncStore getChangedResult = this.AddEmailFag(this.User2Information, getEmailItem, emailSubject, flag);
            item = TestSuiteHelper.GetSyncChangeItem(getChangedResult, item.ServerId);
            Site.Assert.IsNotNull(item, "The message with subject {0} should be found in the folder {1} of user {2}.", emailSubject, FolderType.Inbox.ToString(), this.User2Information.UserName);

            Site.Assert.AreEqual<byte>(
                1,
                getChangedResult.CollectionStatus,
                "The server should return a Status 1 in the Sync command response indicate set flag success.");
            #endregion

            #region Call Sync command with Change element to mark a task as complete.
            flag = new Request.Flag
            {
                Status = "1",
                CompleteTime = DateTime.Now,
                CompleteTimeSpecified = true,
                DateCompleted = DateTime.Now,
                DateCompletedSpecified = true
            };

            // Get the email item
            getEmailItem = this.GetSyncResult(emailSubject, this.User2Information.InboxCollectionId, null);
            item = TestSuiteHelper.GetSyncAddItem(getEmailItem, emailSubject);

            // Add flag to an email item
            getChangedResult = this.AddEmailFag(this.User2Information, getEmailItem, emailSubject, flag);
            Site.Assert.AreEqual<byte>(
                1,
                getChangedResult.CollectionStatus,
                "The server should return a Status 1 in the Sync command response to indicate sets flag success.");
            item = TestSuiteHelper.GetSyncChangeItem(getChangedResult, item.ServerId);
            Site.Assert.IsNotNull(item, "The message with subject {0} should be found in the folder {1} of user {2}.", emailSubject, FolderType.Inbox.ToString(), this.User2Information.UserName);
            #endregion

            #region Verify requirements
            // If server returned a Status 1, that is to say, the sync command is successful, then MS-ASEMAIL_R87 can be captured.
            // Add the debug information
            this.Site.CaptureRequirement(
                87,
                @"[In Updating E-Mail Flags] When Action is Mark a task flag as complete, Required Properties from Device are:  Status = 1, CompleteTime, tasks:DateCompleted.");
            #endregion
        }
        #endregion
S03_EmailFlag