コード例 #1
0
        public void UpdateTest()
        {
            string            path     = Constants.AF_ELEMENT_TEMPLATE_PATH;
            PIElementTemplate template = instance.GetByPath(path, null);

            template.Id          = null;
            template.Description = "New attribute category description";
            template.Links       = null;
            template.Path        = null;
            template.WebId       = null;
            instance.Update(webId, template);

            AFElementTemplate myTemplate = AFObject.FindObject(path) as AFElementTemplate;

            myTemplate.Refresh();
            if (myTemplate != null)
            {
                Assert.IsTrue(myTemplate.Description == template.Description);
            }
        }
コード例 #2
0
        public void CreateAttributeTemplateTest()
        {
            PIAttributeTemplate attributeTemplate = new PIAttributeTemplate()
            {
                Name                = "TableAttributeTemplate",
                Description         = "2008 Water Use",
                Type                = "Int32",
                TypeQualifier       = "",
                DefaultValue        = 0,
                DataReferencePlugIn = "Table Lookup",
                ConfigString        = "SELECT [Water Use] FROM [Energy Use 2008] WHERE [Asset ID] = '%Element%'",
                IsConfigurationItem = false,
                IsExcluded          = false,
                IsHidden            = false,
                IsManualDataEntry   = false,
            };
            string path = Constants.AF_ELEMENT_TEMPLATE_PATH;

            instance.CreateAttributeTemplate(webId, attributeTemplate);
            AFElementTemplate myTemplate = AFObject.FindObject(path) as AFElementTemplate;

            myTemplate.Refresh();
            Assert.IsNotNull(myTemplate.AttributeTemplates[attributeTemplate.Name]);
        }