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

MSASEMAIL_S03_TC29_ClearTaskFlag_EmptyNode() private method

private MSASEMAIL_S03_TC29_ClearTaskFlag_EmptyNode ( ) : void
return void
        public void MSASEMAIL_S03_TC29_ClearTaskFlag_EmptyNode()
        {
            #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 method Sync to clear the flag added in the above step.
            Request.Flag newFlag = new Request.Flag();

            // Clear flag
            this.UpdateEmail(this.User2Information.InboxCollectionId, getChangedResult.SyncKey, null, item.ServerId, newFlag, null);

            // Get update result from server 
            SyncStore getClearResult = this.SyncChanges(getChangedResult.SyncKey, this.User2Information.InboxCollectionId, null);
            item = TestSuiteHelper.GetSyncChangeItem(getClearResult, item.ServerId);
            Site.Assert.IsNotNull(item, "The email item with subject '{0}' should be found.", emailSubject);
            Site.Assert.AreEqual<byte>(
                1,
                getClearResult.CollectionStatus,
                "The server should return a Status 1 in the Sync command response to indicate clears flag success.");
            #endregion

            #region Verify requirements
            bool isVerifiedR8900 =
                item.Email.Flag.Status == null &&
                item.Email.Flag.FlagType == null
                && string.IsNullOrEmpty(item.Email.Flag.Subject) &&
                !item.Email.Flag.StartDateSpecified &&
                !item.Email.Flag.DueDateSpecified &&
                !item.Email.Flag.UtcStartDateSpecified &&
                !item.Email.Flag.UtcDueDateSpecified &&
                !item.Email.Flag.ReminderSetSpecified &&
                !item.Email.Flag.ReminderTimeSpecified;
            
            this.Site.CaptureRequirementIfIsTrue(
                isVerifiedR8900,
                8900,
                @"[In Updating E-Mail Flags] When Action is Clearing the flag on a task, Required Properties from Device are: Flag node empty.");
            #endregion
        }
        #endregion
S03_EmailFlag