コード例 #1
0
        /// <summary>
        /// Add flag and categories for an email item
        /// </summary>
        /// <param name="collectionId">The collectionId of the folder which contains the specified item.</param>
        /// <param name="syncKey">The synchronization key to get the new added email item.</param>
        /// <param name="serverId">The server id of the new added email item.</param>
        /// <returns>The result of adding email flag and categories.</returns>
        private SyncStore AddFlagAndCategories(string collectionId, string syncKey, string serverId)
        {
            Request.Flag flag = new Request.Flag
            {
                Status = "2",
                FlagType = "for Follow Up",
                CompleteTime = DateTime.Now,
                CompleteTimeSpecified = true,
                DateCompleted = DateTime.Now,
                DateCompletedSpecified = true
            };

            Collection<string> categories = new Collection<string>();

            if (!Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("12.1"))
            {
                string category = Common.GenerateResourceName(Site, "Category");
                categories.Add(category);
            }
            else
            {
                categories = null;
            }

            // Add category and flag to the email item and set Read property to true
            this.UpdateEmail(collectionId, syncKey, true, serverId, flag, categories);

            // Get the result of adding flag and category
            return this.SyncChanges(syncKey, collectionId, null);
        }
コード例 #2
0
        public void MSASEMAIL_S03_TC04_AddFlag_InvalidReminder()
        {
            #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 with the ReminderSet element but missing the ReminderTime element.
            Request.Flag flag = new Request.Flag
            {
                Status = "2",
                FlagType = "for Follow Up",
                ReminderSet = 1,
                ReminderSetSpecified = true
            };

            // Get the synchronization result.
            SyncStore getEmailItem = this.GetSyncResult(emailSubject, this.User2Information.InboxCollectionId, null);

            // Get the new added email item
            Sync emailItem = TestSuiteHelper.GetSyncAddItem(getEmailItem, emailSubject);

            // Add flag to the email item
            SyncStore updateResult = this.UpdateEmail(this.User2Information.InboxCollectionId, getEmailItem.SyncKey, null, emailItem.ServerId, flag, null);

            Site.Assert.AreEqual<int>(
                6,
                int.Parse(updateResult.ChangeResponses[0].Status),
                "The server should return a Status 6 in the Sync command response if the ReminderSet element value is set to 1 (TRUE) and the ReminderTime element is not included in the Sync command request.");
            #endregion

            #region Verify requirement
            // If the server returns a Status element value of 6 in the Sync command response, then MS-ASEMAIL_R702 can be captured. 
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R702");

            // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R702
            Site.CaptureRequirement(
                702,
                @"[In ReminderTime] The server returns a Status element ([MS-ASCMD] section 2.2.3.167.16) value of 6 in the Sync command response ([MS-ASCMD] section 2.2.2.20) if the tasks:ReminderSet element value is set to 1 (TRUE) and the tasks:ReminderTime element is not included in the Sync command request ([MS-ASCMD] section 2.2.2.20).");
            #endregion
        }
コード例 #3
0
        public void MSASEMAIL_S03_TC16_UpdateEmailFlag_Error()
        {
            #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 a flag with the StartDate, DueDate, UtcStartDate and UtcDueDate.
            Request.Flag flag = new Request.Flag
            {
                Status = "2",
                FlagType = "Flag for follow up",
                StartDate = DateTime.Now,
                StartDateSpecified = true,
                UtcStartDate = DateTime.Now,
                UtcStartDateSpecified = true,
                UtcDueDate = DateTime.Now.AddDays(20),
                UtcDueDateSpecified = true,
                DueDate = DateTime.Now.AddDays(20),
                DueDateSpecified = true
            };

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

            // Get the new added email item
            Sync item = TestSuiteHelper.GetSyncAddItem(getEmailItem, emailSubject);
            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);

            // Add flag to the email item
            SyncStore getChangedResult = this.AddEmailFag(this.User2Information, getEmailItem, emailSubject, flag);
            item = TestSuiteHelper.GetSyncChangeItem(getChangedResult, item.ServerId);
            #endregion

            #region Call Sync command with Change element to update the email flag.
            Request.Flag newFlag = new Request.Flag { Status = "2" };

            SyncStore updateResult = this.UpdateEmail(this.User2Information.InboxCollectionId, getChangedResult.SyncKey, null, item.ServerId, newFlag, null);
            Site.Assert.AreEqual<int>(
                6,
                int.Parse(updateResult.ChangeResponses[0].Status),
                "The server should return a Status 6 in the Sync command response if any of the required elements:StartDate, DueDate, UtcStartDate and UtcDueDate are missing from the Sync command request.");
            #endregion

            #region Verify requirement
            // If server returned a Status 6, then MS-ASEMAIL_R92 can be captured.
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R92");

            // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R92
            Site.CaptureRequirement(
                92,
                @"[In Updating E-Mail Flags] The Sync command response includes an airsync:Status element ([MS-ASCMD] section 2.2.3.167.16) value of 6 if any of the required elements listed in the table are missing from the Sync command request.");
            #endregion
        }
コード例 #4
0
        /// <summary>
        /// Update email with more data
        /// </summary>
        /// <param name="collectionId">The collectionId of the folder which contains the item to be updated.</param>
        /// <param name="syncKey">The syncKey which is returned from server</param>
        /// <param name="read">The value is TRUE indicates the email has been read; a value of FALSE indicates the email has not been read</param>
        /// <param name="serverId">The server id of the email</param>
        /// <param name="flag">The flag instance</param>
        /// <param name="categories">The list of categories</param>
        /// <param name="additionalElement">Additional flag element</param>
        /// <param name="insertTag">Additional element will insert before this tag</param>
        /// <returns>Return update email result</returns>
        protected SendStringResponse UpdateEmailWithMoreData(string collectionId, string syncKey, bool read, string serverId, Request.Flag flag, Collection <object> categories, string additionalElement, string insertTag)
        {
            // Create normal sync request
            Request.SyncCollectionChange changeData = TestSuiteHelper.CreateSyncChangeData(read, serverId, flag, categories);
            SyncRequest syncRequest = TestSuiteHelper.CreateSyncChangeRequest(syncKey, collectionId, changeData);

            // Calls Sync command to update email with invalid sync request
            SendStringResponse result = this.EMAILAdapter.InvalidSync(syncRequest, additionalElement, insertTag);

            return(result);
        }
