A static class contains all helper methods used in test cases.
Пример #1
0
        public void MSASCNTC_S02_TC03_ItemOperations_SchemaViewFetch()
        {
            #region Call Sync command with Add element to add a contact to the server
            Dictionary <Request.ItemsChoiceType8, object> contactProperties = this.SetContactProperties(null);
            this.AddContact(this.User1Information.ContactsCollectionId, contactProperties);

            this.RecordCaseRelativeItems(this.User1Information.UserName, this.User1Information.ContactsCollectionId, contactProperties[Request.ItemsChoiceType8.FileAs].ToString());

            // Get the new added contact
            Sync newAddedItem = this.GetSyncAddResult(contactProperties[Request.ItemsChoiceType8.FileAs].ToString(), this.User1Information.ContactsCollectionId, null, null);
            #endregion

            #region Call ItemOperations command with Schema element to retrieve the contact item added in previous step
            // Just including FileAs element in Schema
            Request.Schema schema = new Request.Schema
            {
                Items            = new object[] { string.Empty },
                ItemsElementName = new Request.ItemsChoiceType4[] { Request.ItemsChoiceType4.FileAs }
            };

            this.GetItemOperationsResult(this.User1Information.ContactsCollectionId, newAddedItem.ServerId, null, schema);
            #endregion

            #region Verify requirement
            // If only FilsAs element is returned in server response, then capture MS-ASCNTC_R485.
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R485.");

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R485
            Site.CaptureRequirementIfIsTrue(
                TestSuiteHelper.IsOnlySpecifiedElementExist((XmlElement)this.ASCNTCAdapter.LastRawResponseXml, "Properties", "FileAs"),
                485,
                @"[In ItemOperations Command Response] If an ItemOperations:Schema element ([MS-ASCMD] section 2.2.3.145) is included in the ItemOperations command request, the elements returned in the ItemOperations command response MUST be restricted to the elements that were included as child elements of the itemoperations:Schema element in the command request.");
            #endregion
        }
        /// <summary>
        /// Create a Sync Add request.
        /// </summary>
        /// <param name="syncKey">Specify the sync key obtained from the last Sync response</param>
        /// <param name="collectionId">Specify the serverId of the folder to be synchronized.</param>
        /// <param name="applicationData">The data used to specify the Add element for Sync command.</param>
        /// <returns>The SyncRequest instance.</returns>
        internal static SyncRequest CreateSyncAddRequest(string syncKey, string collectionId, Request.SyncCollectionAddApplicationData applicationData)
        {
            SyncRequest syncAddRequest = TestSuiteHelper.CreateSyncRequest(syncKey, collectionId, null);

            Request.SyncCollectionAdd add = new Request.SyncCollectionAdd
            {
                ClientId        = Guid.NewGuid().ToString("N"),
                ApplicationData = applicationData
            };

            List <object> commandList = new List <object> {
                add
            };

            syncAddRequest.RequestData.Collections[0].Commands = commandList.ToArray();

            return(syncAddRequest);
        }