Exemplo n.º 1
0
 /// <summary>
 ///  Creates a Sync request using the specified SyncCollection array
 /// </summary>
 /// <param name="syncCollections">Specified SyncCollection array</param>
 /// <returns>A SyncRequest instance</returns>
 public static SyncRequest CreateSyncRequest(Request.SyncCollection[] syncCollections)
 {
     SyncRequest requestTemp = new SyncRequest();
     Request.Sync requestData = new Request.Sync();
     requestTemp.RequestData = requestData;
     requestTemp.RequestData.Collections = syncCollections;
     return requestTemp;
 }
Exemplo n.º 2
0
        public void MSASCMD_S19_TC52_Sync_Status8()
        {
            #region Send a MIME-formatted email to User2.
            string emailSubject = Common.GenerateResourceName(Site, "subject");
            this.SendPlainTextEmail(null, emailSubject, this.User1Information.UserName, this.User2Information.UserName, null);
            #endregion

            this.SwitchUser(this.User2Information);
            TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, emailSubject);
            SyncResponse syncResponse = this.CheckEmail(this.User2Information.InboxCollectionId, emailSubject, null);
            string itemServerId = TestSuiteBase.FindServerId(syncResponse, "Subject", emailSubject);

            #region Delete the email form Inbox of User2.
            SyncRequest syncRequest = TestSuiteBase.CreateSyncDeleteRequest(this.LastSyncKey, this.User2Information.InboxCollectionId, itemServerId);
            syncRequest.RequestData.Collections[0].DeletesAsMoves = false;
            syncRequest.RequestData.Collections[0].DeletesAsMovesSpecified = true;
            syncResponse = this.Sync(syncRequest);
            #endregion

            #region Fetch the email.
            Request.SyncCollectionFetch appDataFetch = new Request.SyncCollectionFetch
            {
                ServerId = itemServerId
            };

            Request.SyncCollection collection = new Request.SyncCollection
            {
                SyncKey = this.LastSyncKey,
                GetChanges = true,
                GetChangesSpecified = true,
                CollectionId = this.User2Information.InboxCollectionId,
                Commands = new object[] { appDataFetch }
            };

            Request.Sync syncRequestData = new Request.Sync { Collections = new Request.SyncCollection[] { collection } };

            SyncRequest syncRequestForFetch = new SyncRequest { RequestData = syncRequestData };
            syncResponse = this.Sync(syncRequestForFetch);
            Response.SyncCollectionsCollectionResponses collectionResponse = TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Responses) as Response.SyncCollectionsCollectionResponses;

            this.Site.CaptureRequirementIfAreEqual<int>(
                8,
                int.Parse(collectionResponse.Fetch.Status),
                4447,
                @"[In Status(Sync)] [When the scope is Item], [the cause of the status value 8 is] The client issued a fetch [or change] operation that has a CollectionId (section 2.2.3.30.5) value that is no longer valid on the server (for example, the item was deleted).");

            #endregion
        }
Exemplo n.º 3
0
        public void MSASCMD_S19_TC41_Sync_MoreThanOneConflicts()
        {
            Request.Options option = new Request.Options
            {
                Items = new object[] { (byte)1, (byte)1 },
                ItemsElementName =
                    new Request.ItemsChoiceType1[] { Request.ItemsChoiceType1.Conflict, Request.ItemsChoiceType1.Conflict }
            };

            Request.SyncCollection collection = new Request.SyncCollection
            {
                Options = new Request.Options[] { option },
                SyncKey = "0",
                CollectionId = this.User1Information.ContactsCollectionId
            };

            Request.Sync syncRequestData = new Request.Sync { Collections = new Request.SyncCollection[] { collection } };

            SyncRequest syncRequest = new SyncRequest { RequestData = syncRequestData };
            SyncResponse syncResponse = this.Sync(syncRequest);

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

                // Verify MS-ASCMD requirement: MS-ASCMD_R2075
                Site.CaptureRequirementIfAreEqual<uint>(
                    1,
                    Convert.ToUInt32(TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Status)),
                    2075,
                    @"[In Appendix A: Product Behavior] The implementation does not return a protocol status error in response to such a command request [more than one Conflict element as the child of an Options element]. (Exchange 2007 and above follow this behavior.)");
            }
        }
