Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,293 @@
// ****************************************************************
// Copyright 2007, Charlie Poole
// This is free software licensed under the NUnit license. You may
// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
// ****************************************************************
//#define RUN_IN_PARALLEL
namespace NUnit.Util
{
using System;
using System.Collections;
using System.IO;
using NUnit.Core;
/// <summary>
/// AggregatingTestRunner allows running multiple TestRunners
/// and combining the results.
/// </summary>
public abstract class AggregatingTestRunner : MarshalByRefObject, TestRunner, EventListener
{
static int AggregateTestID = 1000;
#region Instance Variables
/// <summary>
/// Our runner ID
/// </summary>
protected int runnerID;
/// <summary>
/// The downstream TestRunners
/// </summary>
protected ArrayList runners;
/// <summary>
/// The loaded test suite
/// </summary>
protected TestNode aggregateTest;
/// <summary>
/// The result of the last run
/// </summary>
private TestResult testResult;
/// <summary>
/// The event listener for the currently running test
/// </summary>
protected EventListener listener;
protected string projectName;
protected TestName testName;
#endregion
#region Constructors
public AggregatingTestRunner() : this( 0 ) { }
public AggregatingTestRunner( int runnerID )
{
this.runnerID = runnerID;
this.testName = new TestName();
testName.TestID = new TestID( AggregateTestID );
testName.RunnerID = this.runnerID;
testName.FullName = testName.Name = "Not Loaded";
}
#endregion
#region Properties
public virtual int ID
{
get { return runnerID; }
}
public virtual bool Running
{
get
{
foreach( TestRunner runner in runners )
if ( runner.Running )
return true;
return false;
}
}
public virtual IList AssemblyInfo
{
get
{
ArrayList info = new ArrayList();
foreach( TestRunner runner in runners )
info.AddRange( runner.AssemblyInfo );
return info;
}
}
public virtual ITest Test
{
get
{
if ( aggregateTest == null && runners != null )
{
// Count non-null tests, in case we specified a fixture
int count = 0;
foreach( TestRunner runner in runners )
if ( runner.Test != null )
++count;
// Copy non-null tests to an array
int index = 0;
ITest[] tests = new ITest[count];
foreach( TestRunner runner in runners )
if ( runner.Test != null )
tests[index++] = runner.Test;
// Return master node containing all the tests
aggregateTest = new TestNode( testName, tests );
}
return aggregateTest;
}
}
public virtual TestResult TestResult
{
get { return testResult; }
}
#endregion
#region Load and Unload Methods
public abstract bool Load(TestPackage package);
public virtual void Unload()
{
foreach( TestRunner runner in runners )
runner.Unload();
aggregateTest = null;
}
#endregion
#region CountTestCases
public virtual int CountTestCases( ITestFilter filter )
{
int count = 0;
foreach( TestRunner runner in runners )
count += runner.CountTestCases( filter );
return count;
}
#endregion
#region Methods for Running Tests
public virtual TestResult Run( EventListener listener )
{
return Run( listener, TestFilter.Empty );
}
public virtual TestResult Run(EventListener listener, ITestFilter filter )
{
// Save active listener for derived classes
this.listener = listener;
ITest[] tests = new ITest[runners.Count];
for( int index = 0; index < runners.Count; index++ )
tests[index] = ((TestRunner)runners[index]).Test;
this.listener.RunStarted( this.Test.TestName.Name, this.CountTestCases( filter ) );
this.listener.SuiteStarted( this.Test.TestName );
long startTime = DateTime.Now.Ticks;
TestSuiteResult result = new TestSuiteResult( new TestInfo( testName, tests ), projectName );
result.RunState = RunState.Executed;
foreach( TestRunner runner in runners )
if ( filter.Pass( runner.Test ) )
result.AddResult( runner.Run( this, filter ) );
long stopTime = DateTime.Now.Ticks;
double time = ((double)(stopTime - startTime)) / (double)TimeSpan.TicksPerSecond;
result.Time = time;
this.listener.SuiteFinished( result );
this.listener.RunFinished( result );
this.testResult = result;
return result;
}
public virtual void BeginRun( EventListener listener )
{
BeginRun( listener, TestFilter.Empty );
}
public virtual void BeginRun( EventListener listener, ITestFilter filter )
{
// Save active listener for derived classes
this.listener = listener;
#if RUN_IN_PARALLEL
this.listener.RunStarted( this.Test.Name, this.CountTestCases( filter ) );
foreach( TestRunner runner in runners )
if ( runner.Test != null )
runner.BeginRun( this, filter );
//this.listener.RunFinished( this.Results );
#else
ThreadedTestRunner threadedRunner = new ThreadedTestRunner( this );
threadedRunner.BeginRun( listener, filter );
#endif
}
public virtual TestResult EndRun()
{
TestSuiteResult suiteResult = new TestSuiteResult( aggregateTest, Test.TestName.FullName );
foreach( TestRunner runner in runners )
suiteResult.Results.Add( runner.EndRun() );
return suiteResult;
}
public virtual void CancelRun()
{
foreach( TestRunner runner in runners )
runner.CancelRun();
}
public virtual void Wait()
{
foreach( TestRunner runner in runners )
runner.Wait();
}
#endregion
#region EventListener Members
public void TestStarted(TestName testName)
{
this.listener.TestStarted( testName );
}
public void RunStarted(string name, int testCount)
{
// TODO: We may want to count how many runs are started
// Ignore - we provide our own
}
public void RunFinished(Exception exception)
{
// Ignore - we provide our own
}
void NUnit.Core.EventListener.RunFinished(TestResult result)
{
// TODO: Issue combined RunFinished when all runs are done
}
public void SuiteFinished(TestSuiteResult result)
{
this.listener.SuiteFinished( result );
}
public void TestFinished(TestCaseResult result)
{
this.listener.TestFinished( result );
}
public void UnhandledException(Exception exception)
{
this.listener.UnhandledException( exception );
}
public void TestOutput(TestOutput testOutput)
{
this.listener.TestOutput( testOutput );
}
public void SuiteStarted(TestName suiteName)
{
this.listener.SuiteStarted( suiteName );
}
#endregion
#region InitializeLifetimeService Override
public override object InitializeLifetimeService()
{
return null;
}
#endregion
}
}

View File

@@ -0,0 +1,11 @@
// ****************************************************************
// This is free software licensed under the NUnit license. You
// may obtain a copy of the license as well as information regarding
// copyright ownership at http://nunit.org/?p=license&r=2.4.
// ****************************************************************
using System.Reflection;
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("../../nunit.snk")]
[assembly: AssemblyKeyName("")]

