// NAnt - A .NET build tool // Copyright (C) 2001-2002 Gerry Shaw // // This program 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 2 of the License, or // (at your option) any later version. // // This program 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 this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // Mike Two (2@thoughtworks.com or mike2@nunit.org) // Scott Hernandez (ScottHernandez@hotmail.com) using System.Collections.Specialized; using System.IO; using NAnt.Core; using NAnt.Core.Attributes; using NAnt.Core.Types; using NAnt.DotNet.Types; using NAnt.NUnit.Types; using NAnt.NUnit2.Tasks; using NAnt.NUnit2.Types; namespace NAnt.NUnit2.Types { /// /// Represents a test element of an . /// [ElementName("test")] public class NUnit2Test : Element { #region Private Instance Fields private FileInfo _assemblyFile; private string _testname; private bool _haltOnFailure = true; private FileInfo _xsltFile; private AssemblyFileSet _assemblies = new AssemblyFileSet(); private FileInfo _appConfigFile; private Categories _categories = new Categories(); #endregion Private Instance Fields #region Public Instance Properties /// /// Name of the assembly to search for tests. /// [TaskAttribute("assemblyname")] public FileInfo AssemblyFile { get { return _assemblyFile; } set { _assemblyFile = value; } } /// /// Name of a specific testfixture to run. If not specified then all /// testfixtures are run. /// [TaskAttribute("testname")] public string TestName { get { return _testname; } set { _testname = value; } } /// /// Assemblies to include in test. /// [BuildElement("assemblies")] public AssemblyFileSet Assemblies { get { return _assemblies; } set { _assemblies = value; } } /// /// Categories of test cases to include or exclude. /// [BuildElement("categories")] public Categories Categories { get { return _categories; } set { _categories = value; } } /// /// Build fails on failure. The default is . /// [TaskAttribute("haltonfailure")] [BooleanValidator()] public bool HaltOnFailure { get { return _haltOnFailure; } set { _haltOnFailure = value; } } /// /// XSLT transform file to use when using the /// formatter. /// [TaskAttribute("transformfile")] public FileInfo XsltFile { get { return _xsltFile; } set { _xsltFile = value; } } /// /// The application configuration file to use for the NUnit test domain. /// If not specified, NAnt will try to use a configuration name matching /// the file name of the assembly with extension ".config". /// [TaskAttribute("appconfig")] public FileInfo AppConfigFile { get { return _appConfigFile; } set { _appConfigFile = value; } } /// /// Gets all assemblies specified for these tests. /// /// /// All assemblies specified for these tests. /// public StringCollection TestAssemblies { get { StringCollection files = new StringCollection(); if (AssemblyFile != null) { files.Add(AssemblyFile.FullName); } else { files = Assemblies.FileNames; } return files; } } #endregion Public Instance Properties } }