예제 #1
0
        public void ShouldGetCategoryEditor()
        {
            Editor editor = EditorCollection.GetCategoryEditorByAttributes(typeof(BusinessObject), "category");

            Assert.IsNotNull(editor);
            Assert.IsInstanceOfType(editor, typeof(CategoryEditorMock));
        }
예제 #2
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));
        }
예제 #3
0
        public void ShouldFindPropertyEditor()
        {
            var editors = new EditorCollection();
              var editor = new PropertyEditor(typeof(int), "property");
              editors.Add(editor);

              Assert.AreEqual<PropertyEditor>(editor, editors.FindPropertyEditor(typeof(int), "property"));
        }
예제 #4
0
        public void ShouldFindCategoryEditor()
        {
            EditorCollection editors = new EditorCollection();
              CategoryEditor editor = new CategoryEditor(typeof(int), "category", new DataTemplate());
              editors.Add(editor);

              Assert.AreEqual<CategoryEditor>(editor, editors.FindCategoryEditor(typeof(int), "category"));
        }
예제 #5
0
        public void ShouldFindPropertyEditor()
        {
            var editors = new EditorCollection();
            var editor  = new PropertyEditor(typeof(int), "property");

            editors.Add(editor);

            Assert.AreEqual <PropertyEditor>(editor, editors.FindPropertyEditor(typeof(int), "property"));
        }
예제 #6
0
        public void ShouldFindTypeEditorByTypeName()
        {
            EditorCollection editors = new EditorCollection();
            TypeEditor       editor  = new TypeEditor(typeof(int), new DataTemplate());

            editors.Add(editor);

            Assert.AreEqual <TypeEditor>(editor, editors.FindTypeEditor(typeof(int)));
        }
예제 #7
0
 public void ShouldGetNoCategoryEditor()
 {
     Assert.IsNull(EditorCollection.GetCategoryEditorByAttributes(null, "category"));
     Assert.IsNull(EditorCollection.GetCategoryEditorByAttributes(typeof(int), null));
     Assert.IsNull(EditorCollection.GetCategoryEditorByAttributes(typeof(BusinessObject), "missing"));
     Assert.IsNull(EditorCollection.GetCategoryEditorByAttributes(typeof(BusinessObject), "invalid1"));
     Assert.IsNull(EditorCollection.GetCategoryEditorByAttributes(typeof(BusinessObject), "invalid2"));
     Assert.IsNull(EditorCollection.GetCategoryEditorByAttributes(typeof(BusinessObject), "invalid3"));
 }
예제 #8
0
        public void ShouldFindCategoryEditor()
        {
            EditorCollection editors = new EditorCollection();
            CategoryEditor   editor  = new CategoryEditor(typeof(int), "category", new DataTemplate());

            editors.Add(editor);

            Assert.AreEqual <CategoryEditor>(editor, editors.FindCategoryEditor(typeof(int), "category"));
        }
예제 #9
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);
        }
예제 #10
0
        public void ShouldFindTypeEditorByTypeName()
        {
            EditorCollection editors = new EditorCollection();
              TypeEditor editor = new TypeEditor(typeof(int), new DataTemplate());
              editors.Add(editor);

              Assert.AreEqual<TypeEditor>(editor, editors.FindTypeEditor(typeof(int)));
        }