// **************************************************************** // 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 { /// /// Abstract base for Attributes that are used to include tests /// in the test run based on environmental settings. /// public abstract class IncludeExcludeAttribute : Attribute { private string include; private string exclude; private string reason; /// /// Constructor with no included items specified, for use /// with named property syntax. /// public IncludeExcludeAttribute() { } /// /// Constructor taking one or more included items /// /// Comma-delimited list of included items public IncludeExcludeAttribute( string include ) { this.include = include; } /// /// Name of the item that is needed in order for /// a test to run. Multiple itemss may be given, /// separated by a comma. /// public string Include { get { return this.include; } set { include = value; } } /// /// Name of the item to be excluded. Multiple items /// may be given, separated by a comma. /// public string Exclude { get { return this.exclude; } set { this.exclude = value; } } /// /// The reason for including or excluding the test /// public string Reason { get { return reason; } set { reason = value; } } } /// /// PlatformAttribute is used to mark a test fixture or an /// individual method as applying to a particular platform only. /// [AttributeUsage(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Assembly, AllowMultiple=true)] public class PlatformAttribute : IncludeExcludeAttribute { /// /// Constructor with no platforms specified, for use /// with named property syntax. /// public PlatformAttribute() { } /// /// Constructor taking one or more platforms /// /// Comma-deliminted list of platforms public PlatformAttribute( string platforms ) : base( platforms ) { } } /// /// CultureAttribute is used to mark a test fixture or an /// individual method as applying to a particular Culture only. /// [AttributeUsage(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Assembly, AllowMultiple=false)] public class CultureAttribute : IncludeExcludeAttribute { /// /// Constructor with no cultures specified, for use /// with named property syntax. /// public CultureAttribute() { } /// /// Constructor taking one or more cultures /// /// Comma-deliminted list of cultures public CultureAttribute( string cultures ) : base( cultures ) { } } }