/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* TestCaseExtension Library, Copyright 2015 Bryan Chadwick *
* *
* FILE: .\TestCaseSourceAttribute.cs *
* *
* This file is part of TestCaseExtension. *
* *
* TestCaseExtension is free software: you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation, either version *
* 3 of the License, or (at your option) any later version. *
* *
* TestCaseExtension is distributed in the hope that it will be useful,*
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with TestCaseExtension. *
* If not, see . *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
using System;
using System.Collections.Generic;
namespace TestCaseExtension
{
/// Takes TestCase data from a given static method, field, or property
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
public class TestCaseSourceAttribute : Attribute
{
/// The type in which to look for the static Method, Property, or Field
public Type ProvidingType { get; set; }
/// Method, Property, or Field name that will provide TestCaseData
public string MethodOrPropertyName { get; set; }
/// Link the given TestCaseSource from the current Type to the annotated method
public TestCaseSourceAttribute(string methodOrPropertyName)
: this(null, methodOrPropertyName)
{
}
/// Link the given TestCaseSource from the given Type to the annotated method
public TestCaseSourceAttribute(Type declaringType, string methodOrPropertyName)
{
ProvidingType = declaringType;
MethodOrPropertyName = methodOrPropertyName;
}
}
}