예제 #1
0
        public void ShouldReturnEqualtyByNames()
        {
            PropertyEditorAttribute attribute1 = new PropertyEditorAttribute("type");
              PropertyEditorAttribute attribute2 = new PropertyEditorAttribute("type");

              Assert.IsTrue(attribute1.Equals(attribute2));
              Assert.IsTrue(attribute2.Equals(attribute1));
        }
예제 #2
0
        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);
        }
예제 #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));
        }
예제 #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);
        }
예제 #5
0
 public void ShouldReturnEqualtyForSameInstance()
 {
     PropertyEditorAttribute attribute = new PropertyEditorAttribute("type");
       Assert.IsTrue(attribute.Equals(attribute));
 }
예제 #6
0
 public void ShouldAssignTypeName()
 {
     PropertyEditorAttribute attribute = new PropertyEditorAttribute("TYPE");
       Assert.AreEqual<string>("TYPE", attribute.EditorType);
 }
예제 #7
0
 public void ShouldAssignType()
 {
     PropertyEditorAttribute attribute = new PropertyEditorAttribute(typeof(string));
       Assert.AreEqual<string>(typeof(string).AssemblyQualifiedName, attribute.EditorType);
 }