1 // ****************************************************************
2 // Copyright 2007, Charlie Poole
3 // This is free software licensed under the NUnit license. You may
4 // obtain a copy of the license at http://nunit.org/?p=license&r=2.4
5 // ****************************************************************
9 namespace NUnit
.Framework
12 /// PropertyAttribute is used to attach information to a test as a name/value pair..
14 [AttributeUsage(AttributeTargets
.Class
|AttributeTargets
.Method
|AttributeTargets
.Assembly
, AllowMultiple
=true)]
15 public class PropertyAttribute
: Attribute
20 protected string propertyName
;
23 /// The property value
25 protected object propertyValue
;
28 /// Construct a PropertyAttribute with a name and value
30 /// <param name="propertyName">The name of the property</param>
31 /// <param name="propertyValue">The property value</param>
32 public PropertyAttribute( string propertyName
, object propertyValue
)
34 this.propertyName
= propertyName
;
35 this.propertyValue
= propertyValue
;
39 /// Constructor for use by inherited classes that use the
40 /// name of the type as the property name.
42 protected PropertyAttribute( object propertyValue
)
44 this.propertyName
= this.GetType().Name
;
45 if ( propertyName
.EndsWith( "Attribute" ) )
46 propertyName
= propertyName
.Substring( 0, propertyName
.Length
- 9 );
47 this.propertyValue
= propertyValue
;
51 /// Gets the property name
55 get { return propertyName; }
59 /// Gets the property value
63 get { return propertyValue; }