Exemplo n.º 4
0
        public void MSASCMD_S19_TC36_Sync_Fetch()
        {
            #region Send a MIME-formatted email to User2.
            string emailSubject = Common.GenerateResourceName(Site, "subject");
            this.SendPlainTextEmail(null, emailSubject, this.User1Information.UserName, this.User2Information.UserName, null);
            #endregion

            this.SwitchUser(this.User2Information);
            TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, emailSubject);
            SyncResponse syncResponse = this.CheckEmail(this.User2Information.InboxCollectionId, emailSubject, null);

            #region Fetch the email.
            Request.SyncCollectionFetch appDataFetch = new Request.SyncCollectionFetch
            {
                ServerId = TestSuiteBase.FindServerId(syncResponse, "Subject", emailSubject)
            };

            Request.SyncCollection collection = new Request.SyncCollection
            {
                SyncKey = this.LastSyncKey,
                GetChanges = true,
                GetChangesSpecified = true,
                CollectionId = this.User2Information.InboxCollectionId,
                Commands = new object[] { appDataFetch }
            };

            Request.Sync syncRequestData = new Request.Sync { Collections = new Request.SyncCollection[] { collection } };

            SyncRequest syncRequestForFetch = new SyncRequest { RequestData = syncRequestData };
            syncResponse = this.Sync(syncRequestForFetch);
            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_R5433");

            // Verify MS-ASCMD requirement: MS-ASCMD_R5433
            Site.CaptureRequirementIfIsNotNull(
                collectionResponse.Fetch,
                5433,
                @"[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.)");
            #endregion
        }
Exemplo n.º 5
0
        public void MSASCMD_S19_TC35_Sync_DeletesAsMovesIsFalse()
        {
            #region Send a MIME-formatted email to User2.
            string emailSubject = Common.GenerateResourceName(Site, "subject");
            this.SendPlainTextEmail(null, emailSubject, this.User1Information.UserName, this.User2Information.UserName, null);
            #endregion

            this.SwitchUser(this.User2Information);
            TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, emailSubject);

            SyncResponse syncResponse = this.SyncChanges(this.User2Information.DeletedItemsCollectionId);
            Site.Assert.IsNull(TestSuiteBase.FindServerId(syncResponse, "Subject", emailSubject), "The email should not be found in the DeletedItems folder.");

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

            string serverId = TestSuiteBase.FindServerId(syncResponse, "Subject", emailSubject);
            Site.Assert.IsTrue(!string.IsNullOrEmpty(serverId), "The email should be found in the Inbox folder.");

            #region Delete the added email item.
            Request.SyncCollectionDelete appDataDelete = new Request.SyncCollectionDelete { ServerId = serverId };

            Request.SyncCollection collection = new Request.SyncCollection
            {
                SyncKey = this.LastSyncKey,
                GetChanges = true,
                CollectionId = this.User2Information.InboxCollectionId,
                Commands = new object[] { appDataDelete },
                DeletesAsMoves = false,
                DeletesAsMovesSpecified = true
            };

            Request.Sync syncRequestData = new Request.Sync { Collections = new Request.SyncCollection[] { collection } };

            SyncRequest syncRequestDelete = new SyncRequest { RequestData = syncRequestData };
            this.Sync(syncRequestDelete);
            #endregion

            #region Verify if the email has been deleted from the Inbox folder and not placed into the DeletedItems folder.
            syncResponse = this.SyncChanges(this.User2Information.InboxCollectionId);
            Site.Assert.IsNull(TestSuiteBase.FindServerId(syncResponse, "Subject", emailSubject), "The email deleted should not be found in the Inbox folder.");
            TestSuiteBase.RemoveRecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, emailSubject);

            syncResponse = this.SyncChanges(this.User2Information.DeletedItemsCollectionId);
            Site.Assert.IsNull(TestSuiteBase.FindServerId(syncResponse, "Subject", emailSubject), "The email deleted should not be found in the DeletedItems folder.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R2158
            // If the deleted email can not be found in both Inbox and Deleted Items folder, this requirement can be captured directly.
            Site.CaptureRequirement(
                2158,
                @"[In DeletesAsMoves] If the DeletesAsMoves element is set to false, the deletion is permanent.");
            #endregion
        }
