/// <summary>
        /// Get the id of a specified list.
        /// </summary>
        /// <param name="listName">The specified list name.</param>
        /// <returns>The string value indicates the id of the specified list.</returns>
        public string GetListID(string listName)
        {
            GetListResponseGetListResult listXml = this.listsService.GetList(listName);

            if (listXml.List.ID != null)
            {
                return(listXml.List.ID);
            }
            else
            {
                return(string.Empty);
            }
        }
예제 #2
0
        /// <summary>
        /// The GetList operation is used to retrieve properties and fields for a specified list.
        /// </summary>
        /// <param name="listName">The name of the list from which information will be got</param>
        /// <returns>A return value represents the list definition.</returns>
        public GetListResponseGetListResult GetList(string listName)
        {
            if (null == this.listsProxy)
            {
                throw new InvalidOperationException("The Proxy instance is NULL, need to initialize the adapter");
            }

            GetListResponseGetListResult result = null;

            result = this.listsProxy.GetList(listName);
            this.VerifyTransportRequirement();
            this.VerifyCommonSchemaOfListDefinition(result);

            return(result);
        }
예제 #3
0
        /// <summary>
        /// A method used to get a field definition from response of GetList operation which is described in [MS-LISTSWS] by specified field name.
        /// </summary>
        /// <param name="getListResponse">A parameter represents the response instance of GetList operation which includes fields definition.</param>
        /// <param name="expectedFieldName">A parameter represents the field name which is expected.</param>
        /// <param name="currentTestSite">An instance of interface ITestSite which provides logging, assertions, and adapters for test code onto its execution context.</param>
        /// <returns>A return value represents the field definition which name is equal to specified field name.</returns>
        public static FieldDefinition GetFieldItemByName(GetListResponseGetListResult getListResponse, string expectedFieldName, ITestSite currentTestSite)
        {
            if (null == getListResponse)
            {
                throw new ArgumentNullException("getListResponse");
            }

            if (string.IsNullOrEmpty(expectedFieldName))
            {
                throw new ArgumentNullException("expectedFieldName");
            }

            if (null == getListResponse.List || null == getListResponse.List.Fields || null == getListResponse.List.Fields.Field ||
                0 == getListResponse.List.Fields.Field.Length)
            {
                currentTestSite.Assert.Fail("The response of GetList operation should contain the fields data of a list.");
            }

            var expectedField = from FieldDefinition fieldItem in getListResponse.List.Fields.Field
                                where fieldItem.Name.Equals(expectedFieldName, StringComparison.OrdinalIgnoreCase)
                                select fieldItem;

            int             matchFieldCount = expectedField.Count();
            FieldDefinition fiedDefinition  = null;

            if (0 == matchFieldCount)
            {
                currentTestSite.Assert.Fail("The response of GetList operation should contain expected field definition[{0}].", expectedFieldName);
            }
            else if (matchFieldCount > 1)
            {
                currentTestSite.Assert.Fail("The response of GetList operation contain fields which have duplicate name[{0}].", expectedFieldName);
            }
            else
            {
                fiedDefinition = expectedField.ElementAt(0);
            }

            return(fiedDefinition);
        }
예제 #4
0
        /// <summary>
        /// A method used to verify field's id or field's type is equal to expected value.
        /// </summary>
        /// <param name="responseOfGetList">A parameter represents the response of GetList operation which contains the field definitions.</param>
        /// <param name="expectedFieldName">A parameter represents the name of a field definition which is used to get the definition from the  response of GetList operation.</param>
        /// <param name="expectedFieldId">A parameter represents the expected id of field definition.</param>
        /// <param name="expectedFieldType">A parameter represents the expected type of field definition.</param>
        /// <returns>Return true indicating the verification pass.</returns>
        private bool VerifyTypeAndIdForFieldDefinition(GetListResponseGetListResult responseOfGetList, string expectedFieldName, string expectedFieldId, string expectedFieldType)
        {
            if (string.IsNullOrEmpty(expectedFieldName))
            {
                throw new ArgumentNullException("expectedFieldName");
            }

            // Get the field definition from response.
            FieldDefinition fieldDefinition = Common.GetFieldItemByName(responseOfGetList, expectedFieldName, this.Site);

            // Verify field type.
            this.Site.Assert.IsTrue(
                Common.VerifyFieldType(fieldDefinition, expectedFieldType, this.Site),
                @"The field definition's type should match the specified value in protocol.");

            // Verify field id.
            this.Site.Assert.IsTrue(
                Common.VerifyFieldId(fieldDefinition, expectedFieldId, this.Site),
                @"The field definition's id should match the specified value in protocol.");

            // If upon verifications pass, return true.
            return(true);
        }