コード例 #5
0
        public void MSASEMAIL_S03_TC11_FlagEmail_RequiredPropertiesOption1()
        {
            #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 with properties Status = 2, FlagType = "Flag for follow up", StartDate, UtcStartDate, DueDate and UtcDueDate.
            Request.Flag flag = new Request.Flag
            {
                Status = "2",
                FlagType = "Flag for follow up",
                StartDate = DateTime.Now,
                StartDateSpecified = true,
                UtcStartDate = DateTime.Now,
                UtcStartDateSpecified = true,
                DueDate = DateTime.Now.AddDays(20),
                DueDateSpecified = true,
                UtcDueDate = DateTime.Now.AddDays(20),
                UtcDueDateSpecified = 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 Verify requirements
            // If server returned a Status 1, that is to say, the sync command is successful, then MS-ASEMAIL_R940 can be captured.
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R940");

            // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R940
            Site.CaptureRequirement(
                940,
                @"[In Updating E-Mail Flags] When Action is Flag an email, Required Properties from Device are: Status = 2, FlagType (section 2.2.2.35) = ""Flag for follow up"",tasks:StartDate (section 2.2.2.72) and tasks:UtcStartDate (section 2.2.2.87) tasks:DueDate (section 2.2.2.31) and tasks:UtcDueDate (section 2.2.2.86)");

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

            // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R693
            Site.CaptureRequirementIfAreEqual<byte>(
                0,
                item.Email.Flag.ReminderSet,
                693,
                @"[In ReminderSet] The default value is 0 (zero).");

            // If MS-ASEMAIL_R693 is captured successfully, it means the reminder is not set for the task, then MS-ASEMAIL_R1072 can be captured.
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R1072");

            // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R1072
            Site.CaptureRequirement(
                1072,
                @"[In ReminderSet] [The value of this element[tasks:ReminderSet] is set to 1 if a reminder has been set for the task;] otherwise, the value of this element[tasks:ReminderSet] is set to 0 (zero).");
            #endregion
        }
コード例 #6
0
        public void MSASEMAIL_S03_TC14_ClearEmailFlag_EmptyNode()
        {
            Request.Flag newFlag = new Request.Flag();

            // If server returned an empty Flag node, that is to say, the flag was cleared, then MS-ASEMAIL_R8800 can be captured.
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R8800");

            // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R8800
            Site.CaptureRequirementIfIsTrue(
                this.VerifyClearEmailFlag(newFlag),
                8800,
                @"[In Updating E-Mail Flags] When Action is Clearing the flag on an email, Required Properties from Device are: Flag node empty.");
        }
コード例 #7
0
        public void MSASEMAIL_S03_TC26_FlagEmail_RequiredPropertiesOption2()
        {
            #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 with properties Status = 2, FlagType = "Flag for follow up", tasks:DateCompleted, CompleteTime.
            Request.Flag flag = new Request.Flag
            {
                Status = "2",
                FlagType = "Flag for follow up",
                DateCompletedSpecified = true,
                DateCompleted = DateTime.Now.AddDays(1),
                CompleteTimeSpecified = true,
                CompleteTime = DateTime.Now.AddDays(1)
            };

            // 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 Verify requirements
            // If server returned a Status 1, that is to say, the sync command is successful, then MS-ASEMAIL_R941 can be captured.
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R941");

            // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R941
            Site.CaptureRequirement(
                941,
                @"[In Updating E-Mail Flags] When Action is Flag an email, Required Properties from Device are:Status = 2, FlagType (section 2.2.2.35) = ""Flag for follow up"", tasks:DateCompleted (section 2.2.2.23), CompleteTime (section 2.2.2.19).");
            #endregion
        }
コード例 #8
0
        public void MSASEMAIL_S03_TC07_AddFlag_InvalidDate()
        {
            #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 and just set the value of StartDate and DueDate.
            Request.Flag flag = new Request.Flag
            {
                Status = "2",
                FlagType = "for Follow Up",
                StartDate = DateTime.Now,
                StartDateSpecified = true,
                DueDate = DateTime.Now.AddDays(20),
                DueDateSpecified = true
            };

            // Get the synchronization result
            SyncStore getEmailItem = this.GetSyncResult(emailSubject, this.User2Information.InboxCollectionId, null);

            // Get the new added email item
            Sync emailItem = TestSuiteHelper.GetSyncAddItem(getEmailItem, emailSubject);

            // Add flag to the email item
            SyncStore updateResult = this.UpdateEmail(this.User2Information.InboxCollectionId, getEmailItem.SyncKey, null, emailItem.ServerId, flag, null);

            Site.Assert.AreEqual<int>(
                6,
                int.Parse(updateResult.ChangeResponses[0].Status),
                "The server should return a Status 6 in the Sync command response if the the request just sets StartDate and DueDate.");
            #endregion

            #region Verify requirements
            // If the server returns a Status element value of 6 in the Sync command response, then MS-ASEMAIL_R409, MS-ASEMAIL_R864 and MS-ASEMAIL_R853 can be captured.
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R409");

            // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R409
            Site.CaptureRequirement(
                409,
                @"[In DueDate] The server returns a Status element value of 6 in the Sync response if this condition[To set a flag, the tasks:StartDate element, tasks:DueDate element, tasks:UtcStartDate element (section 2.2.2.75), and tasks:UtcDueDate element (section 2.2.2.74) either all MUST be set, or all MUST be NULL.] is not met.");

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

            // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R864
            Site.CaptureRequirement(
                864,
                @"[In UtcStartDate] The server returns a Status element value of 6 in the Sync command response if this condition[To set a flag, the tasks:StartDate element, tasks:DueDate element (section 2.2.2.24), tasks:UtcStartDate element, and tasks:UtcDueDate element either all MUST be set, or all MUST be NULL. ] is not met.");

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

            // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R853
            Site.CaptureRequirement(
                853,
                @"[In UtcDueDate] The server returns a Status element value of 6 in the Sync command response if this condition[To set a flag, the tasks:StartDate element (section 2.2.2.72), tasks:DueDate element, tasks:UtcStartDate element, and tasks:UtcDueDate element either all MUST be set, or all MUST be NULL.] is not met.");
            #endregion
        }
コード例 #9
0
        public void MSASCMD_S19_TC27_Sync_Change()
        {
            Site.Assume.AreEqual<string>("Base64", Common.GetConfigurationPropertyValue("HeaderEncodingType", this.Site), "The device ID should be same across all requests, when the HeaderEncodingType is PlainText.");
            CMDAdapter.ChangeDeviceID(Common.GetConfigurationPropertyValue("DeviceID", this.Site));
            this.Sync(TestSuiteBase.CreateEmptySyncRequest(this.User1Information.ContactsCollectionId));

            #region Add a new contact with Sync operation.
            string contactFileAS = Common.GenerateResourceName(Site, "FileAS");
            Request.SyncCollectionAdd addData = this.CreateAddContactCommand("FirstName", "MiddleName", "LastName", contactFileAS, null);

            SyncRequest syncRequest = TestSuiteBase.CreateSyncAddRequest(this.LastSyncKey, this.User1Information.ContactsCollectionId, addData);
            SyncResponse syncResponse = this.Sync(syncRequest, false);
            Site.Assert.IsNotNull(syncResponse.ResponseData.Item, "The items returned in the Sync command response should not be null.");
            Response.SyncCollectionsCollectionResponses collectionResponse = TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Responses) as Response.SyncCollectionsCollectionResponses;
            Site.Assert.IsNotNull(collectionResponse, "The responses element should exist in the Sync response.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R5255
            Site.CaptureRequirementIfIsNotNull(
                collectionResponse.Add,
                5255,
                @"[In Responses] Element Responses in Sync command response (section 2.2.2.19), the child elements is Add (section 2.2.3.7.2)[, Fetch (section 2.2.3.63.2) ](If the operation succeeded.)");

            Site.Assert.AreEqual<int>(1, int.Parse(collectionResponse.Add[0].Status), "The new contact should be added correctly.");
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.ContactsCollectionId, contactFileAS);
            this.FolderSync();
            #endregion

            #region Change DeviceID and synchronize the changes in the Contacts folder.
            string syncKey = this.LastSyncKey;
            CMDAdapter.ChangeDeviceID("Device2");
            this.RecordDeviceInfoChanged();

            this.GetInitialSyncResponse(this.User1Information.ContactsCollectionId);
            syncRequest.RequestData.Collections[0].SyncKey = this.LastSyncKey;
            syncResponse = this.Sync(syncRequest);
            Site.Assert.IsNotNull(syncResponse.ResponseData.Item, "The items returned in the Sync command response should not be null.");
            string serverId = TestSuiteBase.FindServerId(syncResponse, "FileAs", contactFileAS);
            Site.Assert.IsNotNull(serverId, "The added contact should be synchronized down to the current device.");
            #endregion

            #region Change the added Contact information and then synchronize the change to the server.
            string updatedContactFileAS = Common.GenerateResourceName(Site, "UpdatedFileAS");
            Request.SyncCollectionChange appDataChange = CreateChangedContact(serverId, new Request.ItemsChoiceType7[] { Request.ItemsChoiceType7.FileAs }, new object[] { updatedContactFileAS });
            syncRequest = CreateSyncChangeRequest(this.LastSyncKey, this.User1Information.ContactsCollectionId, appDataChange);
            syncResponse = this.Sync(syncRequest);
            Site.Assert.AreEqual<uint>(1, Convert.ToUInt32(TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Status)), "The status code of Sync change operation should be 1.");
            #endregion

            #region Restore DeviceID and synchronize the changes in the Contacts folder.
            
            CMDAdapter.ChangeDeviceID(Common.GetConfigurationPropertyValue("DeviceID", this.Site));

            syncRequest = TestSuiteBase.CreateEmptySyncRequest(this.User1Information.ContactsCollectionId);
            syncRequest.RequestData.Collections[0].SyncKey = syncKey;
            syncRequest.RequestData.Collections[0].GetChanges = true;
            syncRequest.RequestData.Collections[0].GetChangesSpecified = true;
            syncResponse = this.Sync(syncRequest);
            Site.Assert.AreEqual<uint>(1, Convert.ToUInt32(TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Status)), "The Sync command should be conducted successfully.");
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.ContactsCollectionId, updatedContactFileAS);

            Response.SyncCollectionsCollectionCommands syncCollectionCommands = TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Commands) as Response.SyncCollectionsCollectionCommands;
            Site.Assert.IsNotNull(syncCollectionCommands, "The commands element should exist in the Sync response.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R3119
            Site.CaptureRequirementIfIsNotNull(
                syncCollectionCommands.Change,
                3119,
                @"[In GetChanges] If there have been changes since the last synchronization, the server response includes a Commands element (section 2.2.3.32) that contains additions, deletions, and changes.");

            Site.Assert.IsTrue(((Response.SyncCollections)syncResponse.ResponseData.Item).Collection.Length >= 1, "The length of Collections element should not less than 1. The actual value is {0}.", ((Response.SyncCollections)syncResponse.ResponseData.Item).Collection.Length);

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R4602
            // If the Assert statement above is passed, the requirement is captured.
            Site.CaptureRequirement(
                4602,
                @"[In SyncKey(Sync)] If the synchronization is successful, the server responds by sending all objects in the collection.");

            List<string> elements = new List<string>
            {
                Request.ItemsChoiceType4.FirstName.ToString(),
                Request.ItemsChoiceType4.MiddleName.ToString(),
                Request.ItemsChoiceType4.LastName.ToString()
            };

            Response.SyncCollectionsCollectionCommands commands = TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Commands) as Response.SyncCollectionsCollectionCommands;
            Site.Assert.IsNotNull(commands, "The Commands element should not be null.");
            Site.Assert.IsNotNull(commands.Change, "The Change element should not be null.");
            Site.Assert.IsTrue(commands.Change.Length > 0, "The Change element should have one sub-element at least.");
            Site.Assert.IsNotNull(commands.Change[0].ApplicationData, "The ApplicationData element of the first Change element should not be null.");
            Site.Assert.IsNotNull(commands.Change[0].ApplicationData.ItemsElementName, "The ItemsElementName element of the ApplicationData element of the first Change element should not be null.");
            Site.Assert.IsTrue(commands.Change[0].ApplicationData.ItemsElementName.Length > 0, "The ItemsElementName element of the ApplicationData element of the first Change element should have one sub-element at least.");

            bool isVerifyR879 = false;
            foreach (Response.ItemsChoiceType7 itemElementName in commands.Change[0].ApplicationData.ItemsElementName)
            {
                if (elements.Contains(itemElementName.ToString()))
                {
                    isVerifyR879 = true;
                    break;
                }
            }

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R879
            Site.CaptureRequirementIfIsFalse(
                isVerifyR879,
                879,
                @"[In Change] In all other cases, if an in-schema property is not specified in a change request, the property is actively deleted from the item on the server.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R881
            Site.CaptureRequirementIfIsFalse(
                isVerifyR879,
                881,
                @"[In Change] Otherwise [if a client dose not be aware of this [if an in-schema property is not specified in a change request, the property is actively deleted from the item on the server] when it [client] is sending Sync requests], data can be unintentionally removed.");
            #endregion

            #region Send a MIME-formatted e-mail from user1 to user2.
            string emailSubject = Common.GenerateResourceName(Site, "subject");
            this.SendPlainTextEmail(null, emailSubject, this.User1Information.UserName, this.User2Information.UserName, null);

            this.SwitchUser(this.User2Information);
            serverId = TestSuiteBase.FindServerId(this.CheckEmail(this.User2Information.InboxCollectionId, emailSubject, null), "Subject", emailSubject);
            TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, emailSubject);
            #endregion

            #region Call Sync command to set a flag to an email.
            string updatedEmailSubject = Common.GenerateResourceName(Site, "updatedSubject");

            DateTime startDate = DateTime.Now.AddDays(5.0);
            DateTime dueDate = startDate.AddHours(1.0);

            // Define email flag
            Request.Flag emailFlag = new Request.Flag
            {
                StartDate = startDate,
                StartDateSpecified = true,
                DueDate = dueDate,
                DueDateSpecified = true
            };

            Request.SyncCollectionChangeApplicationData applicationData = new Request.SyncCollectionChangeApplicationData
            {
                ItemsElementName = new Request.ItemsChoiceType7[] { Request.ItemsChoiceType7.Flag, Request.ItemsChoiceType7.Subject },
                Items = new object[] { emailFlag, updatedEmailSubject }
            };

            appDataChange = new Request.SyncCollectionChange { ApplicationData = applicationData, ServerId = serverId };

            syncRequest = CreateSyncChangeRequest(this.LastSyncKey, this.User2Information.InboxCollectionId, appDataChange);
            syncResponse = this.Sync(syncRequest);

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R875
            Site.CaptureRequirementIfAreEqual<uint>(
                1,
                Convert.ToUInt32(TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Status)),
                875,
                @"[In Change] If all the other elements are sent, extra bandwidth is used, but no errors occur.");

            // Define updated email flag
            Request.Flag updatedEmailFlag = new Request.Flag
            {
                StartDate = startDate,
                StartDateSpecified = true,
                DueDate = dueDate,
                DueDateSpecified = true
            };

            applicationData = new Request.SyncCollectionChangeApplicationData
            {
                ItemsElementName = new Request.ItemsChoiceType7[] { Request.ItemsChoiceType7.Flag },
                Items = new object[] { updatedEmailFlag }
            };

            appDataChange = new Request.SyncCollectionChange { ApplicationData = applicationData, ServerId = serverId };

            syncRequest = CreateSyncChangeRequest(this.LastSyncKey, this.User2Information.InboxCollectionId, appDataChange);
            syncResponse = this.Sync(syncRequest);
            Site.Assert.AreEqual<uint>(1, Convert.ToUInt32(TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Status)), "The email should be updated successfully.");

            syncResponse = this.SyncChanges(this.User2Information.InboxCollectionId);
            Site.Assert.IsNotNull(syncResponse.ResponseData.Item, "The items returned in the Sync command response should not be null.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R873
            bool isVerifyR873 = !string.IsNullOrEmpty(TestSuiteBase.FindServerId(syncResponse, "Subject", emailSubject));
            Site.CaptureRequirementIfIsTrue(
                isVerifyR873,
                873,
                @"[In Change] Certain in-schema properties remain untouched in the following three cases: If there is only an email:Flag ([MS-ASEMAIL] section 2.2.2.27) [, email:Read ([MS-ASEMAIL] section 2.2.2.47), or email:Categories ([MS-ASEMAIL] section 2.2.2.9)] change (that is, if only an email:Flag, email:Categories or email:Read element is present), all other properties will remain unchanged.");
            #endregion

            #region Send a MIME-formatted e-mail from user1 to user2.
            this.SwitchUser(this.User1Information);
            emailSubject = Common.GenerateResourceName(this.Site, "subject");
            this.SendPlainTextEmail(null, emailSubject, this.User1Information.UserName, this.User2Information.UserName, null);

            this.SwitchUser(this.User2Information);
            serverId = TestSuiteBase.FindServerId(this.CheckEmail(this.User2Information.InboxCollectionId, emailSubject, null), "Subject", emailSubject);
            TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, emailSubject);
            #endregion

            #region Call Sync command to set a Read element to an email.
            applicationData = new Request.SyncCollectionChangeApplicationData
            {
                ItemsElementName = new Request.ItemsChoiceType7[] { Request.ItemsChoiceType7.Read, Request.ItemsChoiceType7.Subject },
                Items = new object[] { true, updatedEmailSubject }
            };

            appDataChange = new Request.SyncCollectionChange { ApplicationData = applicationData, ServerId = serverId };

            syncRequest = CreateSyncChangeRequest(this.LastSyncKey, this.User2Information.InboxCollectionId, appDataChange);
            syncResponse = this.Sync(syncRequest);
            Site.Assert.AreEqual<uint>(1, Convert.ToUInt32(TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Status)), "The email should be updated successfully.");

            applicationData = new Request.SyncCollectionChangeApplicationData
            {
                ItemsElementName = new Request.ItemsChoiceType7[] { Request.ItemsChoiceType7.Read },
                Items = new object[] { true }
            };

            appDataChange = new Request.SyncCollectionChange { ApplicationData = applicationData, ServerId = serverId };

            syncRequest = CreateSyncChangeRequest(this.LastSyncKey, this.User2Information.InboxCollectionId, appDataChange);
            syncResponse = this.Sync(syncRequest);
            Site.Assert.AreEqual<uint>(1, Convert.ToUInt32(TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Status)), "The email should be updated successfully.");

            syncResponse = this.SyncChanges(this.User2Information.InboxCollectionId);
            Site.Assert.IsNotNull(syncResponse.ResponseData.Item, "The items returned in the Sync command response should not be null.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R5825
            bool isVerifyR5825 = !string.IsNullOrEmpty(TestSuiteBase.FindServerId(syncResponse, "Subject", emailSubject));
            Site.CaptureRequirementIfIsTrue(
                isVerifyR5825,
                5825,
                @"[In Change] Certain in-schema properties remain untouched in the following three cases: If there is only an [email:Flag ([MS-ASEMAIL] section 2.2.2.27),] email:Read ([MS-ASEMAIL] section 2.2.2.47) [, or email:Categories ([MS-ASEMAIL] section 2.2.2.9)] change (that is, if only an email:Flag, email:Categories or email:Read element is present), all other properties will remain unchanged.");
            #endregion

            #region Send a MIME-formatted e-mail from user1 to user2.
            this.SwitchUser(this.User1Information);
            emailSubject = Common.GenerateResourceName(this.Site, "subject");
            this.SendPlainTextEmail(null, emailSubject, this.User1Information.UserName, this.User2Information.UserName, null);

            this.SwitchUser(this.User2Information);
            serverId = TestSuiteBase.FindServerId(this.CheckEmail(this.User2Information.InboxCollectionId, emailSubject, null), "Subject", emailSubject);
            TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, emailSubject);
            #endregion

            #region Call Sync command to set a Categories element to an email.
            Request.Categories categories = new Request.Categories { Category = new string[] { "company" } };

            applicationData = new Request.SyncCollectionChangeApplicationData
            {
                ItemsElementName = new Request.ItemsChoiceType7[] { Request.ItemsChoiceType7.Categories, Request.ItemsChoiceType7.Subject },
                Items = new object[] { categories, updatedEmailSubject }
            };

            appDataChange = new Request.SyncCollectionChange { ApplicationData = applicationData, ServerId = serverId };

            syncRequest = CreateSyncChangeRequest(this.LastSyncKey, this.User2Information.InboxCollectionId, appDataChange);
            syncResponse = this.Sync(syncRequest);
            Site.Assert.AreEqual<uint>(1, Convert.ToUInt32(TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Status)), "The email should be updated successfully.");

            applicationData = new Request.SyncCollectionChangeApplicationData
            {
                ItemsElementName = new Request.ItemsChoiceType7[] { Request.ItemsChoiceType7.Categories },
                Items = new object[] { categories }
            };

            appDataChange = new Request.SyncCollectionChange { ApplicationData = applicationData, ServerId = serverId };

            syncRequest = CreateSyncChangeRequest(this.LastSyncKey, this.User2Information.InboxCollectionId, appDataChange);
            syncResponse = this.Sync(syncRequest);
            Site.Assert.AreEqual<uint>(1, Convert.ToUInt32(TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Status)), "The email should be updated successfully.");

            syncResponse = this.SyncChanges(this.User2Information.InboxCollectionId);
            Site.Assert.IsNotNull(syncResponse.ResponseData.Item, "The items returned in the Sync command response should not be null.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R5826
            bool isVerifyR5826 = !string.IsNullOrEmpty(TestSuiteBase.FindServerId(syncResponse, "Subject", emailSubject));
            Site.CaptureRequirementIfIsTrue(
                isVerifyR5826,
                5826,
                @"[In Change] Certain in-schema properties remain untouched in the following three cases: If there is only [an email:Flag ([MS-ASEMAIL] section 2.2.2.27), email:Read ([MS-ASEMAIL] section 2.2.2.47), or] email:Categories ([MS-ASEMAIL] section 2.2.2.9) change (that is, if only an email:Flag, email:Categories or email:Read element is present), all other properties will remain unchanged.");
            #endregion

            #region Call Sync Add operation to add a new contact.
            this.SwitchUser(this.User1Information);
            this.Sync(TestSuiteBase.CreateEmptySyncRequest(this.User1Information.ContactsCollectionId));

            string contactFileAs = Common.GenerateResourceName(Site, "FileAS");

            addData.ClientId = TestSuiteBase.ClientId;
            addData.ApplicationData = new Request.SyncCollectionAddApplicationData
            {
                ItemsElementName =
                    new Request.ItemsChoiceType8[]
                    {
                        Request.ItemsChoiceType8.FileAs, Request.ItemsChoiceType8.FirstName,
                        Request.ItemsChoiceType8.MiddleName, Request.ItemsChoiceType8.LastName,
                        Request.ItemsChoiceType8.Picture
                    },
                Items =
                    new object[]
                    {
                        contactFileAs, "FirstName", "MiddleName", "LastName",
                        Convert.ToBase64String(File.ReadAllBytes("number1.jpg"))
                    }
            };

            if ("12.1" != Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site))
            {
                addData.Class = "Contacts";
            }

            syncRequest = TestSuiteBase.CreateSyncAddRequest(this.LastSyncKey, this.User1Information.ContactsCollectionId, addData);
            syncResponse = this.Sync(syncRequest, false);

            collectionResponse = TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Responses) as Response.SyncCollectionsCollectionResponses;
            Site.Assert.IsNotNull(collectionResponse, "The responses element should exist in the Sync response.");
            Site.Assert.AreEqual<int>(1, int.Parse(collectionResponse.Add[0].Status), "The new contact should be added successfully.");
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.ContactsCollectionId, contactFileAs);

            syncResponse = this.SyncChanges(this.User1Information.ContactsCollectionId);
            Site.Assert.IsNotNull(syncResponse.ResponseData.Item, "The items returned in the Sync command response should not be null.");
            serverId = TestSuiteBase.FindServerId(syncResponse, "FileAs", contactFileAs);
            Site.Assert.IsNotNull(serverId, "The added contact should be synchronized down to the current device.");

            Response.SyncCollectionsCollectionCommandsAddApplicationData responseApplicationData = TestSuiteBase.GetAddApplicationData(syncResponse, Response.ItemsChoiceType8.FileAs, contactFileAS);
            Site.Assert.IsNotNull(responseApplicationData, "The ApplicationData of the calendar should not be null.");

            Response.Body body = null;
            for (int i = 0; i < responseApplicationData.ItemsElementName.Length; i++)
            {
                if (responseApplicationData.ItemsElementName[i] == Response.ItemsChoiceType8.Body)
                {
                    body = responseApplicationData.Items[i] as Response.Body;
                    break;
                }
            }

            Site.Assert.IsNotNull(body, "The Body element should be in the ApplicationData of the contact item.");
            string originalPicture = (string)TestSuiteBase.GetElementValueFromSyncResponse(syncResponse, serverId, Response.ItemsChoiceType8.Picture);
            Site.Assert.IsNotNull(originalPicture, "The picture of the contact should exist.");
            #endregion

            #region Call Sync change operation to update the FileAs element of the contact.
            string updatedContactFileAs = Common.GenerateResourceName(Site, "updatedContactFileAs");

            Request.SyncCollectionChangeApplicationData changeApplicationData = new Request.SyncCollectionChangeApplicationData
            {
                ItemsElementName = new Request.ItemsChoiceType7[] { Request.ItemsChoiceType7.FileAs },
                Items = new object[] { updatedContactFileAs }
            };

            appDataChange = new Request.SyncCollectionChange
            {
                ApplicationData = changeApplicationData,
                ServerId = serverId
            };

            syncRequest = CreateSyncChangeRequest(this.LastSyncKey, this.User1Information.ContactsCollectionId, appDataChange);
            syncResponse = this.Sync(syncRequest);
            Site.Assert.AreEqual<uint>(1, Convert.ToUInt32(TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Status)), "The FileAs of the contact should be updated successfully.");
            TestSuiteBase.RemoveRecordCaseRelativeItems(this.User1Information, this.User1Information.ContactsCollectionId, contactFileAs);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.ContactsCollectionId, updatedContactFileAs);

            syncResponse = this.SyncChanges(this.User1Information.ContactsCollectionId);
            Site.Assert.IsNotNull(syncResponse.ResponseData.Item, "The items returned in the Sync command response should not be null.");

            responseApplicationData = TestSuiteBase.GetAddApplicationData(syncResponse, Response.ItemsChoiceType8.FileAs, updatedContactFileAs);
            Site.Assert.IsNotNull(responseApplicationData, "The ApplicationData of the updated contact should not be null.");

            Response.Body currentBody = null;
            for (int i = 0; i < responseApplicationData.ItemsElementName.Length; i++)
            {
                if (responseApplicationData.ItemsElementName[i] == Response.ItemsChoiceType8.Body)
                {
                    currentBody = responseApplicationData.Items[i] as Response.Body;
                    break;
                }
            }

            Site.Assert.IsNotNull(currentBody, "The Body element should be in the ApplicationData of the updated contact item.");
            string currentPicture = (string)TestSuiteBase.GetElementValueFromSyncResponse(syncResponse, serverId, Response.ItemsChoiceType8.Picture);
            Site.Assert.IsNotNull(currentPicture, "The picture of the updated contact should exist.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R878
            bool isVerifyR878 = body.Type == currentBody.Type && body.EstimatedDataSize == currentBody.EstimatedDataSize && originalPicture == currentPicture;
            Site.CaptureRequirementIfIsTrue(
                isVerifyR878,
                878,
                @"[In Change] [Certain in-schema properties remain untouched in the following three cases:] If the airsyncbase:Body, airsyncbase:Data, or contacts:Picture elements are not present, the corresponding properties will remain unchanged.");
            #endregion
        }