Exemplo n.º 6
0
        public void MSASCMD_S19_TC34_Sync_DeletesAsMovesIsTrue()
        {
            #region Send a MIME-formatted email to User2.
            string emailSubject1 = Common.GenerateResourceName(Site, "subject");
            this.SendPlainTextEmail(null, emailSubject1, this.User1Information.UserName, this.User2Information.UserName, null);
            #endregion

            this.SwitchUser(this.User2Information);
            TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, emailSubject1);

            // Check DeletedItems folder
            SyncRequest syncRequest = TestSuiteBase.CreateEmptySyncRequest(this.User2Information.DeletedItemsCollectionId);
            this.Sync(syncRequest);
            syncRequest.RequestData.Collections[0].SyncKey = this.LastSyncKey;
            SyncResponse syncResponse = this.Sync(syncRequest);
            Site.Assert.IsNull(TestSuiteBase.FindServerId(syncResponse, "Subject", emailSubject1), "The email should not be found in the DeletedItems folder.");

            // Check Inbox folder
            syncResponse = this.CheckEmail(this.User2Information.InboxCollectionId, emailSubject1, null);
            string serverId = TestSuiteBase.FindServerId(syncResponse, "Subject", emailSubject1);
            Site.Assert.IsNotNull(serverId, "The email should be found in the inbox folder.");

            #region Delete the email with DeletesAsMoves set to true from the Inbox folder.
            Request.SyncCollection collection = new Request.SyncCollection
            {
                SyncKey = this.LastSyncKey,
                CollectionId = this.User2Information.InboxCollectionId,
                Commands = new object[] { new Request.SyncCollectionDelete { ServerId = serverId } },
                DeletesAsMoves = true,
                DeletesAsMovesSpecified = true
            };

            Request.Sync syncRequestData = new Request.Sync { Collections = new Request.SyncCollection[] { collection } };

            SyncRequest syncRequestDelete = new SyncRequest { RequestData = syncRequestData };
            syncResponse = this.Sync(syncRequestDelete);
            Site.Assert.AreEqual<uint>(1, Convert.ToUInt32(TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Status)), "The Sync delete operation should be successful.");
            #endregion

            #region Verify if the email has been deleted from the Inbox folder and placed into the DeletedItems folder.
            // Check Inbox folder.
            syncResponse = this.SyncChanges(this.User2Information.InboxCollectionId, false);
            Site.Assert.IsNull(TestSuiteBase.FindServerId(syncResponse, "Subject", emailSubject1), "The email deleted should not be found in the Inbox folder.");
            TestSuiteBase.RemoveRecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, emailSubject1);

            // Check DeletedItems folder
            this.CheckEmail(this.User2Information.DeletedItemsCollectionId, emailSubject1, null);
            TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.DeletedItemsCollectionId, emailSubject1);

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R2160
            // When the Assert statements above are passed, it means the deleted email is moved from the inbox folder to Deleted Items folder, then this requirement can be  captured directly.
            Site.CaptureRequirement(
                2160,
                @"[In DeletesAsMoves] A value of 1 (TRUE), which is the default, indicates that any deleted items are moved to the Deleted Items folder.");
            #endregion

            #region Send a MIME-formatted email to User2.
            this.SwitchUser(this.User1Information);
            string emailSubject2 = Common.GenerateResourceName(Site, "subject");
            this.SendPlainTextEmail(null, emailSubject2, this.User1Information.UserName, this.User2Information.UserName, null);
            #endregion

            this.SwitchUser(this.User2Information);
            TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, emailSubject1);

            // Check DeletedItems folder
            syncResponse = this.SyncChanges(this.User2Information.DeletedItemsCollectionId);
            Site.Assert.IsNull(TestSuiteBase.FindServerId(syncResponse, "Subject", emailSubject2), "The email should not be found in the DeletedItems folder.");

            // Check Inbox folder
            syncResponse = this.CheckEmail(this.User2Information.InboxCollectionId, emailSubject2, null);
            serverId = TestSuiteBase.FindServerId(syncResponse, "Subject", emailSubject2);
            Site.Assert.IsNotNull(serverId, "The email should be found in the inbox folder.");

            #region Delete the email and DeletesAsMoves is not present in the request
            collection = new Request.SyncCollection
            {
                SyncKey = this.LastSyncKey,
                CollectionId = this.User2Information.InboxCollectionId,
                Commands = new object[] { new Request.SyncCollectionDelete { ServerId = serverId } }
            };

            syncRequestData = new Request.Sync { Collections = new Request.SyncCollection[] { collection } };

            syncRequestDelete = new SyncRequest { RequestData = syncRequestData };
            syncResponse = this.Sync(syncRequestDelete);
            Site.Assert.AreEqual<uint>(1, Convert.ToUInt32(TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Status)), "The Sync delete operation should be successful.");

            TestSuiteBase.RemoveRecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, emailSubject1);
            #endregion

            #region Verify if the second email has been deleted from the Inbox folder and placed into the DeletedItems folder.
            // Check Inbox folder
            syncResponse = this.SyncChanges(this.User2Information.InboxCollectionId);
            Site.Assert.IsNull(TestSuiteBase.FindServerId(syncResponse, "Subject", emailSubject2), "The deleted email should not be found in the Inbox folder.");

            // Check DeletedItems folder
            syncResponse = this.SyncChanges(this.User2Information.DeletedItemsCollectionId);
            Site.Assert.IsNotNull(TestSuiteBase.FindServerId(syncResponse, "Subject", emailSubject2), "The deleted email should be found in the DeletedItems folder.");

            TestSuiteBase.RemoveRecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, emailSubject1);
            TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.DeletedItemsCollectionId, emailSubject1, emailSubject2);

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R5874
            // When the Assert statements above are passed, it means the deleted email is moved from the inbox folder to Deleted Items folder, then this requirement can be  captured directly.
            Site.CaptureRequirement(
                5874,
                @"[In DeletesAsMoves] If element DeleteAsMoves is empty, the delete items are moved to the Deleted Items folder.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R5875
            // When the Assert statements above are passed, it means the deleted email is moved from the inbox folder to Deleted Items folder, then this requirement can be  captured directly.
            Site.CaptureRequirement(
                5875,
                @"[In DeletesAsMoves] If element DeleteAsMoves is not present, the delete items are moved to the Deleted Items folder.");
            #endregion
        }