public void UpdateAnnotationTest()
        {
            var          result     = instance.GetAnnotations(webId, null);
            PIAnnotation annotation = result.Items.Where(m => m.Name == Constants.AF_EVENT_FRAME_ANNOTATION_NAME).FirstOrDefault();

            annotation.Value = "odosdsaaCSWCCSA";
            string id = annotation.Id.ToString();

            annotation.Id           = null;
            annotation.CreationDate = null;
            annotation.Creator      = null;
            annotation.Modifier     = null;
            annotation.ModifyDate   = null;
            annotation.Links        = null;
            instance.UpdateAnnotation(webId: webId, id: id, annotation: annotation);

            string       path       = Constants.AF_EVENT_FRAME_PATH;
            AFEventFrame eventFrame = AFObject.FindObject(path) as AFEventFrame;

            eventFrame.Refresh();
            IList <AFAnnotation> annotations = eventFrame.GetAnnotations();
            string afAnnValue = annotations.Where(m => m.Name == annotation.Name).First().Value.ToString();

            Assert.IsTrue(afAnnValue == annotation.Value.ToString());
        }
        public void UpdateTest()
        {
            string       path       = Constants.AF_EVENT_FRAME_PATH;
            PIEventFrame eventFrame = instance.GetByPath(path, null);

            eventFrame.Id                = null;
            eventFrame.Description       = "New swagger event frame description";
            eventFrame.Links             = null;
            eventFrame.Path              = null;
            eventFrame.WebId             = null;
            eventFrame.HasChildren       = null;
            eventFrame.AcknowledgedBy    = null;
            eventFrame.Security          = null;
            eventFrame.AcknowledgedDate  = null;
            eventFrame.IsAcknowledged    = null;
            eventFrame.IsAnnotated       = null;
            eventFrame.IsLocked          = null;
            eventFrame.CanBeAcknowledged = null;
            eventFrame.AreValuesCaptured = null;
            instance.Update(webId, eventFrame);

            StandardPISystem.Refresh();
            AFEventFrame myEventFrame = AFObject.FindObject(path) as AFEventFrame;

            myEventFrame.Refresh();
            myEventFrame.Database.Refresh();
            if (myEventFrame != null)
            {
                Assert.IsTrue(myEventFrame.Description == eventFrame.Description);
            }
        }
        public void CreateAttributeTest()
        {
            PIAttribute attribute = new PIAttribute()
            {
                Name                = "WaterEventFrame",
                Description         = "2008 Water Use",
                Type                = "Int32",
                TypeQualifier       = "",
                DataReferencePlugIn = "Table Lookup",
                ConfigString        = "SELECT [Water Use] FROM [Energy Use 2008] WHERE [Asset ID] = '%Element%'",
                IsConfigurationItem = false,
                IsHidden            = false,
                IsManualDataEntry   = false,
            };

            instance.CreateAttribute(webId, attribute);

            string       path         = Constants.AF_EVENT_FRAME_PATH;
            AFEventFrame myEventFrame = AFObject.FindObject(path) as AFEventFrame;

            myEventFrame.Refresh();

            if (myEventFrame != null)
            {
                Assert.IsNotNull(myEventFrame.Attributes[Constants.AF_ATTRIBUTE_NAME]);
            }
        }
        public void CaptureValuesTest()
        {
            instance.CaptureValues(webId);
            string       path         = Constants.AF_EVENT_FRAME_PATH;
            AFEventFrame myEventFrame = AFObject.FindObject(path) as AFEventFrame;

            myEventFrame.Refresh();
            Assert.IsTrue(myEventFrame.AreValuesCaptured == true);
        }
        public void AcknowledgeTest()
        {
            instance.Acknowledge(webId);
            string       path         = Constants.AF_EVENT_FRAME_PATH;
            AFEventFrame myEventFrame = AFObject.FindObject(path) as AFEventFrame;

            myEventFrame.Refresh();
            Assert.IsTrue(myEventFrame.IsAcknowledged == true);
        }
        public void CreateEventFrameTest()
        {
            PIEventFrame childEventFrame = new PIEventFrame()
            {
                Name      = Constants.AF_EVENT_FRAME_NAME + "3",
                StartTime = "*-2d",
                EndTime   = "*-1d"
            };

            instance.CreateEventFrame(webId, childEventFrame);
            string       path         = Constants.AF_EVENT_FRAME_PATH;
            AFEventFrame myEventFrame = AFObject.FindObject(path) as AFEventFrame;

            myEventFrame.Refresh();
            Assert.IsNotNull(myEventFrame.EventFrames[childEventFrame.Name]);
        }