View File

@@ -0,0 +1,36 @@
// ****************************************************************
// This is free software licensed under the NUnit license. You
// may obtain a copy of the license as well as information regarding
// copyright ownership at http://nunit.org/?p=license&r=2.4.
// ****************************************************************
using System;
using System.Threading;
using System.Xml.Serialization;
namespace NUnit.Util
{
/// <summary>
/// Holds an assembly path and other information needed to
/// load an assembly. Currently there is no other info.
/// Used in serialization of NUnit projects.
/// </summary>
[Serializable]
public struct AssemblyItem
{
[XmlAttribute]
public string path;
public ApartmentState apartment;
public AssemblyItem( string path ) : this( path, ApartmentState.Unknown ) { }
public AssemblyItem( string path, ApartmentState apartment )
{
if ( !System.IO.Path.IsPathRooted( path ) )
throw new ArgumentException( "Assembly path must be absolute", "path" );
this.path = path;
this.apartment = apartment;
}
}
}

View File

@@ -0,0 +1,79 @@
// ****************************************************************
// This is free software licensed under the NUnit license. You
// may obtain a copy of the license as well as information regarding
// copyright ownership at http://nunit.org/?p=license&r=2.4.
// ****************************************************************
using System;
using System.IO;
using System.Collections;
namespace NUnit.Util
{
/// <summary>
/// Represents a list of assemblies. It stores paths
/// that are added and fires an event whenevever it
/// changes. All paths must be added as absolute paths.
/// </summary>
public class AssemblyList : CollectionBase
{
#region Properties and Events
public string this[int index]
{
get { return (string)List[index]; }
set
{
if ( !Path.IsPathRooted( value ) )
throw new ArgumentException( "Assembly path must be absolute" );
List[index] = value;
}
}
public event EventHandler Changed;
#endregion
#region Methods
public string[] ToArray()
{
return (string[])InnerList.ToArray( typeof( string ) );
}
public void Add( string assemblyPath )
{
if ( !Path.IsPathRooted( assemblyPath ) )
throw new ArgumentException( "Assembly path must be absolute" );
List.Add( assemblyPath );
}
public void Remove( string assemblyPath )
{
for( int index = 0; index < this.Count; index++ )
{
if ( this[index] == assemblyPath )
RemoveAt( index );
}
}
protected override void OnRemoveComplete(int index, object value)
{
FireChangedEvent();
}
protected override void OnInsertComplete(int index, object value)
{
FireChangedEvent();
}
protected override void OnSetComplete(int index, object oldValue, object newValue)
{
FireChangedEvent();
}
private void FireChangedEvent()
{
if ( Changed != null )
Changed( this, EventArgs.Empty );
}
#endregion
}
}

View File

@@ -0,0 +1,114 @@
// ****************************************************************
// This is free software licensed under the NUnit license. You
// may obtain a copy of the license as well as information regarding
// copyright ownership at http://nunit.org/?p=license&r=2.4.
// ****************************************************************
using System;
using System.IO;
using System.Text;
using System.Timers;
using System.Collections;
namespace NUnit.Util
{
/// <summary>
/// AssemblyWatcher keeps track of one or more assemblies to
/// see if they have changed. It incorporates a delayed notification
/// and uses a standard event to notify any interested parties
/// about the change. The path to the assembly is provided as
/// an argument to the event handler so that one routine can
/// be used to handle events from multiple watchers.
/// </summary>
public class AssemblyWatcher
{
FileSystemWatcher[] fileWatcher;
FileInfo[] fileInfo;
protected System.Timers.Timer timer;
protected string changedAssemblyPath;
public delegate void AssemblyChangedHandler(String fullPath);
public event AssemblyChangedHandler AssemblyChangedEvent;
public AssemblyWatcher( int delay, string assemblyFileName )
: this( delay, new string[]{ assemblyFileName } ) { }
public AssemblyWatcher( int delay, IList assemblies )
{
fileInfo = new FileInfo[assemblies.Count];
fileWatcher = new FileSystemWatcher[assemblies.Count];
for( int i = 0; i < assemblies.Count; i++ )
{
fileInfo[i] = new FileInfo( (string)assemblies[i] );
fileWatcher[i] = new FileSystemWatcher();
fileWatcher[i].Path = fileInfo[i].DirectoryName;
fileWatcher[i].Filter = fileInfo[i].Name;
fileWatcher[i].NotifyFilter = NotifyFilters.Size | NotifyFilters.LastWrite;
fileWatcher[i].Changed+=new FileSystemEventHandler(OnChanged);
fileWatcher[i].EnableRaisingEvents = false;
}
timer = new System.Timers.Timer( delay );
timer.AutoReset=false;
timer.Enabled=false;
timer.Elapsed+=new ElapsedEventHandler(OnTimer);
}
public FileInfo GetFileInfo( int index )
{
return fileInfo[index];
}
public void Start()
{
EnableWatchers( true );
}
public void Stop()
{
EnableWatchers( false );
}
private void EnableWatchers( bool enable )
{
foreach( FileSystemWatcher watcher in fileWatcher )
watcher.EnableRaisingEvents = enable;
}
protected void OnTimer(Object source, ElapsedEventArgs e)
{
lock(this)
{
PublishEvent();
timer.Enabled=false;
}
}
protected void OnChanged(object source, FileSystemEventArgs e)
{
changedAssemblyPath = e.FullPath;
if ( timer != null )
{
lock(this)
{
if(!timer.Enabled)
timer.Enabled=true;
timer.Start();
}
}
else
{
PublishEvent();
}
}
protected void PublishEvent()
{
if ( AssemblyChangedEvent != null )
AssemblyChangedEvent( changedAssemblyPath );
}
}
}

View File

