コード例 #1
0
        public void CreateSearchByAttributeTest()
        {
            string templateWebId = client.ElementTemplate.GetByPath(Constants.AF_ELEMENT_TEMPLATE_PATH).WebId;
            List <PIAttributeValueQuery> valueQueries = new List <PIAttributeValueQuery>();

            valueQueries.Add(new PIAttributeValueQuery(Constants.AF_ATTRIBUTE_TEMPLATE_NAME, 1000, null, "LessThan"));
            PISearchByAttributeElement search = new PISearchByAttributeElement()
            {
                SearchRoot      = null,
                ElementTemplate = templateWebId,
                ValueQueries    = valueQueries
            };

            var    response = instance.CreateSearchByAttributeWithHttpInfo(search);
            string location = response.Headers.Where(h => h.Key == "Location").First().Value;

            Assert.IsTrue(location.Substring(0, 5) == "https");
            Assert.IsInstanceOf <ApiResponse <Object> >(response, "response is Object");
        }
コード例 #2
0
        public void ExecuteSearchByAttributeTest()
        {
            string templateWebId = client.ElementTemplate.GetByPath(Constants.AF_ELEMENT_TEMPLATE_PATH).WebId;
            List <PIAttributeValueQuery> valueQueries = new List <PIAttributeValueQuery>();

            valueQueries.Add(new PIAttributeValueQuery(Constants.AF_ATTRIBUTE_TEMPLATE_NAME, 1000, null, "LessThan"));
            PISearchByAttributeElement search = new PISearchByAttributeElement()
            {
                SearchRoot      = null,
                ElementTemplate = templateWebId,
                ValueQueries    = valueQueries
            };

            var    response2 = instance.CreateSearchByAttributeWithHttpInfo(search);
            string location  = response2.Headers.Where(h => h.Key == "Location").First().Value;



            // TODO uncomment below to test the method and replace null with proper value
            string searchId            = location.Substring(client.BaseUrl.Length + 28);
            string nameFilter          = null;
            string descriptionFilter   = null;
            string categoryName        = null;
            bool?  searchFullHierarchy = null;
            string sortField           = null;
            string sortOrder           = null;
            int?   startIndex          = null;
            int?   maxCount            = null;
            string selectedFields      = null;
            var    response            = instance.ExecuteSearchByAttribute(searchId,
                                                                           nameFilter: nameFilter,
                                                                           descriptionFilter: descriptionFilter,
                                                                           categoryName: categoryName,
                                                                           searchFullHierarchy: searchFullHierarchy,
                                                                           sortField: sortField,
                                                                           sortOrder: sortOrder,
                                                                           startIndex: startIndex,
                                                                           maxCount: maxCount,
                                                                           selectedFields: selectedFields);

            Assert.IsInstanceOf <Object>(response, "response is Object");
        }
 public ApiResponsePISearchByAttributeElement(int statusCode, IDictionary <string, string> headers, PISearchByAttributeElement data)
     : base(statusCode, headers)
 {
     this.Data = data;
 }