Example #1
0
        public void ExecuteSearchByAttributeTest()
        {
            string templateWebId             = client.ElementTemplate.GetByPath(Constants.AF_EVENT_FRAME_TEMPLATE_PATH).WebId;
            List <PIValueQuery> valueQueries = new List <PIValueQuery>();

            valueQueries.Add(new PIValueQuery("Level", null, 1000, "LessThan"));
            PISearchByAttribute search = new PISearchByAttribute()
            {
                SearchRoot      = null,
                ElementTemplate = templateWebId,
                ValueQueries    = valueQueries
            };

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



            string searchId   = location.Substring(client.BaseUrl.Length + 31);
            string searchMode = null;
            string startTime  = null;
            string endTime    = null;
            string nameFilter = null;
            string referencedElementNameFilter = null;
            bool?  searchFullHierarchy         = null;
            string sortField      = null;
            string sortOrder      = null;
            int?   startIndex     = null;
            int?   maxCount       = null;
            string selectedFields = null;
            var    response       = instance.ExecuteSearchByAttribute(
                searchId: searchId,
                searchMode: searchMode,
                startTime: startTime,
                endTime: endTime,
                nameFilter: nameFilter,
                referencedElementNameFilter: referencedElementNameFilter,
                searchFullHierarchy: searchFullHierarchy,
                sortField: sortField,
                sortOrder: sortOrder,
                startIndex: startIndex,
                maxCount: maxCount,
                selectedFields: selectedFields);

            Assert.IsInstanceOf <Object>(response, "response is Object");
        }
        public void CreateSearchByAttributeTest()
        {
            string templateWebId             = client.ElementTemplate.GetByPath(Constants.AF_ELEMENT_TEMPLATE_PATH).WebId;
            List <PIValueQuery> valueQueries = new List <PIValueQuery>();

            valueQueries.Add(new PIValueQuery(Constants.AF_ATTRIBUTE_TEMPLATE_NAME, null, 1000, "LessThan"));
            PISearchByAttribute search = new PISearchByAttribute()
            {
                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 <PIItemsElement> >(response, "response is Object");
        }
        public void ExecuteSearchByAttributeTest()
        {
            string templateWebId             = client.ElementTemplate.GetByPath(Constants.AF_ELEMENT_TEMPLATE_PATH).WebId;
            List <PIValueQuery> valueQueries = new List <PIValueQuery>();

            valueQueries.Add(new PIValueQuery(Constants.AF_ATTRIBUTE_TEMPLATE_NAME, null, 1000, "LessThan"));
            PISearchByAttribute search = new PISearchByAttribute()
            {
                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 ApiResponsePISearchByAttribute(int statusCode, IDictionary <string, string> headers, PISearchByAttribute data)
     : base(statusCode, headers)
 {
     this.Data = data;
 }