/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *                                                                       *
 *   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 <http://www.gnu.org/licenses/>.                         *
 *                                                                       *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
using System;
using System.Collections.Generic;

namespace TestCaseExtension
{
    /// <summary>Takes TestCase data from a given static method, field, or property</summary>
    [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
    public class TestCaseSourceAttribute : Attribute
    {
        /// <summary>The type in which to look for the static Method, Property, or Field</summary>
        public Type ProvidingType { get; set; }

        /// <summary>Method, Property, or Field name that will provide TestCaseData</summary>
        public string MethodOrPropertyName { get; set; }

        /// <summary>Link the given TestCaseSource from the current Type to the annotated method</summary>
        public TestCaseSourceAttribute(string methodOrPropertyName)
            : this(null, methodOrPropertyName)
        {
        }

        /// <summary>Link the given TestCaseSource from the given Type to the annotated method</summary>
        public TestCaseSourceAttribute(Type declaringType, string methodOrPropertyName)
        {
            ProvidingType = declaringType;
            MethodOrPropertyName = methodOrPropertyName;
        }
    }
}