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 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); }