public SETestObject(ObjectDescriptor descriptor) { _nodeName = descriptor.Name; _description = descriptor.Description; IdentifyPropertyGroup propertyItem = descriptor.GetItem <IdentifyPropertyGroup>(); CachedPropertyGroup cachedItem = descriptor.GetItem <CachedPropertyGroup>(); if (cachedItem != null) { SetContext <CachedPropertyGroup>(cachedItem); } _properties = (propertyItem != null) ? propertyItem.Properties : new PropertiesDictionary(); if (_properties.ContainsKey(WebControlKeys.Type)) { _type = _properties[WebControlKeys.Type]; } if (_children == null) { _children = new SETestObjectList(); } }
public void ObjectDescriptor_GetObjectData() { FormatterConverter formatConverter = new FormatterConverter(); SerializationInfo serializationInfo = new SerializationInfo(typeof(ObjectDescriptor), formatConverter); VirtualTestObject virtualTestObject = new VirtualTestObject() { BoundingRect = new Rect(10, 20, 30, 40) }; ObjectDescriptor descriptor = virtualTestObject.GetDescriptor(); StreamingContext context = new StreamingContext(); IdentifyPropertyGroup group = descriptor.GetItem <IdentifyPropertyGroup>(); Assert.AreEqual("10,20,30,40", group.Properties[UIAControlKeys.BoundingRectangle]); descriptor.GetObjectData(serializationInfo, context); string typeString = null; foreach (SerializationEntry entry in serializationInfo) { if (entry.Name == DescriptorKeys.NodeType) { typeString = (string)entry.Value; break; } else if (entry.Name == IdentifyPropertyGroup.Key) { group = (IdentifyPropertyGroup)entry.Value; break; } } Assert.AreEqual(NodeType.VirtualControl, typeString); Assert.AreEqual("10,20,30,40", group.Properties[UIAControlKeys.BoundingRectangle]); }
internal static VirtualTestObject CreateTestObject(ObjectDescriptor descriptor, ModelLoadLevel loadLevel) { IdentifyPropertyGroup propertyItem = descriptor.GetItem <IdentifyPropertyGroup>(); string boundingRect = propertyItem.Properties[UIAControlKeys.BoundingRectangle]; Rect rect = StringRectToRect(boundingRect); VirtualTestObject testObject = new VirtualTestObject(descriptor.Name, rect); return(testObject); }
public UIATestObject(ObjectDescriptor descriptor) { _nodeName = descriptor.Name; _description = descriptor.Description; _relation = descriptor.GetItem <VisualRelationPropertyItem>(); IdentifyPropertyGroup propertyItem = descriptor.GetItem <IdentifyPropertyGroup>(); CachedPropertyGroup cachedItem = descriptor.GetItem <CachedPropertyGroup>(); if (cachedItem != null) { SetContext <CachedPropertyGroup>(cachedItem); } _properties = (propertyItem != null) ? propertyItem.Properties : new PropertiesDictionary(); if (_properties.ContainsKey(UIAControlKeys.Type)) { _type = _properties[UIAControlKeys.Type].ToControlType(); } if (_children == null) { _children = new TestObjectList(); } /* * if (descriptor.Children != null) * { * foreach (ObjectDescriptor child in descriptor.Children) * { * new UIATestObject(child, this); * } * }*/ }
public void PropertyItemTest() { ObjectDescriptor descriptor = new ObjectDescriptor(); descriptor.Name = "Button"; VisualRelationPropertyItem item = descriptor.GetItem <VisualRelationPropertyItem>(); Assert.AreEqual(null, item); item = new VisualRelationPropertyItem() { Left = "aaa", Right = "bbb" }; descriptor.SetItem(item); string result = JsonUtil.SerializeObject(descriptor); Debug.WriteLine(result); }