// **************************************************************** // Copyright 2007, Charlie Poole // This is free software licensed under the NUnit license. You may // obtain a copy of the license at http://nunit.org/?p=license&r=2.4 // **************************************************************** using System; namespace NUnit.Framework { /// /// PropertyAttribute is used to attach information to a test as a name/value pair.. /// [AttributeUsage(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Assembly, AllowMultiple=true)] public class PropertyAttribute : Attribute { /// /// The property name /// protected string propertyName; /// /// The property value /// protected object propertyValue; /// /// Construct a PropertyAttribute with a name and value /// /// The name of the property /// The property value public PropertyAttribute( string propertyName, object propertyValue ) { this.propertyName = propertyName; this.propertyValue = propertyValue; } /// /// Constructor for use by inherited classes that use the /// name of the type as the property name. /// protected PropertyAttribute( object propertyValue ) { this.propertyName = this.GetType().Name; if ( propertyName.EndsWith( "Attribute" ) ) propertyName = propertyName.Substring( 0, propertyName.Length - 9 ); this.propertyValue = propertyValue; } /// /// Gets the property name /// public string Name { get { return propertyName; } } /// /// Gets the property value /// public object Value { get { return propertyValue; } } } }