@@ -0,0 +1,152 @@
using System;
using System.Collections;
using NUnit.Core;
using NUnit.Core.Filters;
namespace NUnit.Util
{
/// <summary>
/// CategoryExpression parses strings representing boolean
/// combinations of categories according to the following
/// grammar:
/// CategoryName ::= string not containing any of ',', '&', '+', '-'
/// CategoryFilter ::= CategoryName | CategoryFilter ',' CategoryName
/// CategoryPrimitive ::= CategoryFilter | '-' CategoryPrimitive
/// CategoryTerm ::= CategoryPrimitive | CategoryTerm '&' CategoryPrimitive
/// </summary>
public class CategoryExpression
{
static readonly char[] ops = new char[] { ',', ';', '-', '|', '+', '(', ')' };
private string text;
private int next;
private string token;
private TestFilter filter;
public CategoryExpression(string text)
{
this.text = text;
this.next = 0;
}
public TestFilter Filter
{
get
{
if( filter == null )
{
filter = GetToken() == null
? TestFilter.Empty
: GetExpression();
}
return filter;
}
}
private TestFilter GetExpression()
{
TestFilter term = GetTerm();
if ( token != "|" )
return term;
OrFilter filter = new OrFilter( term );
while ( token == "|" )
{
GetToken();
filter.Add( GetTerm() );
}
return filter;
}
private TestFilter GetTerm()
{
TestFilter prim = GetPrimitive();
if ( token != "+" && token != "-" )
return prim;
AndFilter filter = new AndFilter( prim );
while ( token == "+"|| token == "-" )
{
string tok = token;
GetToken();
prim = GetPrimitive();
filter.Add( tok == "-" ? new NotFilter( prim ) : prim );
}
return filter;
}
private TestFilter GetPrimitive()
{
if( token == "-" )
{
GetToken();
return new NotFilter( GetPrimitive() );
}
else if( token == "(" )
{
GetToken();
TestFilter expr = GetExpression();
GetToken(); // Skip ')'
return expr;
}
return GetCategoryFilter();
}
private CategoryFilter GetCategoryFilter()
{
CategoryFilter filter = new CategoryFilter( token );
while( GetToken() == "," || token == ";" )
filter.AddCategory( GetToken() );
return filter;
}
public string GetToken()
{
SkipWhiteSpace();
if ( EndOfText() )
token = null;
else if ( NextIsOperator() )
token = text.Substring(next++, 1);
else
{
int index2 = text.IndexOfAny( ops, next );
if ( index2 < 0 ) index2 = text.Length;
token = text.Substring( next, index2 - next ).TrimEnd();
next = index2;
}
return token;
}
private void SkipWhiteSpace()
{
while( next < text.Length && Char.IsWhiteSpace( text[next] ) )
++next;
}
private bool EndOfText()
{
return next >= text.Length;
}
private bool NextIsOperator()
{
foreach( char op in ops )
if( op == text[next] )
return true;
return false;
}
}
}

View File

@@ -0,0 +1,54 @@
// ****************************************************************
// This is free software licensed under the NUnit license. You
// may obtain a copy of the license as well as information regarding
// copyright ownership at http://nunit.org/?p=license&r=2.4.
// ****************************************************************
using System;
using System.Collections;
using NUnit.Core;
namespace NUnit.Util
{
public class CategoryManager
{
private Hashtable categories = new Hashtable();
public void Add(string name)
{
categories[name] = name;
}
public void Add(IList list)
{
foreach(string name in list)
{
Add(name);
}
}
public void AddCategories( ITest test )
{
if ( test.Categories != null )
Add( test.Categories );
}
public void AddAllCategories( ITest test )
{
AddCategories( test );
if ( test.IsSuite )
foreach( ITest child in test.Tests )
AddAllCategories( child );
}
public ICollection Categories
{
get { return categories.Values; }
}
public void Clear()
{
categories = new Hashtable();
}
}
}

View File

