/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* TestCaseExtension Library, Copyright 2015 Bryan Chadwick *
* *
* FILE: .\TestCaseData.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.Linq;
using TestCaseExtension.Internal;
namespace TestCaseExtension
{
/// Represents data to be handed to a TestCase via a TestCaseSource.
public class TestCaseData
{
/// The arguments for the TestCase
public object[] TestArguments { get; set; }
/// The Name/description of this TestCase. Use SetName() to set inline.
public string Name { get; set; }
/// Create a TestCaseData with the given argument
public TestCaseData(object testArgument)
{
TestArguments = new[] { testArgument };
}
/// Create a TestCaseData with the given two arguments
public TestCaseData(object testArgument1, object testArgument2)
{
TestArguments = new[] { testArgument1, testArgument2 };
}
/// Create a TestCaseData with the given three arguments
public TestCaseData(object testArgument1, object testArgument2, object testArgument3)
{
TestArguments = new[] { testArgument1, testArgument2, testArgument3 };
}
/// Create a TestCaseData with the given arguments
public TestCaseData(params object[] arguments)
{
TestArguments = arguments;
}
/// Set the Name of this test-case. Only for documentation, not used by the implementation
public TestCaseData SetName(string name)
{
Name = name;
return this;
}
/// Return a string representation of the arguments of this TestCaseData
public override string ToString()
{
return TestArguments.StringJoin(", ");
}
}
}