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.

ファイルを表示 Open project: skolima/NAnt Class Usage Examples

Public Methods

Method 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.

Protected Methods

Method 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

Method Description
NUnitSetUp ( ) : void
TearDown ( ) : void

Method Details

CreateEmptyProject() protected method

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

CreateFilebasedProject() public method

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

CreateFilebasedProject() public method

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.
return NAnt.Core.Project

CreateFilebasedProject() public method

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
return NAnt.Core.Project

CreateTempDir() public method

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).
return string

CreateTempFile() public method

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.
return string

CreateTempFile() public method

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.
return string

ExecuteProject() public static method

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.
return string

ExecuteTask() public static method

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.
return string

RunBuild() public method

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.
return string

RunBuild() public method

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.
return string

RunBuild() public method

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.
return string

RunBuild() public method

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.
return string

SetUp() protected method

No need to add SetUp attribute to overriden method.

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

protected SetUp ( ) : void
return void