コード例 #10
0
        public void MSASEMAIL_S03_TC02_AddFlag_InvalidStatus()
        {
            #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 a flag with invalid Status value.
            Request.Flag flag = new Request.Flag
            {
                Status = "3",
                FlagType = "for Follow Up",
                CompleteTime = DateTime.Now,
                CompleteTimeSpecified = true,
                DateCompleted = DateTime.Now,
                DateCompletedSpecified = true
            };

            // Get the synchronization result.
            SyncStore getEmailItem = this.GetSyncResult(emailSubject, this.User2Information.InboxCollectionId, null);

            // Get the new added email item
            Sync emailItem = TestSuiteHelper.GetSyncAddItem(getEmailItem, emailSubject);

            // Add flag to the email item
            SyncStore updateResult = this.UpdateEmail(this.User2Information.InboxCollectionId, getEmailItem.SyncKey, null, emailItem.ServerId, flag, null);

            Site.Assert.AreEqual<int>(
                6,
                int.Parse(updateResult.ChangeResponses[0].Status),
                "The server should return a Status 6 in the Sync command response if the flag Status element is set to a value other than 0, 1, or 2.");
            #endregion

            #region Verify requirement
            // If the server returns a Status element value of 6 in the Sync command response, then MS-ASEMAIL_R757 can be captured.
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R757");

            // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R757
            Site.CaptureRequirement(
                757,
                @"[In Status] The server returns a Status element ([MS-ASCMD] section 2.2.3.167.16) value of 6 in the Sync command response ([MS-ASCMD] section 2.2.2.20) if the flag Status element is set to a value other than 0, 1, or 2.");
            #endregion
        }
