public void ShouldGetCategoryEditor() { Editor editor = EditorCollection.GetCategoryEditorByAttributes(typeof(BusinessObject), "category"); Assert.IsNotNull(editor); Assert.IsInstanceOfType(editor, typeof(CategoryEditorMock)); }
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 ShouldFindPropertyEditor() { var editors = new EditorCollection(); var editor = new PropertyEditor(typeof(int), "property"); editors.Add(editor); Assert.AreEqual<PropertyEditor>(editor, editors.FindPropertyEditor(typeof(int), "property")); }
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")); }
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")); }
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))); }
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")); }
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")); }
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 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))); }