@@ -0,0 +1,316 @@
// File: CommandLineOptions.cs
//
// This is a re-usable component to be used when you
// need to parse command-line options/parameters.
//
// Separates command line parameters from command line options.
// Uses reflection to populate member variables the derived class with the values
// of the options.
//
// An option can start with "-" or "--". On Windows systems, it can start with "/" as well.
//
// I define 3 types of "options":
// 1. Boolean options (yes/no values), e.g: /r to recurse
// 2. Value options, e.g: /loglevel=3
// 2. Parameters: standalone strings like file names
//
// An example to explain:
// csc /nologo /t:exe myfile.cs
// | | |
// | | + parameter
// | |
// | + value option
// |
// + boolean option
//
// Please see a short description of the CommandLineOptions class
// at http://codeblast.com/~gert/dotnet/sells.html
//
// Gert Lombard (gert@codeblast.com)
// James Newkirk (jim@nunit.org)
namespace Codeblast
{
using System;
using System.Reflection;
using System.Collections;
using System.Text;
//
// The Attributes
//
[AttributeUsage(AttributeTargets.Field)]
public class OptionAttribute : Attribute
{
protected object optValue;
protected string optName;
protected string description;
public string Short
{
get { return optName; }
set { optName = value; }
}
public object Value
{
get { return optValue; }
set { optValue = value; }
}
public string Description
{
get { return description; }
set { description = value; }
}
}
//
// The CommandLineOptions members
//
public abstract class CommandLineOptions
{
protected ArrayList parameters;
protected bool isInvalid = false;
private int optionCount;
private ArrayList invalidArguments = new ArrayList();
private bool allowForwardSlash;
public CommandLineOptions( string[] args )
: this( System.IO.Path.DirectorySeparatorChar != '/', args ) {}
public CommandLineOptions( bool allowForwardSlash, string[] args )
{
this.allowForwardSlash = allowForwardSlash;
optionCount = Init( args );
}
public IList InvalidArguments
{
get { return invalidArguments; }
}
public bool NoArgs
{
get
{
return ParameterCount == 0 && optionCount == 0;
}
}
public bool AllowForwardSlash
{
get { return allowForwardSlash; }
}
public int Init(params string[] args)
{
int count = 0;
int n = 0;
while (n < args.Length)
{
int pos = IsOption(args[n]);
if (pos > 0)
{
// It's an option:
if (GetOption(args, ref n, pos))
count++;
else
InvalidOption(args[Math.Min(n, args.Length-1)]);
}
else
{
if (parameters == null) parameters = new ArrayList();
parameters.Add(args[n]);
if ( !IsValidParameter(args[n]) )
InvalidOption( args[n] );
}
n++;
}
return count;
}
// An option starts with "/", "-" or "--":
protected virtual int IsOption(string opt)
{
char[] c = null;
if (opt.Length < 2)
{
return 0;
}
else if (opt.Length > 2)
{
c = opt.ToCharArray(0, 3);
if (c[0] == '-' && c[1] == '-' && IsOptionNameChar(c[2])) return 2;
}
else
{
c = opt.ToCharArray(0, 2);
}
if ((c[0] == '-' || c[0] == '/' && AllowForwardSlash) && IsOptionNameChar(c[1])) return 1;
return 0;
}
protected virtual bool IsOptionNameChar(char c)
{
return Char.IsLetterOrDigit(c) || c == '?';
}
protected virtual void InvalidOption(string name)
{
invalidArguments.Add( name );
isInvalid = true;
}
protected virtual bool IsValidParameter(string param)
{
return true;
}
protected virtual bool MatchShortName(FieldInfo field, string name)
{
object[] atts = field.GetCustomAttributes(typeof(OptionAttribute), true);
foreach (OptionAttribute att in atts)
{
if (string.Compare(att.Short, name, true) == 0) return true;
}
return false;
}
protected virtual FieldInfo GetMemberField(string name)
{
Type t = this.GetType();
FieldInfo[] fields = t.GetFields(BindingFlags.Instance|BindingFlags.Public);
foreach (FieldInfo field in fields)
{
if (string.Compare(field.Name, name, true) == 0) return field;
if (MatchShortName(field, name)) return field;
}
return null;
}
protected virtual object GetOptionValue(FieldInfo field)
{
object[] atts = field.GetCustomAttributes(typeof(OptionAttribute), true);
if (atts.Length > 0)
{
OptionAttribute att = (OptionAttribute)atts[0];
return att.Value;
}
return null;
}
protected virtual bool GetOption(string[] args, ref int index, int pos)
{
try
{
object cmdLineVal = null;
string opt = args[index].Substring(pos, args[index].Length-pos);
SplitOptionAndValue(ref opt, ref cmdLineVal);
FieldInfo field = GetMemberField(opt);
if (field != null)
{
object value = GetOptionValue(field);
if (value == null)
{
if (field.FieldType == typeof(bool))
value = true; // default for bool values is true
else if(field.FieldType == typeof(string))
{
value = cmdLineVal != null ? cmdLineVal : args[++index];
field.SetValue(this, Convert.ChangeType(value, field.FieldType));
string stringValue = (string)value;
if(stringValue == null || stringValue.Length == 0) return false;
return true;
}
else if(field.FieldType.IsEnum)
value = Enum.Parse( field.FieldType, (string)cmdLineVal, true );
else
value = cmdLineVal != null ? cmdLineVal : args[++index];
}
field.SetValue(this, Convert.ChangeType(value, field.FieldType));
return true;
}
}
catch (Exception)
{
// Ignore exceptions like type conversion errors.
}
return false;
}
protected virtual void SplitOptionAndValue(ref string opt, ref object val)
{
// Look for ":" or "=" separator in the option:
int pos = opt.IndexOfAny( new char[] { ':', '=' } );
if (pos < 1) return;
val = opt.Substring(pos+1);
opt = opt.Substring(0, pos);
}
// Parameter accessor:
public string this[int index]
{
get
{
if (parameters != null) return (string)parameters[index];
return null;
}
}
public ArrayList Parameters
{
get { return parameters; }
}
public int ParameterCount
{
get
{
return parameters == null ? 0 : parameters.Count;
}
}
public virtual void Help()
{
Console.WriteLine(GetHelpText());
}
public virtual string GetHelpText()
{
StringBuilder helpText = new StringBuilder();
Type t = this.GetType();
FieldInfo[] fields = t.GetFields(BindingFlags.Instance|BindingFlags.Public);
char optChar = allowForwardSlash ? '/' : '-';
foreach (FieldInfo field in fields)
{
object[] atts = field.GetCustomAttributes(typeof(OptionAttribute), true);
if (atts.Length > 0)
{
OptionAttribute att = (OptionAttribute)atts[0];
if (att.Description != null)
{
string valType = "";
if (att.Value == null)
{
if (field.FieldType == typeof(float)) valType = "=FLOAT";
else if (field.FieldType == typeof(string)) valType = "=STR";
else if (field.FieldType != typeof(bool)) valType = "=X";
}
helpText.AppendFormat("{0}{1,-20}\t{2}", optChar, field.Name+valType, att.Description);
if (att.Short != null)
helpText.AppendFormat(" (Short format: {0}{1}{2})", optChar, att.Short, valType);
helpText.Append( Environment.NewLine );
}
}
}
return helpText.ToString();
}
}
}

View File

@@ -0,0 +1,73 @@
// ****************************************************************
// This is free software licensed under the NUnit license. You
// may obtain a copy of the license as well as information regarding
// copyright ownership at http://nunit.org/?p=license&r=2.4.
// ****************************************************************
namespace NUnit.Util
{
using System;
using System.IO;
using System.Text;
/// <summary>
/// Class used for receiving console output from the running test and displaying it.
/// </summary>
public class ConsoleWriter : TextWriter
{
#region Private Fields
private TextWriter console;
#endregion
#region Constructors
public ConsoleWriter(TextWriter console)
{
this.console = console;
}
#endregion
#region TextWriter Overrides
public override void Close()
{
//console.Close ();
}
public override void Flush()
{
console.Flush ();
}
public override void Write(char c)
{
console.Write(c);
}
public override void Write(String s)
{
console.Write(s);
}
public override void WriteLine(string s)
{
console.WriteLine(s);
}
public override Encoding Encoding
{
get { return Encoding.Default; }
}
public override Object InitializeLifetimeService()
{
return null;
}
#endregion
}
}

View File