コード例 #11
0
        public void MSASEMAIL_S01_TC08_FlagReadAndOtherEmailClassPropertiesChanged()
        {
            Site.Assume.AreNotEqual<string>("12.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The Categories element is not supported when the ActiveSyncProtocolVersion is 12.1.");

            #region Call method SendMail 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 and categories for the e-mail item and synchronize it with the server.
            // Get the email item
            SyncStore store = this.GetSyncResult(emailSubject, this.User2Information.InboxCollectionId, null);
            Sync item = TestSuiteHelper.GetSyncAddItem(store, emailSubject);

            // Get the result of adding flag and categories
            SyncStore getChangedResult = this.AddFlagAndCategories(this.User2Information.InboxCollectionId, store.SyncKey, item.ServerId);
            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 all Sync command with Change element to update the flag , categories and read properties of the e-mail and synchronize it with server.
            Request.Flag newFlag = new Request.Flag
            {
                Status = "2",
                FlagType = "Flag for follow up",
                CompleteTime = DateTime.Now,
                CompleteTimeSpecified = true,
                DateCompleted = DateTime.Now,
                DateCompletedSpecified = true
            };

            string newCategory = Common.GenerateResourceName(Site, "NewCategory");
            Collection<string> newCategories = new Collection<string> { newCategory };

            // Update Read, Flag and Categories properties
            this.UpdateEmail(this.User2Information.InboxCollectionId, getChangedResult.SyncKey, false, item.ServerId, newFlag, newCategories);

            // Get server changes 
            SyncStore updateResult = this.SyncChanges(getChangedResult.SyncKey, this.User2Information.InboxCollectionId, null);
            item = TestSuiteHelper.GetSyncChangeItem(updateResult, 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 the server send full item airSync:Change to client, then MS-ASEMAIL_R106 can be captured.
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R106");

            // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R106
            Site.CaptureRequirementIfIsTrue(
                item.Email.FlagIsInclude && item.Email.Flag != null && item.Email.ReadIsInclude && item.Email.CategoriesIsInclude && item.Email.Categories != null,
                106,
                @"[In Sending E-Mail Changes to the Client] If Read flag, Flag properties, and Other E-Mail class properties changed, Non-E-Mail class properties not changed, Server action for e-mail item in Sync commend response is: Send full item airsync:Change to client.");

            // If MS-ASEMAIL_R106 can be captured successfully, it means server partition email changes into the case "changes to Read flag, Flag properties and other E-Mail class properties, so MS-ASEMAIL_R1017 can also be captured."
            if (Common.IsRequirementEnabled(1017, this.Site))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R1017");

                // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R1017
                Site.CaptureRequirement(
                    1017,
                    @"[In Appendix B: Product Behavior] Implementation does partition email changes into one or more of the following categories:
Changes to the Read flag (section 2.2.2.47)
Changes to the Flag properties (section 2.2.2.27)
Changes to other E-Mail class properties, such as Subject (section 2.2.2.63)
Changes to non-E-Mail class properties (Exchange Server 2007 Sp1 and above follow this behavior.)");
            }
            #endregion
        }
コード例 #12
0
        public void MSASEMAIL_S01_TC07_BothReadAndFlagChanged()
        {
            #region Call method SendMail 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 and categories for the e-mail item and synchronize it with the server.
            // Get the email item
            SyncStore getEmailItem = this.GetSyncResult(emailSubject, this.User2Information.InboxCollectionId, null);
            Sync item = TestSuiteHelper.GetSyncAddItem(getEmailItem, emailSubject);

            // Get the result of adding flag and categories
            SyncStore getChangedResult = this.AddFlagAndCategories(this.User2Information.InboxCollectionId, getEmailItem.SyncKey, item.ServerId);
            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 all Sync command with Change element to update the flag and read properties of the e-mail and synchronize it with server.
            Request.Flag newFlag = new Request.Flag
            {
                Status = "2",
                FlagType = "Flag for follow up",
                CompleteTime = DateTime.Now,
                CompleteTimeSpecified = true,
                DateCompleted = DateTime.Now,
                DateCompletedSpecified = true
            };

            // Update Flag and Read property
            this.UpdateEmail(this.User2Information.InboxCollectionId, getChangedResult.SyncKey, false, item.ServerId, newFlag, null);

            // Get server changes 
            SyncStore updateResult = this.SyncChanges(getChangedResult.SyncKey, this.User2Information.InboxCollectionId, null);
            item = TestSuiteHelper.GetSyncChangeItem(updateResult, 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 requirement.
            // If the server send Read flag and Flag block, then MS-ASEMAIL_R104 can be captured.
            if (!Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("12.1"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R104");

                // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R104
                Site.CaptureRequirementIfIsTrue(
                    item.Email.FlagIsInclude && item.Email.Flag != null && item.Email.ReadIsInclude,
                    104,
                    @"[In Sending E-Mail Changes to the Client] If Read flag and Flag properties changed, Other E-Mail class properties and Non-E-Mail class properties not changed, Server action for e-mail item in Sync commend response is: Send Read flag and Flag block.");
            }
            #endregion
        }
コード例 #13
0
        public void MSASEMAIL_S01_TC06_OnlyFlagPropertiesChanged()
        {
            #region Call method SendMail 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 and categories for the e-mail item and synchronize it with the server.
            // Get the email item
            SyncStore getEmailItem = this.GetSyncResult(emailSubject, this.User2Information.InboxCollectionId, null);
            Sync item = TestSuiteHelper.GetSyncAddItem(getEmailItem, emailSubject);

            // Get the result of adding flag and categories
            SyncStore getChangedResult = this.AddFlagAndCategories(this.User2Information.InboxCollectionId, getEmailItem.SyncKey, item.ServerId);
            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 Call Sync command with Change element to update the Flag property of the e-mail and synchronize it with server.
            Request.Flag newFlag = new Request.Flag
            {
                Status = "2",
                FlagType = "Flag for follow up",
                CompleteTime = DateTime.Now,
                CompleteTimeSpecified = true,
                DateCompleted = DateTime.Now,
                DateCompletedSpecified = true
            };

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

            // Get update result from server 
            this.SyncChanges(getChangedResult.SyncKey, this.User2Information.InboxCollectionId, null);
            #endregion

            #region Verify requirements.
            // If the server includes the Flag element as the only child element of the airSync:ApplicationData within the airSync:Change element for that e-mail item in the Sync command response, 
            // then MS-ASEMAIL_R1019 will be captured.
            if (!Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("12.1"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R76");

                // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R76
                Site.CaptureRequirementIfIsTrue(
                    TestSuiteHelper.IsOnlySpecifiedElement((XmlElement)this.EMAILAdapter.LastRawResponseXml, "ApplicationData", "Flag"),
                    76,
                    @"[In Sending E-Mail Changes to the Client] If only Flag properties have changed for an e-mail item, the server MUST include the Flag element as the only child element of the airsync:ApplicationData element within the airsync:Change element for that e-mail item in the Sync command response.");

                // If the server includes the Flag element as the only child element of the airSync:ApplicationData within the airSync:Change element for that e-mail item in the Sync command response, then MS-ASEMAIL_R96 will be captured.
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R96");

                // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R96
                Site.CaptureRequirementIfIsTrue(
                    TestSuiteHelper.IsOnlySpecifiedElement((XmlElement)this.EMAILAdapter.LastRawResponseXml, "ApplicationData", "Flag"),
                    96,
                    @"[In Sending E-Mail Changes to the Client] If Read flag, Other E-mail class properties and Non-E-mail class properties not changed, and Flag properties changed, Server action for e-mail item in Sync command response is: Send Flag block only.");
            }
            #endregion
        }
コード例 #14
0
        public void MSASEMAIL_S03_TC06_AddFlag_UtcDueDateBeforeUtcStartDate()
        {
            #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 with UtcDueDate occurs before UtcStartDat.
            Request.Flag flag = new Request.Flag
            {
                Status = "2",
                FlagType = "for Follow Up",
                StartDate = DateTime.Now.AddDays(20),
                StartDateSpecified = true,
                UtcStartDate = DateTime.Now.AddDays(20),
                UtcStartDateSpecified = true,
                DueDate = DateTime.Now.AddDays(30),
                DueDateSpecified = true,
                UtcDueDate = DateTime.Now,
                UtcDueDateSpecified = true
            };

            // Get the synchronization result
            SyncStore getEmailItem = this.GetSyncResult(emailSubject, this.User2Information.InboxCollectionId, null);

            // Get the new added email item
            Sync emailItem = TestSuiteHelper.GetSyncAddItem(getEmailItem, emailSubject);

            // Add flag to the email item
            SyncStore updateResult = this.UpdateEmail(this.User2Information.InboxCollectionId, getEmailItem.SyncKey, null, emailItem.ServerId, flag, null);

            Site.Assert.AreEqual<int>(
                6,
                int.Parse(updateResult.ChangeResponses[0].Status),
                "The server should return a Status 6 in the Sync command response if the UtcDueDate occurs before UtcStartDate.");
            #endregion

            #region Verify requirements
            // If the server returns a Status element value of 6 in the Sync command response, then MS-ASEMAIL_R862 and MS-ASEMAIL_R851 can be captured.
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R851");

            // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R851
            Site.CaptureRequirement(
                851,
                @"[In UtcDueDate] The server returns a Status element ([MS-ASCMD] section 2.2.3.167.16) value of 6 in the Sync command response ([MS-ASCMD] section 2.2.2.20) if this condition[When a flag is updated, the tasks:UtcDueDate element value MUST NOT occur before the tasks:UtcStartDate element (section 2.2.2.87) value. ] is not met.");

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

            // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R862
            Site.CaptureRequirement(
                862,
                @"[In UtcStartDate] The server returns a Status element ([MS-ASCMD] section 2.2.3.167.16) value of 6 in the Sync command response ([MS-ASCMD] section 2.2.2.20) if this condition[When a flag is updated, the tasks:UtcStartDate element value MUST occur before the tasks:UtcDueDate element (section 2.2.2.86) value. ] is not met.");
            #endregion
        }
コード例 #15
0
        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
        }
コード例 #16
0
        public void MSASEMAIL_S03_TC01_AddFlag_AllElements()
        {
            #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 with all flag child elements.
            DateTime startDate = DateTime.Now;
            DateTime dueDate = DateTime.Now.AddDays(20);

            // Create flag element with all properties
            Request.Flag flag = new Request.Flag
            {
                Status = "2",
                FlagType = "for Follow Up",
                Subject = Common.GenerateResourceName(Site, "FlagSubject"),
                StartDate = startDate,
                StartDateSpecified = true,
                UtcStartDate = startDate.ToUniversalTime(),
                UtcStartDateSpecified = true,
                DueDate = dueDate,
                DueDateSpecified = true,
                UtcDueDate = dueDate.ToUniversalTime(),
                UtcDueDateSpecified = true,
                OrdinalDate = DateTime.Now,
                OrdinalDateSpecified = true,
                ReminderSet = 1,
                ReminderSetSpecified = true,
                ReminderTime = DateTime.Now.AddDays(12),
                ReminderTimeSpecified = true,
                CompleteTime = DateTime.Now.AddDays(30),
                CompleteTimeSpecified = true,
                DateCompleted = DateTime.Now.AddDays(30),
                DateCompletedSpecified = true
            };

            flag.SubOrdinalDate = flag.OrdinalDate.ToString();

            // Get the email item
            SyncStore getEmailItem = this.GetSyncResult(emailSubject, this.User2Information.InboxCollectionId, null);
            Sync item = TestSuiteHelper.GetSyncAddItem(getEmailItem, emailSubject);
            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);

            // 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);
            #endregion

            #region Verify requirements
            if (Common.IsRequirementEnabled(1007, this.Site))
            {
                // Because MS-ASEMAIL doesn't test sorting, if the Sync command succeeds and the response contains a SubOrdinalDate value, then MS-ASEMAIL_R1007 can be captured.
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R1007");

                // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R1007
                Site.CaptureRequirementIfIsNotNull(
                    item.Email.Flag.SubOrdinalDate,
                    1007,
                    @"[In Appendix B: Product Behavior] It[tasks:SubOrdinalDate] can contain any string value and is used for sorting if there are duplicate tasks:OrdinalDate element (section 2.2.2.45) values. (Exchange Server 2007 SP1 and above follow this behavior.)");
            }

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

            // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R692
            Site.CaptureRequirementIfAreEqual<byte>(
                1,
                item.Email.Flag.ReminderSet,
                692,
                @"[In ReminderSet] The value of this element[tasks:ReminderSet] is set to 1 if a reminder has been set for the task.");
            #endregion
        }
コード例 #17
0
        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
        }
コード例 #18
0
        public void MSASEMAIL_S03_TC08_AddFlag_ValidDate()
        {
            #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 to add flag with valid StartDate, DueDate, UtcStartDate and UtcDueStartDate.
            Request.Flag flag = new Request.Flag
            {
                Status = "2",
                FlagType = "for Follow Up",
                StartDate = DateTime.Now,
                StartDateSpecified = true,
                UtcStartDate = DateTime.Now,
                UtcStartDateSpecified = true,
                DueDate = DateTime.Now.AddDays(20),
                DueDateSpecified = true,
                UtcDueDate = DateTime.Now.AddDays(20),
                UtcDueDateSpecified = true
            };

            // Get the synchronization result
            SyncStore getEmailItem = this.GetSyncResult(emailSubject, this.User2Information.InboxCollectionId, null);

            // Add flag to an email item
            SyncStore getChangedResult = this.AddEmailFag(this.User2Information, getEmailItem, emailSubject, flag);

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

            #region Verify requirements
            // If server returned a Status 1, that is to say, the sync command is successful, then MS-ASEMAIL_R850, MS-ASEMAIL_R861, MS-ASEMAIL_R738 and MS-ASEMAIL_R406 can be captured.
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R850");

            // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R850
            Site.CaptureRequirement(
                850,
                @"[In UtcDueDate] When a flag is updated, the tasks:UtcDueDate element value MUST NOT occur before the tasks:UtcStartDate element (section 2.2.2.87) value.");

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

            // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R861
            Site.CaptureRequirement(
                861,
                @"[In UtcStartDate] When a flag is updated, the tasks:UtcStartDate element value MUST occur before the tasks:UtcDueDate element (section 2.2.2.86) value.");

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

            // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R738
            Site.CaptureRequirement(
                738,
                @"[In StartDate] When a flag is updated, the tasks:StartDate element value MUST NOT occur after the tasks:DueDate element (section 2.2.2.31) value.");

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

            // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R406
            Site.CaptureRequirement(
                406,
                @"[In DueDate] When a flag is updated, the tasks:DueDate element value MUST NOT occur before the tasks:StartDate element (section 2.2.2.72) value.");
            #endregion
        }
コード例 #19
0
        public void MSASEMAIL_S03_TC31_UpdateTaskFlagMetadata()
        {
            #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 with properties Status = 2,tasks:Subject,FlagType = "Flag for follow up",tasks:StartDate and tasks:UtcStartDate,tasks:DueDate and tasks:UtcDueDate,tasks:ReminderSet,tasks:ReminderTime
            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 update the email flag.
            Request.Flag newFlag = new Request.Flag { Status = "2", FlagType = "for Follow Up" };

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

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

            #region Verify requirements
            // If the FlagType value returned from server is "for Follow Up", that is to say, FlagType has been updated successfully, then MS-ASEMAIL_R91 can be captured.
            this.Site.CaptureRequirementIfAreEqual<string>(
                newFlag.FlagType,
                item.Email.Flag.FlagType,
                91,
                @"[In Updating E-Mail Flags] When Action is Update flag metadata on a task, Required Properties from Device are: All updated properties.");
            #endregion
        }
コード例 #20
0
        public void MSASEMAIL_S03_TC12_MarkEmailComplete()
        {
            #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 mark an email as complete.
            Request.Flag flag = new Request.Flag
            {
                Status = "1",
                CompleteTime = DateTime.Now,
                CompleteTimeSpecified = true,
                DateCompleted = DateTime.Now,
                DateCompletedSpecified = 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);
            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_R86 can be captured.
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R86");

            // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R86
            Site.CaptureRequirement(
                86,
                @"[In Updating E-Mail Flags] When Action is Mark an email flag as complete, Required Properties from Device are: Status = 1, CompleteTime (section 2.2.2.19), tasks:DateCompleted.");

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

            // If the CompleteTime is specified in response, then MS-ASEMAIL_R334 can be captured.
            // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R334
            Site.CaptureRequirementIfIsTrue(
                item.Email.Flag.CompleteTimeSpecified,
                334,
                @"[In CompleteTime] The CompleteTime element is required to mark a flagged item as complete.");
            #endregion
        }
コード例 #21
0
        /// <summary>
        /// Send mail and update email with additional Flag element
        /// </summary>
        /// <param name="additionalFlagElement">Additional flag element</param>
        /// <param name="insertTag">Additional element will insert before this tag</param>
        /// <returns>Status code after update email flag</returns>
        private string FlagEmailWithAddtionalFlagElement(string additionalFlagElement, string insertTag)
        {
            string emailSubject = Common.GenerateResourceName(Site, "subject");

            // Send email to user2
            this.SendPlaintextEmail(emailSubject, null, null);

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

            DateTime startDate = DateTime.Now;
            DateTime dueDate = DateTime.Now.AddDays(20);

            Request.Flag flag = new Request.Flag
            {
                Status = "2",
                FlagType = "for Follow Up",
                Subject = emailSubject,
                StartDate = startDate,
                StartDateSpecified = true,
                UtcStartDate = startDate.ToUniversalTime(),
                UtcStartDateSpecified = true,
                DueDate = dueDate,
                DueDateSpecified = true,
                UtcDueDate = dueDate.ToUniversalTime(),
                UtcDueDateSpecified = true,
                OrdinalDateSpecified = true,
                ReminderSet = 1,
                ReminderSetSpecified = true,
                ReminderTimeSpecified = true
            };

            flag.SubOrdinalDate = flag.OrdinalDate.ToString();
            flag.OrdinalDate = DateTime.Now;
            flag.ReminderTime = DateTime.Now.AddDays(12);

            // Update email with additional elements
            SendStringResponse result = this.UpdateEmailWithMoreData(this.User2Information.InboxCollectionId, syncChangeResult.SyncKey, true, emailItem.ServerId, flag, null, additionalFlagElement, insertTag);

            return TestSuiteHelper.GetStatusCode(result.ResponseDataXML);
        }
コード例 #22
0
        public void MSASEMAIL_S03_TC15_UpdateEmailFlagMetadata()
        {
            #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 email flag.
            Request.Flag flag = new Request.Flag
            {
                Status = "2",
                FlagType = "Flag for follow up",
                StartDate = DateTime.Now,
                StartDateSpecified = true,
                UtcStartDate = DateTime.Now,
                UtcStartDateSpecified = true,
                UtcDueDate = DateTime.Now.AddDays(20),
                UtcDueDateSpecified = true,
                DueDate = DateTime.Now.AddDays(20),
                DueDateSpecified = 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 to indicate sets flag success.");
            #endregion

            #region Call Sync command with Change element to update the email flag.
            Request.Flag newFlag = new Request.Flag { Status = "2", FlagType = "for Follow Up" };

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

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

            #region Verify requirements
            if (Common.IsRequirementEnabled(1021, this.Site))
            {
                // If the update flag operation executes successfully, then requirement MS-ASEMAIL_R1021 can be captured.
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R1021");

                // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R1021
                Site.CaptureRequirement(
                    1021,
                    @"[In Appendix B: Product Behavior] Implementation does update the flag on the e-mail message by using the Change element ([MS-ASCMD] section 2.2.3.24) of the Sync command, for every flag update that the client sends to the server in a Sync command request ([MS-ASCMD] section 2.2.2.19). (Exchange Server 2007 SP1 and above follow this behavior.)");
            }

            // If the FlagType value returned from server is "for Follow Up", that is to say, FlagType has been updated successfully, then MS-ASEMAIL_R90 can be captured.
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R90");

            // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R90
            Site.CaptureRequirementIfAreEqual<string>(
                newFlag.FlagType,
                item.Email.Flag.FlagType,
                90,
                @"[In Updating E-Mail Flags] When Action is Update the flag metadata on an email, Required Properties from Device are: All updated properties.");
            #endregion
        }
コード例 #23
0
        public void MSASEMAIL_S03_TC03_AddFlag_CompleteTimeAndDateCompleted()
        {
            #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 with DateComplete element and CompleteTime element.
            Request.Flag flag = new Request.Flag
            {
                Status = "1",
                FlagType = "for Follow Up",
                CompleteTime = DateTime.Now,
                CompleteTimeSpecified = true,
                DateCompleted = DateTime.Now,
                DateCompletedSpecified = 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);
            #endregion

            #region Verify requirement
            if (Common.IsRequirementEnabled(336, this.Site))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R336");

                // Verify the prerequisite first
                Site.Assert.IsTrue(item.Email.Flag.CompleteTimeSpecified, "If Sync command updates email flag with CompleteTime element successfully, then the Flag.CompleteTimeSpecified field should be true");
                Site.Assert.IsNotNull(item.Email.Flag.CompleteTime, "If Sync command updates email flag with CompleteTime element successfully, then the Flag.CompleteTime field should not be null");

                // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R336
                Site.CaptureRequirementIfIsTrue(
                    item.Email.Flag.DateCompletedSpecified,
                    336,
                    @"[In Appendix B: Product Behavior] If a message includes a value for the CompleteTime element, the message does also include a value for the tasks:DateCompleted element. (Exchange Server 2007 SP1 and above follow this behavior.)");
            }
            #endregion
        }
コード例 #24
0
        /// <summary>
        /// Update email
        /// </summary>
        /// <param name="collectionId">The collectionId of the folder which contains the item to be updated.</param>
        /// <param name="syncKey">The syncKey which is returned from server</param>
        /// <param name="read">The value is TRUE indicates the email has been read; a value of FALSE indicates the email has not been read</param>
        /// <param name="serverId">The server id of the email</param>
        /// <param name="flag">The flag instance</param>
        /// <param name="categories">The array of categories</param>
        /// <returns>Return update email result</returns>
        protected SyncStore UpdateEmail(string collectionId, string syncKey, bool?read, string serverId, Request.Flag flag, Collection <string> categories)
        {
            Request.SyncCollectionChange changeData = new Request.SyncCollectionChange
            {
                ServerId        = serverId,
                ApplicationData = new Request.SyncCollectionChangeApplicationData()
            };

            List <object> items = new List <object>();
            List <Request.ItemsChoiceType7> itemsElementName = new List <Request.ItemsChoiceType7>();

            if (null != read)
            {
                items.Add(read);
                itemsElementName.Add(Request.ItemsChoiceType7.Read);
            }

            if (null != flag)
            {
                items.Add(flag);
                itemsElementName.Add(Request.ItemsChoiceType7.Flag);
            }

            if (null != categories)
            {
                Request.Categories2 mailCategories = new Request.Categories2 {
                    Category = new string[categories.Count]
                };
                categories.CopyTo(mailCategories.Category, 0);
                items.Add(mailCategories);
                itemsElementName.Add(Request.ItemsChoiceType7.Categories2);
            }

            changeData.ApplicationData.Items            = items.ToArray();
            changeData.ApplicationData.ItemsElementName = itemsElementName.ToArray();

            SyncRequest syncRequest = TestSuiteHelper.CreateSyncChangeRequest(syncKey, collectionId, changeData);
            SyncStore   result      = this.EMAILAdapter.Sync(syncRequest);

            Site.Assert.AreEqual <byte>(
                1,
                result.CollectionStatus,
                "The server returns a Status 1 in the Sync command response indicate sync command success.");

            return(result);
        }
コード例 #25
0
        /// <summary>
        /// Verify the operation of clearing email flag.
        /// </summary>
        /// <param name="newFlag">The new flag of the email.</param>
        /// <returns>True indicates the flag is cleared, false indicates the flag is not cleared.</returns>
        private bool VerifyClearEmailFlag(Request.Flag newFlag)
        {
            #region Call SendMail command to send an email.
            string emailSubject = Common.GenerateResourceName(Site, "subject");
            this.SendPlaintextEmail(emailSubject, string.Empty, string.Empty);
            #endregion

            #region Call method Sync to add a flag.
            Request.Flag flag = new Request.Flag
            {
                Status = "2",
                FlagType = "for Follow Up",
                StartDate = DateTime.Now,
                StartDateSpecified = true,
                UtcStartDate = DateTime.Now,
                UtcStartDateSpecified = true,
                DueDate = DateTime.Now.AddDays(20),
                DueDateSpecified = true,
                UtcDueDate = DateTime.Now.AddDays(20),
                UtcDueDateSpecified = 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 to indicate sets flag success.");
            #endregion

            #region Call method Sync to clear the flag added in the above step.
            // 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 Check whether the flag was cleared
            // If server returned an empty Flag node, that is to say, the flag was cleared.
            return item.Email.Flag.Status == null && item.Email.Flag.FlagType == null && !item.Email.Flag.StartDateSpecified && !item.Email.Flag.DueDateSpecified && !item.Email.Flag.UtcStartDateSpecified && !item.Email.Flag.UtcDueDateSpecified;
            #endregion
        }
コード例 #26
0
        /// <summary>
        /// Call Sync command to change the status of the emails in Inbox folder.
        /// </summary>
        /// <param name="syncKey">The latest SyncKey.</param>
        /// <param name="serverIds">The collection of ServerIds.</param>
        /// <param name="collectionId">The folder collectionId which needs to be sychronized.</param>
        /// <param name="read">Read element of the item.</param>
        /// <param name="status">Flag status of the item.</param>
        /// <returns>The SyncStore instance returned from Sync command.</returns>
        protected SyncStore SyncChange(string syncKey, Collection <string> serverIds, string collectionId, bool?read, string status)
        {
            List <Request.SyncCollectionChange> changes = new List <Request.SyncCollectionChange>();

            foreach (string serverId in serverIds)
            {
                Request.SyncCollectionChange change = new Request.SyncCollectionChange
                {
                    ServerId        = serverId,
                    ApplicationData = new Request.SyncCollectionChangeApplicationData()
                };

                List <object> changeItems = new List <object>();
                List <Request.ItemsChoiceType7> changeItemsElementName = new List <Request.ItemsChoiceType7>();

                if (read != null)
                {
                    changeItems.Add(read);
                    changeItemsElementName.Add(Request.ItemsChoiceType7.Read);
                }

                if (!string.IsNullOrEmpty(status))
                {
                    Request.Flag flag = new Request.Flag();
                    if (status == "1")
                    {
                        // The Complete Time format is yyyy-MM-ddThh:mm:ss.fffZ.
                        flag.CompleteTime           = System.DateTime.Now.ToUniversalTime();
                        flag.CompleteTimeSpecified  = true;
                        flag.DateCompleted          = System.DateTime.Now.ToUniversalTime();
                        flag.DateCompletedSpecified = true;
                    }

                    flag.Status   = status;
                    flag.FlagType = "Flag for follow up";

                    changeItems.Add(flag);
                    changeItemsElementName.Add(Request.ItemsChoiceType7.Flag);
                }

                change.ApplicationData.Items            = changeItems.ToArray();
                change.ApplicationData.ItemsElementName = changeItemsElementName.ToArray();

                changes.Add(change);
            }

            Request.SyncCollection collection = new Request.SyncCollection
            {
                CollectionId = collectionId,
                SyncKey      = syncKey,
                Commands     = changes.ToArray()
            };

            SyncRequest syncRequest = Common.CreateSyncRequest(new Request.SyncCollection[] { collection });
            SyncStore   syncStore   = this.CONAdapter.Sync(syncRequest);

            // Verify Sync command response.
            Site.Assert.AreEqual <byte>(
                1,
                syncStore.CollectionStatus,
                "If the Sync command executes successfully, the Status in response should be 1.");

            this.LatestSyncKey = syncStore.SyncKey;

            return(syncStore);
        }
コード例 #27
0
        public void MSASEMAIL_S01_TC03_SyncChange_NotChangeCategories()
        {
            Site.Assume.AreNotEqual<string>("12.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The Categories element is not supported when the ActiveSyncProtocolVersion is 12.1.");

            #region Call method SendMail 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 and category for the e-mail item and synchronize it with server.
            // Get the email item
            SyncStore getEmailItem = this.GetSyncResult(emailSubject, this.User2Information.InboxCollectionId, null);
            Sync item = TestSuiteHelper.GetSyncAddItem(getEmailItem, emailSubject);

            // Get the result of adding flag and categories
            SyncStore getChangedResult = this.AddFlagAndCategories(this.User2Information.InboxCollectionId, getEmailItem.SyncKey, item.ServerId);
            item = TestSuiteHelper.GetSyncChangeItem(getChangedResult, item.ServerId);
            Site.Assert.IsNotNull(item, "The email item with subject '{0}' should be found.", emailSubject);
            #endregion

            #region Call Sync command with Change element to update the flag of the e-mail item and synchronize it with server.
            // Update the FlagType to "Flag for follow up"
            Request.Flag newFlag = new Request.Flag
            {
                Status = "2",
                FlagType = "Flag for follow up",
                CompleteTime = DateTime.Now,
                CompleteTimeSpecified = true,
                DateCompleted = DateTime.Now,
                DateCompletedSpecified = true
            };

            // Update email flag on server
            this.UpdateEmail(this.User2Information.InboxCollectionId, getChangedResult.SyncKey, true, item.ServerId, newFlag, null);

            // Synchronize the update result with server
            SyncStore updateResult = this.SyncChanges(getChangedResult.SyncKey, this.User2Information.InboxCollectionId, null);
            item = TestSuiteHelper.GetSyncChangeItem(updateResult, item.ServerId);
            Site.Assert.IsNotNull(item, "The email item with subject '{0}' should be found.", emailSubject);
            #endregion

            #region Verify requirement.
            // If the server responds with a Sync command response and the Sync change command that does not contain a Categories element, then R320 can be captured.
            if (!Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("12.1"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R320");

                // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R320
                Site.CaptureRequirementIfIsFalse(
                        item.Email.CategoriesIsInclude,
                        320,
                        @"[In Categories] A Sync command that contains a Change element that does not contain a Categories element indicates that the categories on the message have not changed.");
            }
            #endregion
        }