C# Class Tests.NAnt.Core.BuildTestBase

Base class for running build files and checking results.

Provides support for quickly running a build and capturing the output.

Afficher le fichier Open project: skolima/NAnt Class Usage Examples

Méthodes publiques

Méthode Description
CreateFilebasedProject ( string xml ) : Project

Creates a new Project with output level Level.Info.

CreateFilebasedProject ( string xml, Level level ) : Project

Creates a new Project with the given output level.

CreateFilebasedProject ( string xml, Level level, XmlNode configNode ) : Project

Creates a new Project with the given output level initialized using the specified configuration node.

CreateTempDir ( string name ) : string

Creates a temporary directory.

The directory is created and existance is checked.

CreateTempFile ( string name ) : string

Creates a temporary file in the temporary directory of the test.

The file is created and existance is checked.

CreateTempFile ( string name, string contents ) : string

Creates a tempfile in the test temp directory.

The file is created and existance is checked.

ExecuteProject ( Project p ) : string

Executes the project and returns the console output as a string.

Any exception that is thrown as part of the execution of the Project is wrapped in a TestBuildException.

ExecuteTask ( NAnt.Core.Task task ) : string

Executes a task and returns the console output as a string.

Any exception that is thrown as part of the execution of the Task is wrapped in a TestBuildException.

RunBuild ( string xml ) : string

Runs the XML as a NAnt project and returns the console output as a string.

RunBuild ( string xml, IBuildListener listener ) : string

Runs the XML as a NAnt project and returns the console output as a string.

RunBuild ( string xml, Level level ) : string

Runs the XML as NAnt project and returns the console output as a string.

RunBuild ( string xml, Level level, IBuildListener listener ) : string

Runs the XML as NAnt project and returns the console output as a string.

Méthodes protégées

Méthode Description
CreateEmptyProject ( ) : Project

Creates an empty project XmlDocument and loads it with a new project.

SetUp ( ) : void

No need to add SetUp attribute to overriden method.

Super classes that override SetUp must call the base class first.

Private Methods

Méthode Description
NUnitSetUp ( ) : void
TearDown ( ) : void

Method Details

CreateEmptyProject() protected méthode

Creates an empty project XmlDocument and loads it with a new project.
protected CreateEmptyProject ( ) : Project
Résultat NAnt.Core.Project

CreateFilebasedProject() public méthode

Creates a new Project with output level Level.Info.
public CreateFilebasedProject ( string xml ) : Project
xml string The XML of the build file
Résultat NAnt.Core.Project

CreateFilebasedProject() public méthode

Creates a new Project with the given output level.
public CreateFilebasedProject ( string xml, Level level ) : Project
xml string The XML of the build file
level Level The build output level.
Résultat NAnt.Core.Project

CreateFilebasedProject() public méthode

Creates a new Project with the given output level initialized using the specified configuration node.
public CreateFilebasedProject ( string xml, Level level, XmlNode configNode ) : Project
xml string The XML of the build file
level Level The build output level.
configNode System.Xml.XmlNode
Résultat NAnt.Core.Project

CreateTempDir() public méthode

Creates a temporary directory.
The directory is created and existance is checked.
public CreateTempDir ( string name ) : string
name string The name of the directory to create (name only, no path info).
Résultat string

CreateTempFile() public méthode

Creates a temporary file in the temporary directory of the test.
The file is created and existance is checked.
public CreateTempFile ( string name ) : string
name string The filename, should not be absolute.
Résultat string

CreateTempFile() public méthode

Creates a tempfile in the test temp directory.
The file is created and existance is checked.
public CreateTempFile ( string name, string contents ) : string
name string The filename, should not be absolute.
contents string The content of the file.
Résultat string

ExecuteProject() public static méthode

Executes the project and returns the console output as a string.
Any exception that is thrown as part of the execution of the Project is wrapped in a TestBuildException.
public static ExecuteProject ( Project p ) : string
p NAnt.Core.Project The project to execute.
Résultat string

ExecuteTask() public static méthode

Executes a task and returns the console output as a string.
Any exception that is thrown as part of the execution of the Task is wrapped in a TestBuildException.
public static ExecuteTask ( NAnt.Core.Task task ) : string
task NAnt.Core.Task The task to execute.
Résultat string

RunBuild() public méthode

Runs the XML as a NAnt project and returns the console output as a string.
public RunBuild ( string xml ) : string
xml string XML representing the build file contents.
Résultat string

RunBuild() public méthode

Runs the XML as a NAnt project and returns the console output as a string.
public RunBuild ( string xml, IBuildListener listener ) : string
xml string XML representing the build file contents.
listener IBuildListener A to which all build events will be dispatched.
Résultat string

RunBuild() public méthode

Runs the XML as NAnt project and returns the console output as a string.
public RunBuild ( string xml, Level level ) : string
xml string XML representing the build file contents.
level Level The build output threshold.
Résultat string

RunBuild() public méthode

Runs the XML as NAnt project and returns the console output as a string.
public RunBuild ( string xml, Level level, IBuildListener listener ) : string
xml string XML representing the build file contents.
level Level The build output threshold.
listener IBuildListener A to which all build events will be dispatched.
Résultat string

SetUp() protected méthode

No need to add SetUp attribute to overriden method.

Super classes that override SetUp must call the base class first.

protected SetUp ( ) : void
Résultat void