@@ -0,0 +1,102 @@
// ****************************************************************
// Copyright 2007, Charlie Poole
// This is free software licensed under the NUnit license. You may
// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
// ****************************************************************
using System;
namespace NUnit.Util
{
public delegate void SettingsEventHandler( object sender, SettingsEventArgs args );
public class SettingsEventArgs : EventArgs
{
private string settingName;
public SettingsEventArgs( string settingName )
{
this.settingName = settingName;
}
public string SettingName
{
get { return settingName; }
}
}
/// <summary>
/// The ISettings interface is used to access all user
/// settings and options.
/// </summary>
public interface ISettings
{
event SettingsEventHandler Changed;
/// <summary>
/// Load a setting from the storage.
/// </summary>
/// <param name="settingName">Name of the setting to load</param>
/// <returns>Value of the setting or null</returns>
object GetSetting( string settingName );
/// <summary>
/// Load a setting from the storage or return a default value
/// </summary>
/// <param name="settingName">Name of the setting to load</param>
/// <param name="settingName">Value to return if the setting is missing</param>
/// <returns>Value of the setting or the default value</returns>
object GetSetting( string settingName, object defaultValue );
/// <summary>
/// Load an integer setting from the storage or return a default value
/// </summary>
/// <param name="settingName">Name of the setting to load</param>
/// <param name="defaultValue">Value to return if the setting is missing</param>
/// <returns>Value of the setting or the default value</returns>
int GetSetting( string settingName, int defaultValue );
/// <summary>
/// Load a boolean setting or return a default value
/// </summary>
/// <param name="settingName">Name of setting to load</param>
/// <param name="defaultValue">Value to return if the setting is missing</param>
/// <returns>Value of the setting or the default value</returns>
bool GetSetting( string settingName, bool defaultValue );
/// <summary>
/// Load a string setting from the storage or return a default value
/// </summary>
/// <param name="settingName">Name of the setting to load</param>
/// <param name="defaultValue">Value to return if the setting is missing</param>
/// <returns>Value of the setting or the default value</returns>
string GetSetting( string settingName, string defaultValue );
/// <summary>
/// Load an enum setting from the storage or return a default value
/// </summary>
/// <param name="settingName">Name of the setting to load</param>
/// <param name="defaultValue">Value to return if the setting is missing</param>
/// <returns>Value of the setting or the default value</returns>
System.Enum GetSetting( string settingName, System.Enum defaultValue );
/// <summary>
/// Remove a setting from the storage
/// </summary>
/// <param name="settingName">Name of the setting to remove</param>
void RemoveSetting( string settingName );
/// <summary>
/// Remove an entire group of settings from the storage
/// </summary>
/// <param name="groupName">Name of the group to remove</param>
void RemoveGroup( string groupName );
/// <summary>
/// Save a setting in the storage
/// </summary>
/// <param name="settingName">Name of the setting to save</param>
/// <param name="settingValue">Value to be saved</param>
void SaveSetting( string settingName, object settingValue );
}
}

View File

@@ -0,0 +1,67 @@
// ****************************************************************
// This is free software licensed under the NUnit license. You
// may obtain a copy of the license as well as information regarding
// copyright ownership at http://nunit.org/?p=license&r=2.4.
// ****************************************************************
using System;
using NUnit.Core;
namespace NUnit.Util
{
/// <summary>
/// ITestEvents interface defines events related to loading
/// and unloading of test projects and loading, unloading and
/// running tests.
/// </summary>
public interface ITestEvents
{
// Events related to the loading and unloading
// of projects - including wrapper projects
// created in order to load assemblies. This
// occurs separately from the loading of tests
// for the assemblies in the project.
event TestEventHandler ProjectLoading;
event TestEventHandler ProjectLoaded;
event TestEventHandler ProjectLoadFailed;
event TestEventHandler ProjectUnloading;
event TestEventHandler ProjectUnloaded;
event TestEventHandler ProjectUnloadFailed;
// Events related to loading and unloading tests.
event TestEventHandler TestLoading;
event TestEventHandler TestLoaded;
event TestEventHandler TestLoadFailed;
event TestEventHandler TestReloading;
event TestEventHandler TestReloaded;
event TestEventHandler TestReloadFailed;
event TestEventHandler TestUnloading;
event TestEventHandler TestUnloaded;
event TestEventHandler TestUnloadFailed;
// Events related to a running a set of tests
event TestEventHandler RunStarting;
event TestEventHandler RunFinished;
// Events that arise while a test is running
// These are translated from calls to the runner on the
// EventListener interface.
event TestEventHandler SuiteStarting;
event TestEventHandler SuiteFinished;
event TestEventHandler TestStarting;
event TestEventHandler TestFinished;
/// <summary>
/// An unhandled exception was thrown during a test run,
/// and it cannot be associated with a particular test failure.
/// </summary>
event TestEventHandler TestException;
/// <summary>
/// Console Out/Error
/// </summary>
event TestEventHandler TestOutput;
}
}

View File

@@ -0,0 +1,83 @@
// ****************************************************************
// This is free software licensed under the NUnit license. You
// may obtain a copy of the license as well as information regarding
// copyright ownership at http://nunit.org/?p=license&r=2.4.
// ****************************************************************
using System;
using System.Collections;
using NUnit.Core;
namespace NUnit.Util
{
/// <summary>
/// The ITestLoader interface supports the loading and running
/// of tests in a remote domain.
/// </summary>
public interface ITestLoader
{
#region Properties
// See if a project is loaded
bool IsProjectLoaded { get; }
// See if a test has been loaded from the project
bool IsTestLoaded { get; }
// See if a test is running
bool Running { get; }
// The loaded test project
NUnitProject TestProject { get; set; }
string TestFileName { get; }
// Our last test results
TestResult TestResult { get; }
#endregion
#region Methods
// Create a new empty project using a default name
void NewProject();
// Create a new project given a filename
void NewProject( string filename );
// Load a project given a filename
void LoadProject( string filename );
// Load a project given a filename and config
void LoadProject( string filename, string configname );
// Load a project given an array of assemblies
void LoadProject( string[] assemblies );
// Unload current project
void UnloadProject();
// Load tests for current project and config
void LoadTest();
// Load a specific test for current project and config
void LoadTest( string testName );
// Unload current test
void UnloadTest();
// Reload current test
void ReloadTest();
// Run all tests
void RunTests();
// Run specific tests
void RunTests( ITestFilter filter );
// Cancel the running test
void CancelTestRun();
#endregion
}
}

View File

@@ -0,0 +1,43 @@
thisdir = nunit24/ClientUtilities/util
SUBDIRS =
include ../../../build/rules.make
LIBRARY = nunit.util.dll
LIBRARY_SNK = $(topdir)/nunit24/nunit.snk
LOCAL_MCS_FLAGS= \
/resource:Transform.resources,NUnit.Util.Transform.resources \
-r:nunit.core.dll -r:nunit.core.interfaces.dll -r:System.dll \
-r:System.Xml.dll -r:System.Runtime.Remoting.dll \
/d:MONO /d:StronglyNamedAssembly -warn:1
NO_TEST = yo
RESX_RES = Transform.resources
EXTRA_DISTFILES = \
nunit.util.dll.csproj \
nunit.util.dll_VS2005.csproj \
$(RESX_RES:.resources=.resx)
CLEAN_FILES = $(RESX_RES)
ifneq (net_2_0, $(PROFILE))
NO_INSTALL = yes
install-local: install-symlink
uninstall-local: uninstall-symlink
endif
include ../../../build/library.make
$(the_lib): $(RESX_RES)
$(RESX_RES): %.resources: %.resx
$(RESGEN) `echo $< | $(PLATFORM_CHANGE_SEPARATOR_CMD)`
symlinkdir = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)
install-symlink:
$(MKINSTALLDIRS) $(DESTDIR)$(symlinkdir)
cd $(DESTDIR)$(symlinkdir) && rm -f $(LIBRARY_NAME) && ln -s ../2.0/$(LIBRARY_NAME) $(LIBRARY_NAME)
uninstall-symlink:
rm -f $(DESTDIR)$(symlinkdir)/$(LIBRARY_NAME)

