/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * TestCaseExtension Library, Copyright 2015 Bryan Chadwick * * * * FILE: .\TestCaseAttribute.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; namespace TestCaseExtension { /// <summary>TestMethod enhancement to run a method multiple times with different arguments.</summary> [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] public class TestCaseAttribute : Attribute { /// <summary>Arguments for the specific testcase</summary> public object[] TestArguments{ get; set; } /// <summary>Human-readable description for the testcase, ignored by the implementation</summary> public string Description { get; set; } /// <summary>Create a TestCase with the given argument</summary> public TestCaseAttribute(object testArgument) { TestArguments = new[] { testArgument }; } /// <summary>Create a TestCase with the given two arguments</summary> public TestCaseAttribute(object testArgument1, object testArgument2) { TestArguments = new[] { testArgument1, testArgument2 }; } /// <summary>Create a TestCase with the given three arguments</summary> public TestCaseAttribute(object testArgument1, object testArgument2, object testArgument3) { TestArguments = new[] { testArgument1, testArgument2, testArgument3 }; } /// <summary>Create a TestCase with the given arguments</summary> public TestCaseAttribute(params object[] testArguments) { TestArguments = testArguments; } } }