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 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);
        }
Esempio n. 3
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));
        }
Esempio n. 4
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);
        }
 public void ShouldReturnEqualtyForSameInstance()
 {
     PropertyEditorAttribute attribute = new PropertyEditorAttribute("type");
       Assert.IsTrue(attribute.Equals(attribute));
 }
 public void ShouldAssignTypeName()
 {
     PropertyEditorAttribute attribute = new PropertyEditorAttribute("TYPE");
       Assert.AreEqual<string>("TYPE", attribute.EditorType);
 }
 public void ShouldAssignType()
 {
     PropertyEditorAttribute attribute = new PropertyEditorAttribute(typeof(string));
       Assert.AreEqual<string>(typeof(string).AssemblyQualifiedName, attribute.EditorType);
 }