use MOONLIGHT symbol
[mcs.git] / nunit24 / NUnitFramework / framework / PropertyAttribute.cs
blob7accb1e238bd522d1b2139a4a80d8cbf02001bc5
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 // ****************************************************************
7 using System;
9 namespace NUnit.Framework
11 /// <summary>
12 /// PropertyAttribute is used to attach information to a test as a name/value pair..
13 /// </summary>
14 [AttributeUsage(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Assembly, AllowMultiple=true)]
15 public class PropertyAttribute : Attribute
17 /// <summary>
18 /// The property name
19 /// </summary>
20 protected string propertyName;
22 /// <summary>
23 /// The property value
24 /// </summary>
25 protected object propertyValue;
27 /// <summary>
28 /// Construct a PropertyAttribute with a name and value
29 /// </summary>
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;
38 /// <summary>
39 /// Constructor for use by inherited classes that use the
40 /// name of the type as the property name.
41 /// </summary>
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;
50 /// <summary>
51 /// Gets the property name
52 /// </summary>
53 public string Name
55 get { return propertyName; }
58 /// <summary>
59 /// Gets the property value
60 /// </summary>
61 public object Value
63 get { return propertyValue; }