public void ShouldReturnEqualtyByNames() { PropertyEditorAttribute attribute1 = new PropertyEditorAttribute("type"); PropertyEditorAttribute attribute2 = new PropertyEditorAttribute("type"); Assert.IsTrue(attribute1.Equals(attribute2)); Assert.IsTrue(attribute2.Equals(attribute1)); }
public void ShouldReturnPropertyEditorByAttributes() { PropertyEditorAttribute attribute = new PropertyEditorAttribute(typeof(PropertyEditorMock)); Editor editor = EditorCollection.GetPropertyEditorByAttributes(new AttributeCollection(new Attribute[] { attribute })); Assert.IsNotNull(editor); Assert.IsInstanceOfType(editor, typeof(PropertyEditorMock)); }
public void ShouldReturnTypeNameBasedHashCode() { int hash1 = new PropertyEditorAttribute("type").GetHashCode(); int hash2 = new PropertyEditorAttribute("type").GetHashCode(); int hash3 = new PropertyEditorAttribute("newtype").GetHashCode(); Assert.AreEqual <int>(hash1, hash2); Assert.AreNotEqual <int>(hash1, hash3); }
public IPropertyGirdCell Create(PropertyEditorAttribute attribute) { Type attributeType = attribute.GetType(); Debug.Assert(_cells.Keys.Contains(attributeType), "没有为PropertyEditorAttribute映射相应的EditingControl"); if (_cells.Keys.Contains(attributeType)) { return(Activator.CreateInstance(_cells[attributeType]) as IPropertyGirdCell); } else { return(null); } }
public void ShouldReturnNoPropertyEditorByAttributes() { Assert.IsNull(EditorCollection.GetPropertyEditorByAttributes(null)); Assert.IsNull(EditorCollection.GetPropertyEditorByAttributes(new AttributeCollection())); PropertyEditorAttribute attribute = new PropertyEditorAttribute(typeof(string)); Editor editor = EditorCollection.GetPropertyEditorByAttributes(new AttributeCollection(new Attribute[] { attribute })); Assert.IsNull(editor); attribute = new PropertyEditorAttribute("missing"); editor = EditorCollection.GetPropertyEditorByAttributes(new AttributeCollection(new Attribute[] { attribute })); Assert.IsNull(editor); attribute = new PropertyEditorAttribute(typeof(InvalidPropertyEditorMock)); editor = EditorCollection.GetPropertyEditorByAttributes(new AttributeCollection(new Attribute[] { attribute })); Assert.IsNull(editor); }
public IPropertyGirdCell Create(PropertyEditorAttribute attribute) { return(_factory.Create(attribute)); }
public void ShouldReturnEqualtyForSameInstance() { PropertyEditorAttribute attribute = new PropertyEditorAttribute("type"); Assert.IsTrue(attribute.Equals(attribute)); }
public void ShouldAssignType() { PropertyEditorAttribute attribute = new PropertyEditorAttribute(typeof(string)); Assert.AreEqual <string>(typeof(string).AssemblyQualifiedName, attribute.EditorType); }
public void ShouldAssignTypeName() { PropertyEditorAttribute attribute = new PropertyEditorAttribute("TYPE"); Assert.AreEqual <string>("TYPE", attribute.EditorType); }
internal ProjectDataProperty(PropertyEditorAttribute attr, PropertyInfo p) { Attr = attr; P = p; }