Beispiel #1
0
        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));
        }
Beispiel #2
0
        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);
        }