View File

@@ -0,0 +1,79 @@
// ****************************************************************
// Copyright 2007, Charlie Poole
// This is free software licensed under the NUnit license. You may
// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
// ****************************************************************
using System;
using System.Collections;
namespace NUnit.Util
{
/// <summary>
/// MemorySettingsStorage is used to hold settings for
/// the NUnit tests and also serves as the base class
/// for XmlSettingsStorage.
/// </summary>
public class MemorySettingsStorage : ISettingsStorage
{
protected Hashtable settings = new Hashtable();
#region ISettingsStorage Members
public object GetSetting(string settingName)
{
return settings[settingName];
}
public void RemoveSetting(string settingName)
{
settings.Remove( settingName );
}
public void RemoveGroup( string groupName )
{
ArrayList keysToRemove = new ArrayList();
string prefix = groupName;
if ( !prefix.EndsWith(".") )
prefix = prefix + ".";
foreach( string key in settings.Keys )
if ( key.StartsWith( prefix ) )
keysToRemove.Add( key );
foreach( string key in keysToRemove )
settings.Remove( key );
}
public void SaveSetting(string settingName, object settingValue)
{
settings[settingName] = settingValue;
}
public ISettingsStorage MakeChildStorage(string name)
{
return new MemorySettingsStorage();
}
public virtual void LoadSettings()
{
// No action required
}
public virtual void SaveSettings()
{
// No action required
}
#endregion
#region IDisposable Members
public void Dispose()
{
// TODO: Add MemorySettingsStorage.Dispose implementation
}
#endregion
}
}

View File

