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

namespace TestCaseExtension
{
    /// <summary>Represents data to be handed to a <c>TestCase</c> via a <c>TestCaseSource</c>.</summary>
    public class TestCaseData
    {
        /// <summary>The arguments for the <c>TestCase</c></summary>
        public object[] TestArguments { get; set; }

        /// <summary>The Name/description of this TestCase.  Use <c>SetName()</c> to set inline.</summary>
        public string Name { get; set; }
        
        /// <summary>Create a TestCaseData with the given argument</summary>
        public TestCaseData(object testArgument)
        {
            TestArguments = new[] { testArgument };
        }

        /// <summary>Create a TestCaseData with the given two arguments</summary>
        public TestCaseData(object testArgument1, object testArgument2)
        {
            TestArguments = new[] { testArgument1, testArgument2 };
        }
        /// <summary>Create a TestCaseData with the given three arguments</summary>
        public TestCaseData(object testArgument1, object testArgument2, object testArgument3)
        {
            TestArguments = new[] { testArgument1, testArgument2, testArgument3 };
        }

        /// <summary>Create a TestCaseData with the given arguments</summary>
        public TestCaseData(params object[] arguments)
        {
            TestArguments = arguments;
        }

        /// <summary>Set the Name of this test-case.  Only for documentation, not used by the implementation</summary>
        public TestCaseData SetName(string name)
        {
            Name = name;
            return this;
        }

        /// <summary>Return a string representation of the arguments of this TestCaseData</summary>
        public override string ToString()
        {
            return TestArguments.StringJoin(", ");
        }
    }
}