예제 #5
0
        /// <summary>
        /// A method used to verify the requirements for common schema definition of list.
        /// </summary>
        /// <param name="responseOfGetList">A parameter represents the response of GetList operation which contain common fields' definitions.</param>
        private void VerifyCommonSchemaOfListDefinition(GetListResponseGetListResult responseOfGetList)
        {
            if (null == responseOfGetList)
            {
                throw new ArgumentNullException("responseOfGetList");
            }

            // Verify Attachments field's id and type.
            string actuallistTemplateValue           = responseOfGetList.List.ServerTemplate;
            string docLibraryListTemplateStringValue = ((int)TemplateType.Document_Library).ToString();

            if (!docLibraryListTemplateStringValue.Equals(actuallistTemplateValue, StringComparison.OrdinalIgnoreCase))
            {
                bool isVerifyR584 = this.VerifyTypeAndIdForFieldDefinition(
                    responseOfGetList,
                    "Attachments",
                    "{67df98f4-9dec-48ff-a553-29bece9c5bf4}",
                    "Attachments");

                // Verify MS-OUTSPS requirement: MS-OUTSPS_R584
                this.Site.CaptureRequirementIfIsTrue(
                    isVerifyR584,
                    584,
                    @"[In Common Schema][One of the common properties appears as the attributes of the element GetListResponse.GetListResult.List.Fields.Field. Field.Name:]Attachments[ Field.ID:]{67df98f4-9dec-48ff-a553-29bece9c5bf4}[Field.Type:]Attachments.");
            }

            // Verify ContentTypeId field's id and type.
            bool isVerifyR586 = this.VerifyTypeAndIdForFieldDefinition(
                responseOfGetList,
                "ContentTypeId",
                "{03e45e84-1992-4d42-9116-26f756012634}",
                "ContentTypeId");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R586
            this.Site.CaptureRequirementIfIsTrue(
                isVerifyR586,
                586,
                @"[In Common Schema][One of the common properties appears as the attributes of the element GetListResponse.GetListResult.List.Fields.Field. Field.Name:]ContentTypeId[ Field.ID:]{03e45e84-1992-4d42-9116-26f756012634}[Field.Type:]ContentTypeId.");

            // Verify Created field's id and type.
            bool isVerifyR587 = this.VerifyTypeAndIdForFieldDefinition(
                responseOfGetList,
                "Created",
                "{8c06beca-0777-48f7-91c7-6da68bc07b69}",
                "DateTime");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R587
            this.Site.CaptureRequirementIfIsTrue(
                isVerifyR587,
                587,
                @"[In Common Schema][One of the common properties appears as the attributes of the element GetListResponse.GetListResult.List.Fields.Field. Field.Name:]Created[ Field.ID:]{8c06beca-0777-48f7-91c7-6da68bc07b69}[Field.Type:]DateTime.");

            // Verify ID field's id and type.
            bool isVerifyR588 = this.VerifyTypeAndIdForFieldDefinition(
                responseOfGetList,
                "ID",
                "{1d22ea11-1e32-424e-89ab-9fedbadb6ce1}",
                "Counter");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R588
            this.Site.CaptureRequirementIfIsTrue(
                isVerifyR588,
                588,
                @"[In Common Schema][One of the common properties appears as the attributes of the element GetListResponse.GetListResult.List.Fields.Field. Field.Name:]ID[ Field.ID:]{1d22ea11-1e32-424e-89ab-9fedbadb6ce1}[Field.Type:]Counter.");

            // Verify Modified field's id and type.
            bool isVerifyR589 = this.VerifyTypeAndIdForFieldDefinition(
                responseOfGetList,
                "Modified",
                "{28cf69c5-fa48-462a-b5cd-27b6f9d2bd5f}",
                "DateTime");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R589
            this.Site.CaptureRequirementIfIsTrue(
                isVerifyR589,
                589,
                @"[In Common Schema][One of the common properties appears as the attributes of the element GetListResponse.GetListResult.List.Fields.Field. Field.Name:]Modified[ Field.ID:]{28cf69c5-fa48-462a-b5cd-27b6f9d2bd5f}[Field.Type:]DateTime.");

            // Verify owshiddenversion field's id and type.
            bool isVerifyR590 = this.VerifyTypeAndIdForFieldDefinition(
                responseOfGetList,
                "owshiddenversion",
                "{d4e44a66-ee3a-4d02-88c9-4ec5ff3f4cd5}",
                "Integer");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R590
            this.Site.CaptureRequirementIfIsTrue(
                isVerifyR590,
                590,
                @"[In Common Schema][One of the common properties appears as the attributes of the element GetListResponse.GetListResult.List.Fields.Field. Field.Name:]owshiddenversion[ Field.ID:]{d4e44a66-ee3a-4d02-88c9-4ec5ff3f4cd5}[Field.Type:]Integer.");
        }