@@ -0,0 +1,87 @@
// ****************************************************************
// Copyright 2007, Charlie Poole
// This is free software licensed under the NUnit license. You may
// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
// ****************************************************************
using System;
using System.Collections;
using NUnit.Core;
namespace NUnit.Util
{
/// <summary>
/// Summary description for MultipleTestDomainRunner.
/// </summary>
public class MultipleTestDomainRunner : AggregatingTestRunner
{
#region Constructors
public MultipleTestDomainRunner() : base( 0 ) { }
public MultipleTestDomainRunner( int runnerID ) : base( runnerID ) { }
#endregion
#region Load Method Overrides
public override bool Load(TestPackage package)
{
this.projectName = package.FullName;
this.testName.FullName = this.testName.Name = projectName;
runners = new ArrayList();
int nfound = 0;
int index = 0;
string targetAssemblyName = null;
if( package.TestName != null && package.Assemblies.Contains( package.TestName ) )
{
targetAssemblyName = package.TestName;
package.TestName = null;
}
foreach( string assembly in package.Assemblies )
{
if ( targetAssemblyName == null || targetAssemblyName == assembly )
{
TestDomain runner = new TestDomain( this.runnerID * 100 + index + 1 );
TestPackage p = new TestPackage( assembly );
p.AutoBinPath = package.AutoBinPath;
p.ConfigurationFile = package.ConfigurationFile;
p.BasePath = package.BasePath;
p.PrivateBinPath = package.PrivateBinPath;
p.TestName = package.TestName;
foreach( object key in package.Settings.Keys )
p.Settings[key] = package.Settings[key];
if ( package.TestName == null )
{
runners.Add( runner );
if ( runner.Load( p ) )
nfound++;
}
else if ( runner.Load( p ) )
{
runners.Add( runner );
nfound++;
}
}
}
if ( package.TestName == null && targetAssemblyName == null )
return nfound == package.Assemblies.Count;
else
return nfound > 0;
}
private void CreateRunners( int count )
{
runners = new ArrayList();
for( int index = 0; index < count; index++ )
{
TestDomain runner = new TestDomain( this.runnerID * 100 + index + 1 );
runners.Add( runner );
}
}
#endregion
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,141 @@
// ****************************************************************
// This is free software licensed under the NUnit license. You
// may obtain a copy of the license as well as information regarding
// copyright ownership at http://nunit.org/?p=license&r=2.4.
// ****************************************************************
namespace NUnit.Util
{
using System;
using System.IO;
using System.Text;
using Microsoft.Win32;
/// <summary>
/// NUnitRegistry provides static properties for NUnit's
/// CurrentUser and LocalMachine subkeys.
/// </summary>
public class NUnitRegistry
{
public static readonly string KEY =
@"Software\nunit.org\Nunit\2.4";
public static readonly string LEGACY_KEY =
@"Software\Nascent Software\Nunit\";
private static bool testMode = false;
public static readonly string TEST_KEY =
@"Software\nunit.org\Nunit-Test";
/// <summary>
/// Prevent construction of object
/// </summary>
private NUnitRegistry() { }
public static bool TestMode
{
get { return testMode; }
set { testMode = value; }
}
/// <summary>
/// Registry subkey for the current user
/// </summary>
public static RegistryKey CurrentUser
{
get
{
if ( testMode )
return Registry.CurrentUser.CreateSubKey( TEST_KEY );
RegistryKey newKey = Registry.CurrentUser.OpenSubKey( KEY, true );
if (newKey == null)
{
newKey = Registry.CurrentUser.CreateSubKey( KEY );
RegistryKey oldKey = Registry.CurrentUser.OpenSubKey( LEGACY_KEY );
if ( oldKey != null )
{
CopyKey( oldKey, newKey );
oldKey.Close();
}
}
return newKey;
}
}
public static bool KeyExists( string subkey )
{
using ( RegistryKey key = Registry.CurrentUser.OpenSubKey( subkey, true ) )
{
return key != null;
}
}
/// <summary>
/// Registry subkey for the local machine
/// </summary>
public static RegistryKey LocalMachine
{
get { return Registry.LocalMachine.CreateSubKey( testMode ? TEST_KEY : KEY ); }
}
public static void ClearTestKeys()
{
ClearSubKey( Registry.CurrentUser, TEST_KEY );
//ClearSubKey( Registry.LocalMachine, TEST_KEY );
}
/// <summary>
/// Static helper method that clears out the contents of a subkey
/// </summary>
/// <param name="baseKey">Base key for the subkey</param>
/// <param name="subKey">Name of the subkey</param>
private static void ClearSubKey( RegistryKey baseKey, string subKey )
{
using( RegistryKey key = baseKey.OpenSubKey( subKey, true ) )
{
if ( key != null ) ClearKey( key );
}
}
/// <summary>
/// Static function that clears out the contents of a key
/// </summary>
/// <param name="key">Key to be cleared</param>
public static void ClearKey( RegistryKey key )
{
foreach( string name in key.GetValueNames() )
key.DeleteValue( name );
// TODO: This throws under Mono - Restore when bug is fixed
//foreach( string name in key.GetSubKeyNames() )
// key.DeleteSubKeyTree( name );
foreach (string name in key.GetSubKeyNames())
{
ClearSubKey(key, name);
key.DeleteSubKey( name );
}
}
/// <summary>
/// Static method that copies the contents of one key to another
/// </summary>
/// <param name="fromKey">The source key for the copy</param>
/// <param name="toKey">The target key for the copy</param>
public static void CopyKey( RegistryKey fromKey, RegistryKey toKey )
{
foreach( string name in fromKey.GetValueNames() )
toKey.SetValue( name, fromKey.GetValue( name ) );
foreach( string name in fromKey.GetSubKeyNames() )
using( RegistryKey fromSubKey = fromKey.OpenSubKey( name ) )
using( RegistryKey toSubKey = toKey.CreateSubKey( name ) )
{
CopyKey( fromSubKey, toSubKey );
}
}
}
}

View File

@@ -0,0 +1,209 @@
// ****************************************************************
// Copyright 2002-2003, Charlie Poole
// This is free software licensed under the NUnit license. You may
// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
// ****************************************************************
using System;
using System.IO;
using System.Text;
using System.Reflection;
using System.Collections;
using System.Runtime.InteropServices;
namespace NUnit.Util
{
/// <summary>
/// Static methods for manipulating project paths, including both directories
/// and files. Some synonyms for System.Path methods are included as well.
/// </summary>
public class PathUtils
{
public const uint FILE_ATTRIBUTE_DIRECTORY = 0x00000010;
public const uint FILE_ATTRIBUTE_NORMAL = 0x00000080;
public const int MAX_PATH = 256;
protected static char DirectorySeparatorChar = Path.DirectorySeparatorChar;
protected static char AltDirectorySeparatorChar = Path.AltDirectorySeparatorChar;
#region Public methods
public static bool IsAssemblyFileType( string path )
{
string extension = Path.GetExtension( path ).ToLower();
return extension == ".dll" || extension == ".exe";
}
/// <summary>
/// Returns the relative path from a base directory to another
/// directory or file.
/// </summary>
public static string RelativePath( string from, string to )
{
if (from == null)
throw new ArgumentNullException (from);
if (to == null)
throw new ArgumentNullException (to);
if (!Path.IsPathRooted (to))
return to;
if (Path.GetPathRoot (from) != Path.GetPathRoot (to))
return null;
string[] _from = from.Split (PathUtils.DirectorySeparatorChar,
PathUtils.AltDirectorySeparatorChar);
string[] _to = to.Split (PathUtils.DirectorySeparatorChar,
PathUtils.AltDirectorySeparatorChar);
StringBuilder sb = new StringBuilder (Math.Max (from.Length, to.Length));
int last_common, min = Math.Min (_from.Length, _to.Length);
for (last_common = 0; last_common < min; ++last_common)
{
if (!_from [last_common].Equals (_to [last_common]))
break;
}
if (last_common < _from.Length)
sb.Append ("..");
for (int i = last_common + 1; i < _from.Length; ++i)
{
sb.Append (PathUtils.DirectorySeparatorChar).Append ("..");
}
if (sb.Length > 0)
sb.Append (PathUtils.DirectorySeparatorChar);
if (last_common < _to.Length)
sb.Append (_to [last_common]);
for (int i = last_common + 1; i < _to.Length; ++i)
{
sb.Append (PathUtils.DirectorySeparatorChar).Append (_to [i]);
}
return sb.ToString ();
}
/// <summary>
/// Return the canonical form of a path.
/// </summary>
public static string Canonicalize( string path )
{
ArrayList parts = new ArrayList(
path.Split( DirectorySeparatorChar, AltDirectorySeparatorChar ) );
for( int index = 0; index < parts.Count; )
{
string part = (string)parts[index];
switch( part )
{
case ".":
parts.RemoveAt( index );
break;
case "..":
parts.RemoveAt( index );
if ( index > 0 )
parts.RemoveAt( --index );
break;
default:
index++;
break;
}
}
return String.Join( DirectorySeparatorChar.ToString(), (string[])parts.ToArray( typeof( string ) ) );
}
/// <summary>
/// True if the two paths are the same. However, two paths
/// to the same file or directory using different network
/// shares or drive letters are not treated as equal.
/// </summary>
public static bool SamePath( string path1, string path2 )
{
return string.Compare( Canonicalize(path1), Canonicalize(path2), PathUtils.IsWindows() ) == 0;
}
/// <summary>
/// True if the two paths are the same or if the second is
/// directly or indirectly under the first. Note that paths
/// using different network shares or drive letters are
/// considered unrelated, even if they end up referencing
/// the same subtrees in the file system.
/// </summary>
public static bool SamePathOrUnder( string path1, string path2 )
{
path1 = Canonicalize( path1 );
path2 = Canonicalize( path2 );
int length1 = path1.Length;
int length2 = path2.Length;
// if path1 is longer, then path2 can't be under it
if ( length1 > length2 )
return false;
// if lengths are the same, check for equality
if ( length1 == length2 )
//return path1.ToLower() == path2.ToLower();
return string.Compare( path1, path2, IsWindows() ) == 0;
// path 2 is longer than path 1: see if initial parts match
//if ( path1.ToLower() != path2.Substring( 0, length1 ).ToLower() )
if ( string.Compare( path1, path2.Substring( 0, length1 ), IsWindows() ) != 0 )
return false;
// must match through or up to a directory separator boundary
return path2[length1-1] == DirectorySeparatorChar ||
path2[length1] == DirectorySeparatorChar;
}
public static string Combine( string path1, params string[] morePaths )
{
string result = path1;
foreach( string path in morePaths )
result = Path.Combine( result, path );
return result;
}
// TODO: This logic should be in shared source
public static string GetAssemblyPath( Assembly assembly )
{
string uri = assembly.CodeBase;
// If it wasn't loaded locally, use the Location
if ( !uri.StartsWith( Uri.UriSchemeFile ) )
return assembly.Location;
return GetAssemblyPathFromFileUri( uri );
}
// Separate method for testability
public static string GetAssemblyPathFromFileUri( string uri )
{
// Skip over the file://
int start = Uri.UriSchemeFile.Length + Uri.SchemeDelimiter.Length;
if ( PathUtils.DirectorySeparatorChar == '\\' )
{
if ( uri[start] == '/' && uri[start+2] == ':' )
++start;
}
else
{
if ( uri[start] != '/' )
--start;
}
return uri.Substring( start );
}
#endregion
#region Helper Methods
private static bool IsWindows()
{
return PathUtils.DirectorySeparatorChar == '\\';
}
#endregion
}
}

View File

@@ -0,0 +1,58 @@
// ****************************************************************
// Copyright 2007, Charlie Poole
// This is free software licensed under the NUnit license. You may
// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
// ****************************************************************
using System;
using System.IO;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Proxies;
using System.Runtime.Remoting.Services;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using NUnit.Core;
namespace NUnit.Util
{
/// <summary>
/// Summary description for ProcessRunner.
/// </summary>
public class ProcessRunner : ProxyTestRunner, IDisposable
{
private TestAgent agent;
#region Constructors
public ProcessRunner() : base( 0 ) { }
public ProcessRunner( int runnerID ) : base( runnerID ) { }
#endregion
public override bool Load(TestPackage package)
{
if ( this.agent == null )
this.agent = Services.TestAgency.GetAgent( AgentType.ProcessAgent, 5000 );
if ( this.TestRunner == null )
this.TestRunner = agent.CreateRunner(this.runnerID);
return base.Load (package);
}
#region IDisposable Members
public void Dispose()
{
if ( TestRunner != null )
this.TestRunner.Unload();
if ( this.agent != null )
Services.TestAgency.ReleaseAgent(this.agent);
this.TestRunner = null;
this.agent = null;
}
#endregion
}
}

View File

@@ -0,0 +1,255 @@
// ****************************************************************
// This is free software licensed under the NUnit license. You
// may obtain a copy of the license as well as information regarding
// copyright ownership at http://nunit.org/?p=license&r=2.4.
// ****************************************************************
using System;
using System.Text;
using System.Collections;
using System.IO;
using NUnit.Core;
namespace NUnit.Util
{
public enum BinPathType
{
Auto,
Manual,
None
}
public class ProjectConfig
{
#region Instance Variables
/// <summary>
/// The name of this config
/// </summary>
private string name;
/// <summary>
/// IProject interface of containing project
/// </summary>
protected NUnitProject project = null;
/// <summary>
/// List of the names of the assemblies
/// </summary>
private AssemblyList assemblies;
/// <summary>
/// Base path specific to this configuration
/// </summary>
private string basePath;
/// <summary>
/// Our configuration file, if specified
/// </summary>
private string configFile;
/// <summary>
/// Private bin path, if specified
/// </summary>
private string binPath;
/// <summary>
/// True if assembly paths should be added to bin path
/// </summary>
private BinPathType binPathType = BinPathType.Auto;
#endregion
#region Constructor
public ProjectConfig( string name )
{
this.name = name;
this.assemblies = new AssemblyList();
assemblies.Changed += new EventHandler( assemblies_Changed );
}
#endregion
#region Properties and Events
public event EventHandler Changed;
public NUnitProject Project
{
// get { return project; }
set { project = value; }
}
public string Name
{
get { return name; }
set
{
if ( name != value )
{
name = value;
FireChangedEvent();
}
}
}
private bool BasePathSpecified
{
get
{
return project.BasePathSpecified || this.basePath != null && this.basePath != "";
}
}
/// <summary>
/// The base directory for this config - used
/// as the application base for loading tests.
/// </summary>
public string BasePath
{
get
{
if ( project == null || project.BasePath == null )
return basePath;
if ( basePath == null )
return project.BasePath;
return Path.Combine( project.BasePath, basePath );
}
set
{
if ( BasePath != value )
{
basePath = value;
FireChangedEvent();
}
}
}
/// <summary>
/// The base path relative to the project base
/// </summary>
public string RelativeBasePath
{
get
{
if ( project == null || basePath == null || !Path.IsPathRooted( basePath ) )
return basePath;
return PathUtils.RelativePath( project.BasePath, basePath );
}
}
private bool ConfigurationFileSpecified
{
get { return configFile != null; }
}
public string ConfigurationFile
{
get
{
return configFile == null && project != null
? project.ConfigurationFile
: configFile;
}
set
{
if ( ConfigurationFile != value )
{
configFile = value;
FireChangedEvent();
}
}
}
public string ConfigurationFilePath
{
get
{
return BasePath != null && ConfigurationFile != null
? Path.Combine( BasePath, ConfigurationFile )
: ConfigurationFile;
}
}
private bool PrivateBinPathSpecified
{
get { return binPath != null; }
}
/// <summary>
/// The Path.PathSeparator-separated path containing all the
/// assemblies in the list.
/// </summary>
public string PrivateBinPath
{
get { return binPath; }
set
{
if ( binPath != value )
{
binPath = value;
binPathType = binPath == null ? BinPathType.Auto : BinPathType.Manual;
FireChangedEvent();
}
}
}
/// <summary>
/// How our PrivateBinPath is generated
/// </summary>
public BinPathType BinPathType
{
get { return binPathType; }
set
{
if ( binPathType != value )
{
binPathType = value;
FireChangedEvent();
}
}
}
/// <summary>
/// Return our AssemblyList
/// </summary>
public AssemblyList Assemblies
{
get { return assemblies; }
}
#endregion
public TestPackage MakeTestPackage()
{
TestPackage package = new TestPackage( project.ProjectPath );
if ( !project.IsAssemblyWrapper )
foreach ( string assembly in this.Assemblies )
package.Assemblies.Add( assembly );
if ( this.BasePathSpecified || this.PrivateBinPathSpecified || this.ConfigurationFileSpecified )
{
package.BasePath = this.BasePath;
package.PrivateBinPath = this.PrivateBinPath;
package.ConfigurationFile = this.ConfigurationFile;
}
package.AutoBinPath = this.BinPathType == BinPathType.Auto;
return package;
}
private void assemblies_Changed( object sender, EventArgs e )
{
FireChangedEvent();
}
private void FireChangedEvent()
{
if ( Changed != null )
Changed( this, EventArgs.Empty );
}
}
}

Some files were not shown because too many files have changed in this diff Show More