Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Drochak <nickd@mono-cvs.ximian.com>2003-04-21 17:35:38 +0400
committerNick Drochak <nickd@mono-cvs.ximian.com>2003-04-21 17:35:38 +0400
commitf7fa6d289f16b2ece8589bea76cafc360b9b8270 (patch)
tree5a6168544e56c1628c0f341c43804ed159dee041 /mcs/nunit/src
parent38be1c6f5f179985e0465a0855a3561d0600d0af (diff)
003-04-20 Nick Drochak <ndrochak@gol.com>
* Remove nunit version 1 svn path=/trunk/mcs/; revision=13845
Diffstat (limited to 'mcs/nunit/src')
-rw-r--r--mcs/nunit/src/.cvsignore3
-rw-r--r--mcs/nunit/src/NUnitConsole/.cvsignore4
-rw-r--r--mcs/nunit/src/NUnitConsole/AssemblyInfo.cs55
-rwxr-xr-xmcs/nunit/src/NUnitConsole/NUnitConsole.csproj93
-rw-r--r--mcs/nunit/src/NUnitConsole/NUnitConsole.xml146
-rw-r--r--mcs/nunit/src/NUnitConsole/NUnitConsoleMain.cs35
-rw-r--r--mcs/nunit/src/NUnitConsole/TestRunner.cs277
-rw-r--r--mcs/nunit/src/NUnitConsole/list.unix3
-rw-r--r--mcs/nunit/src/NUnitConsole/makefile.gnu15
-rw-r--r--mcs/nunit/src/NUnitCore/.cvsignore4
-rw-r--r--mcs/nunit/src/NUnitCore/ActiveTestSuite.cs113
-rw-r--r--mcs/nunit/src/NUnitCore/AssemblyInfo.cs55
-rwxr-xr-xmcs/nunit/src/NUnitCore/AssemblyTestCollector.cs72
-rw-r--r--mcs/nunit/src/NUnitCore/Assertion.cs184
-rw-r--r--mcs/nunit/src/NUnitCore/AssertionFailedError.cs27
-rw-r--r--mcs/nunit/src/NUnitCore/BaseTestRunner.cs323
-rw-r--r--mcs/nunit/src/NUnitCore/ClassPathTestCollector.cs78
-rw-r--r--mcs/nunit/src/NUnitCore/ExceptionTestCase.cs53
-rw-r--r--mcs/nunit/src/NUnitCore/ExpectExceptionAttribute.cs47
-rw-r--r--mcs/nunit/src/NUnitCore/IFailureDetailView.cs21
-rw-r--r--mcs/nunit/src/NUnitCore/IProtectable.cs12
-rw-r--r--mcs/nunit/src/NUnitCore/ITest.cs18
-rw-r--r--mcs/nunit/src/NUnitCore/ITestCollector.cs16
-rw-r--r--mcs/nunit/src/NUnitCore/ITestListener.cs65
-rwxr-xr-xmcs/nunit/src/NUnitCore/ITestLoader.cs58
-rw-r--r--mcs/nunit/src/NUnitCore/ITestSuiteLoader.cs17
-rw-r--r--mcs/nunit/src/NUnitCore/LoadingTestCollector.cs54
-rwxr-xr-xmcs/nunit/src/NUnitCore/NUnitCore.csproj238
-rw-r--r--mcs/nunit/src/NUnitCore/NUnitException.cs51
-rw-r--r--mcs/nunit/src/NUnitCore/ReflectionUtils.cs94
-rw-r--r--mcs/nunit/src/NUnitCore/ReloadingTestSuiteLoader.cs33
-rw-r--r--mcs/nunit/src/NUnitCore/RepeatedTest.cs45
-rw-r--r--mcs/nunit/src/NUnitCore/SimpleTestCollector.cs28
-rwxr-xr-xmcs/nunit/src/NUnitCore/StandardLoader.cs222
-rw-r--r--mcs/nunit/src/NUnitCore/StandardTestSuiteLoader.cs47
-rw-r--r--mcs/nunit/src/NUnitCore/TestCase.cs241
-rw-r--r--mcs/nunit/src/NUnitCore/TestCaseClassLoader.cs208
-rw-r--r--mcs/nunit/src/NUnitCore/TestDecorator.cs71
-rw-r--r--mcs/nunit/src/NUnitCore/TestFailure.cs55
-rw-r--r--mcs/nunit/src/NUnitCore/TestResult.cs249
-rw-r--r--mcs/nunit/src/NUnitCore/TestSetup.cs70
-rw-r--r--mcs/nunit/src/NUnitCore/TestSuite.cs294
-rw-r--r--mcs/nunit/src/NUnitCore/Version.cs23
-rw-r--r--mcs/nunit/src/NUnitCore/list.unix32
-rw-r--r--mcs/nunit/src/NUnitCore/makefile.gnu21
-rw-r--r--mcs/nunit/src/makefile.gnu11
46 files changed, 0 insertions, 3881 deletions
diff --git a/mcs/nunit/src/.cvsignore b/mcs/nunit/src/.cvsignore
deleted file mode 100644
index 8744e149aac..00000000000
--- a/mcs/nunit/src/.cvsignore
+++ /dev/null
@@ -1,3 +0,0 @@
-.makefrag
-.response
-library-deps.stamp
diff --git a/mcs/nunit/src/NUnitConsole/.cvsignore b/mcs/nunit/src/NUnitConsole/.cvsignore
deleted file mode 100644
index 6ab3e7d65d9..00000000000
--- a/mcs/nunit/src/NUnitConsole/.cvsignore
+++ /dev/null
@@ -1,4 +0,0 @@
-.makefrag-exe
-.response-exe
-NUnit.Prefs
-NUnitConsole_mono
diff --git a/mcs/nunit/src/NUnitConsole/AssemblyInfo.cs b/mcs/nunit/src/NUnitConsole/AssemblyInfo.cs
deleted file mode 100644
index 184c24203a1..00000000000
--- a/mcs/nunit/src/NUnitConsole/AssemblyInfo.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using System;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-// Mark the framework assembly as CLS compliant
-[assembly:CLSCompliant(true)]
-
-//
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-//
-[assembly:AssemblyTitle("NUnit Testing Framework")]
-[assembly:AssemblyDescription("A unit testing framework for the .Net platform, ported from junit by Kent Beck and Erich Gamma.")]
-[assembly:AssemblyConfiguration("")]
-[assembly:AssemblyCompany("")]
-[assembly:AssemblyProduct("NUnit")]
-[assembly:AssemblyCopyright("")]
-[assembly:AssemblyTrademark("")]
-[assembly:AssemblyCulture("")]
-
-//
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Revision
-// Build Number
-//
-// You can specify all the value or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-
-[assembly:AssemblyVersion("1.11.*")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified - the assembly cannot be signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine.
-// (*) If the key file and a key name attributes are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP - that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the file is installed into the CSP and used.
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-//[assembly: AssemblyDelaySign(false)]
-//[assembly: AssemblyKeyFile(@"..\..\..\..\NUnit.key")]
-//[assembly: AssemblyKeyName("")]
diff --git a/mcs/nunit/src/NUnitConsole/NUnitConsole.csproj b/mcs/nunit/src/NUnitConsole/NUnitConsole.csproj
deleted file mode 100755
index c7376873b47..00000000000
--- a/mcs/nunit/src/NUnitConsole/NUnitConsole.csproj
+++ /dev/null
@@ -1,93 +0,0 @@
-<VisualStudioProject>
- <CSHARP
- ProjectType = "Local"
- ProductVersion = "7.0.9254"
- SchemaVersion = "1.0"
- >
- <Build>
- <Settings
- ApplicationIcon = "Logo.ico"
- AssemblyKeyContainerName = ""
- AssemblyName = "NUnitConsole"
- AssemblyOriginatorKeyFile = ""
- DefaultClientScript = "JScript"
- DefaultHTMLPageLayout = "Flow"
- DefaultTargetSchema = "IE32Nav30"
- DelaySign = "false"
- NoStandardLibraries = "false"
- OutputType = "Exe"
- RootNamespace = "NUnitConsole"
- StartupObject = ""
- >
- <Config
- Name = "Debug"
- AllowUnsafeBlocks = "false"
- BaseAddress = "0"
- CheckForOverflowUnderflow = "false"
- ConfigurationOverrideFile = ""
- DefineConstants = "DEBUG;TRACE"
- DocumentationFile = "NUnitConsole.xml"
- DebugSymbols = "true"
- FileAlignment = "4096"
- IncrementalBuild = "false"
- Optimize = "false"
- OutputPath = "bin\Debug\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "4"
- />
- <Config
- Name = "Release"
- AllowUnsafeBlocks = "false"
- BaseAddress = "0"
- CheckForOverflowUnderflow = "false"
- ConfigurationOverrideFile = ""
- DefineConstants = "TRACE"
- DocumentationFile = ""
- DebugSymbols = "false"
- FileAlignment = "4096"
- IncrementalBuild = "false"
- Optimize = "true"
- OutputPath = "bin\Release\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "4"
- />
- </Settings>
- <References>
- <Reference
- Name = "NUnitCore"
- Project = "{434945C6-B4F0-416B-AC43-2631EA091AAA}"
- Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
- Private = "True"
- />
- <Reference
- Name = "System"
- AssemblyName = "System"
- />
- </References>
- </Build>
- <Files>
- <Include>
- <File
- RelPath = "AssemblyInfo.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "NUnitConsoleMain.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "TestRunner.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- </Include>
- </Files>
- </CSHARP>
-</VisualStudioProject>
-
diff --git a/mcs/nunit/src/NUnitConsole/NUnitConsole.xml b/mcs/nunit/src/NUnitConsole/NUnitConsole.xml
deleted file mode 100644
index 7aaf89815df..00000000000
--- a/mcs/nunit/src/NUnitConsole/NUnitConsole.xml
+++ /dev/null
@@ -1,146 +0,0 @@
-<?xml version="1.0"?>
-<doc>
- <assembly>
- <name>NUnitConsole</name>
- </assembly>
- <members>
- <member name="T:NUnit.Top">
- <summary>
-
- </summary>
- </member>
- <member name="M:NUnit.Top.Main(System.String[])">
- <summary>
-
- </summary>
- <param name="args"></param>
- </member>
- <member name="T:NUnit.TextUI.TestRunner">
- <summary>A command line based tool to run tests.</summary><remarks>
- <code>
- C:\NUnitConsole.exe /t [/wait] TestCaseClass
- </code>
- TestRunner expects the name of a TestCase class as argument.
- If this class defines a static <c>Suite</c> property it
- will be invoked and the returned test is run. Otherwise all
- the methods starting with "Test" having no arguments are run.
-
- When the wait command line argument is given TestRunner
- waits until the users types RETURN.
-
- TestRunner prints a trace as the tests are executed followed by a
- summary at the end.</remarks>
- </member>
- <member name="M:NUnit.TextUI.TestRunner.#ctor">
- <summary>
- Constructs a TestRunner.
- </summary>
- </member>
- <member name="M:NUnit.TextUI.TestRunner.#ctor(System.IO.TextWriter)">
- <summary>
- Constructs a TestRunner using the given stream for all the output
- </summary>
- </member>
- <member name="M:NUnit.TextUI.TestRunner.AddError(NUnit.Framework.ITest,System.Exception)">
- <summary>
-
- </summary>
- <param name="test"></param>
- <param name="t"></param>
- </member>
- <member name="M:NUnit.TextUI.TestRunner.AddFailure(NUnit.Framework.ITest,NUnit.Framework.AssertionFailedError)">
- <summary>
-
- </summary>
- <param name="test"></param>
- <param name="t"></param>
- </member>
- <member name="M:NUnit.TextUI.TestRunner.CreateTestResult">
- <summary>Creates the TestResult to be used for the test run.</summary>
- </member>
- <member name="M:NUnit.TextUI.TestRunner.DoRun(NUnit.Framework.ITest,System.Boolean)">
- <summary>
-
- </summary>
- <param name="suite"></param>
- <param name="wait"></param>
- <returns></returns>
- </member>
- <member name="M:NUnit.TextUI.TestRunner.EndTest(NUnit.Framework.ITest)">
- <summary>
-
- </summary>
- <param name="test"></param>
- </member>
- <member name="M:NUnit.TextUI.TestRunner.GetLoader">
- <summary>
-
- </summary>
- <returns></returns>
- </member>
- <member name="M:NUnit.TextUI.TestRunner.Print(NUnit.Framework.TestResult)">
- <summary>
-
- </summary>
- <param name="result"></param>
- </member>
- <member name="M:NUnit.TextUI.TestRunner.PrintErrors(NUnit.Framework.TestResult)">
- <summary>Prints the errors to the standard output.</summary>
- </member>
- <member name="M:NUnit.TextUI.TestRunner.PrintFailures(NUnit.Framework.TestResult)">
- <summary>Prints failures to the standard output.</summary>
- </member>
- <member name="M:NUnit.TextUI.TestRunner.PrintHeader(NUnit.Framework.TestResult)">
- <summary>Prints the header of the report.</summary>
- </member>
- <member name="M:NUnit.TextUI.TestRunner.Run(System.Type)">
- <summary>Runs a Suite extracted from a TestCase subclass.</summary>
- </member>
- <member name="M:NUnit.TextUI.TestRunner.Run(NUnit.Framework.ITest)">
- <summary>
-
- </summary>
- <param name="suite"></param>
- </member>
- <member name="M:NUnit.TextUI.TestRunner.RunAndWait(NUnit.Framework.ITest)">
- <summary>Runs a single test and waits until the user
- types RETURN.</summary>
- </member>
- <member name="M:NUnit.TextUI.TestRunner.RunFailed(System.String)">
- <summary>
-
- </summary>
- <param name="message"></param>
- </member>
- <member name="M:NUnit.TextUI.TestRunner.Start(System.String[])">
- <summary>Starts a test run. Analyzes the command line arguments
- and runs the given test suite.</summary>
- </member>
- <member name="M:NUnit.TextUI.TestRunner.StartTest(NUnit.Framework.ITest)">
- <summary>
-
- </summary>
- <param name="test"></param>
- </member>
- <member name="P:NUnit.TextUI.TestRunner.Writer">
- <summary>
-
- </summary>
- </member>
- <member name="M:System.Collections.Hashtable.Synchronized(System.Collections.Hashtable)">
- <summary>
- Returns a synchronized (thread-safe)
- wrapper for the Hashtable.
- </summary>
- </member>
- <member name="M:System.Collections.Hashtable.GetHash(System.Object)">
- <summary>Returns the hash code for the specified key.</summary>
- </member>
- <member name="M:System.Collections.Hashtable.KeyEquals(System.Object,System.Object)">
- <summary>
- Compares a specific Object with a specific key
- in the Hashtable.
- </summary>
- </member>
- </members>
-</doc>
diff --git a/mcs/nunit/src/NUnitConsole/NUnitConsoleMain.cs b/mcs/nunit/src/NUnitConsole/NUnitConsoleMain.cs
deleted file mode 100644
index cf6091319d3..00000000000
--- a/mcs/nunit/src/NUnitConsole/NUnitConsoleMain.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-namespace NUnit
-{
- using System;
- using System.Collections;
- using NUnit.Framework;
- using NUnit.Runner;
- using NUnit.TextUI;
-
- /// <summary>
- ///
- /// </summary>
- public class Top
- {
- /// <summary>
- ///
- /// </summary>
- /// <param name="args"></param>
- public static void Main(string[] args)
- {
- TestRunner aTestRunner = new NUnit.TextUI.TestRunner();
- try
- {
- TestResult r = aTestRunner.Start(args);
- if (!r.WasSuccessful)
- Environment.Exit(1);
- Environment.Exit(0);
- }
- catch(Exception e)
- {
- Console.Error.WriteLine(e.Message);
- Environment.Exit(2);
- }
- }
- }
-} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitConsole/TestRunner.cs b/mcs/nunit/src/NUnitConsole/TestRunner.cs
deleted file mode 100644
index 77493e48866..00000000000
--- a/mcs/nunit/src/NUnitConsole/TestRunner.cs
+++ /dev/null
@@ -1,277 +0,0 @@
-namespace NUnit.TextUI
-{
- using System;
- using System.IO;
- using System.Reflection;
- using NUnit.Framework;
- using NUnit.Runner;
-
- /// <summary>A command line based tool to run tests.</summary><remarks>
- /// <code>
- /// C:\NUnitConsole.exe /t [/wait] TestCaseClass
- /// </code>
- /// TestRunner expects the name of a TestCase class as argument.
- /// If this class defines a static <c>Suite</c> property it
- /// will be invoked and the returned test is run. Otherwise all
- /// the methods starting with "Test" having no arguments are run.
- ///
- /// When the wait command line argument is given TestRunner
- /// waits until the users types RETURN.
- ///
- /// TestRunner prints a trace as the tests are executed followed by a
- /// summary at the end.</remarks>
- public class TestRunner : BaseTestRunner
- {
- int fColumn = 0;
- TextWriter fWriter = Console.Out;
-
- /// <summary>
- /// Constructs a TestRunner.
- /// </summary>
- public TestRunner() {}
-
- /// <summary>
- /// Constructs a TestRunner using the given stream for all the output
- /// </summary>
- public TestRunner(TextWriter writer) : this()
- {
- if (writer != null)
- {
- fWriter= writer;
- }
- else
- {
- throw new ArgumentNullException("writer");
- }
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="test"></param>
- /// <param name="t"></param>
- public override void AddError(ITest test, Exception t)
- {
- lock(this)
- this.Writer.Write("E");
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="test"></param>
- /// <param name="t"></param>
- public override void AddFailure(ITest test, AssertionFailedError t)
- {
- lock (this)
- this.Writer.Write("F");
- }
-
- /// <summary>Creates the TestResult to be used for the test run.</summary>
- protected TestResult CreateTestResult()
- {
- return new TestResult();
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="suite"></param>
- /// <param name="wait"></param>
- /// <returns></returns>
- protected TestResult DoRun(ITest suite, bool wait)
- {
- TestResult result= CreateTestResult();
- result.AddListener(this);
- long startTime= System.DateTime.Now.Ticks;
- suite.Run(result);
- long endTime= System.DateTime.Now.Ticks;
- long runTime= (endTime-startTime) / 10000;
- Writer.WriteLine();
- Writer.WriteLine("Time: "+ElapsedTimeAsString(runTime));
- Print(result);
-
- Writer.WriteLine();
-
- if (wait)
- {
- Writer.WriteLine("<RETURN> to continue");
- try
- {
- Console.ReadLine();
- }
- catch(Exception)
- {
- }
- }
- return result;
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="test"></param>
-
- public override void EndTest(ITest test)
- {
- }
- /// <summary>
- ///
- /// </summary>
- /// <returns></returns>
- public override ITestLoader GetLoader()
- {
- return new StandardLoader();
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="result"></param>
- public void Print(TestResult result)
- {
- lock(this)
- {
- PrintErrors(result);
- PrintFailures(result);
- PrintHeader(result);
- }
- }
-
- /// <summary>Prints the errors to the standard output.</summary>
- public void PrintErrors(TestResult result)
- {
- if (result.ErrorCount != 0)
- {
- if (result.ErrorCount == 1)
- Writer.WriteLine("There was "+result.ErrorCount+" error:");
- else
- Writer.WriteLine("There were "+result.ErrorCount+" errors:");
-
- int i= 1;
- foreach (TestFailure failure in result.Errors)
- {
- Writer.WriteLine(i++ + ") "+failure+"("+failure.ThrownException.GetType().ToString()+")");
- Writer.Write(GetFilteredTrace(failure.ThrownException));
- }
- }
- }
-
- /// <summary>Prints failures to the standard output.</summary>
- public void PrintFailures(TestResult result)
- {
- if (result.FailureCount != 0)
- {
- if (result.FailureCount == 1)
- Writer.WriteLine("There was " + result.FailureCount + " failure:");
- else
- Writer.WriteLine("There were " + result.FailureCount + " failures:");
- int i = 1;
- foreach (TestFailure failure in result.Failures)
- {
- Writer.Write(i++ + ") " + failure.FailedTest);
- Exception t= failure.ThrownException;
- if (t.Message != "")
- Writer.WriteLine(" \"" + Truncate(t.Message) + "\"");
- else
- {
- Writer.WriteLine();
- Writer.Write(GetFilteredTrace(failure.ThrownException));
- }
- }
- }
- }
-
- /// <summary>Prints the header of the report.</summary>
- public void PrintHeader(TestResult result)
- {
- if (result.WasSuccessful)
- {
- Writer.WriteLine();
- Writer.Write("OK");
- Writer.WriteLine (" (" + result.RunCount + " tests)");
-
- }
- else
- {
- Writer.WriteLine();
- Writer.WriteLine("FAILURES!!!");
- Writer.WriteLine("Tests Run: "+result.RunCount+
- ", Failures: "+result.FailureCount+
- ", Errors: "+result.ErrorCount);
- }
- }
-
- /// <summary>Runs a Suite extracted from a TestCase subclass.</summary>
- static public void Run(Type testClass)
- {
- Run(new TestSuite(testClass));
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="suite"></param>
- static public void Run(ITest suite)
- {
- TestRunner aTestRunner= new TestRunner();
- aTestRunner.DoRun(suite, false);
- }
-
- /// <summary>Runs a single test and waits until the user
- /// types RETURN.</summary>
- static public void RunAndWait(ITest suite)
- {
- TestRunner aTestRunner= new TestRunner();
- aTestRunner.DoRun(suite, true);
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="message"></param>
- protected override void RunFailed(string message)
- {
- Console.Error.WriteLine(message);
- Environment.ExitCode = 1;
- throw new ApplicationException(message);
- }
-
- /// <summary>Starts a test run. Analyzes the command line arguments
- /// and runs the given test suite.</summary>
- public TestResult Start(string[] args)
- {
- bool wait = false;
- string testCase = ProcessArguments(args, ref wait);
- if (testCase.Equals(""))
- throw new ApplicationException("Usage: NUnitConsole.exe [/wait] testCaseName, where\n"
- + "name is the name of the TestCase class");
-
- try
- {
- ITest suite = GetTest(testCase);
- return DoRun(suite, wait);
- }
- catch (Exception e)
- {
- throw new ApplicationException("Could not create and run test suite.", e);
- }
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="test"></param>
- public override void StartTest(ITest test)
- {
- lock (this)
- {
- Writer.Write(".");
- if (fColumn++ >= 40)
- {
- Writer.WriteLine();
- fColumn = 0;
- }
- }
- }
- /// <summary>
- ///
- /// </summary>
- protected TextWriter Writer
- {
- get { return fWriter; }
- }
- }
-}
diff --git a/mcs/nunit/src/NUnitConsole/list.unix b/mcs/nunit/src/NUnitConsole/list.unix
deleted file mode 100644
index 98d8fe5e157..00000000000
--- a/mcs/nunit/src/NUnitConsole/list.unix
+++ /dev/null
@@ -1,3 +0,0 @@
-AssemblyInfo.cs
-TestRunner.cs
-NUnitConsoleMain.cs
diff --git a/mcs/nunit/src/NUnitConsole/makefile.gnu b/mcs/nunit/src/NUnitConsole/makefile.gnu
deleted file mode 100644
index a75da4c68cf..00000000000
--- a/mcs/nunit/src/NUnitConsole/makefile.gnu
+++ /dev/null
@@ -1,15 +0,0 @@
-topdir = ../../..
-PROGRAM = $(topdir)/class/lib/NUnitConsole_mono.exe
-
-PROGRAM_LIST = list.unix
-PROGRAM_FLAGS = \
- -r $(topdir)/class/lib/corlib.dll \
- -r $(topdir)/class/lib/System.dll \
- -r $(topdir)/class/lib/NUnitCore_mono.dll
-
-include $(topdir)/class/executable.make
-
-RUNTIME=mono
-MCS = $(RUNTIME) $(topdir)/mcs/mcs.exe
-MCS_FLAGS = --target exe --noconfig
-
diff --git a/mcs/nunit/src/NUnitCore/.cvsignore b/mcs/nunit/src/NUnitCore/.cvsignore
deleted file mode 100644
index d121c44d6fa..00000000000
--- a/mcs/nunit/src/NUnitCore/.cvsignore
+++ /dev/null
@@ -1,4 +0,0 @@
-.makefrag
-.response
-library-deps.stamp
-*.dll \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/ActiveTestSuite.cs b/mcs/nunit/src/NUnitCore/ActiveTestSuite.cs
deleted file mode 100644
index cdba3b0ed9b..00000000000
--- a/mcs/nunit/src/NUnitCore/ActiveTestSuite.cs
+++ /dev/null
@@ -1,113 +0,0 @@
-namespace NUnit.Extensions
-{
- using System;
- using System.Threading;
- using NUnit.Framework;
-
- /// <summary>
- /// A TestSuite for active Tests. It runs each test in a
- /// separate thread and until all threads have terminated.
- /// -- Aarhus Radisson Scandinavian Center 11th floor
- /// </summary>
- public class ActiveTestSuite: TestSuite
- {
- private int fActiveTestDeathCount;
- /// <summary>
- ///
- /// </summary>
- /// <param name="result"></param>
- public override void Run(TestResult result)
- {
- fActiveTestDeathCount= 0;
- base.Run(result);
- WaitUntilFinished();
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="test"></param>
- /// <param name="result"></param>
- public void BaseRunTest(ITest test, TestResult result)
- {
- base.RunTest(test, result);
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="test"></param>
- /// <param name="result"></param>
- public override void RunTest(ITest test, TestResult result)
- {
- ThreadLittleHelper tlh = new ThreadLittleHelper(test, result, this);
- Thread t = new Thread(new ThreadStart(tlh.Run));
- t.Start();
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="test"></param>
- public void RunFinished(ITest test)
- {
- lock(this)
- {
- fActiveTestDeathCount++;
- Monitor.PulseAll(this);
- }
- }
- private void WaitUntilFinished()
- {
- lock(this)
- {
- while (fActiveTestDeathCount < TestCount)
- {
- try
- {
- Monitor.Wait(this);
- }
- catch (ThreadInterruptedException)
- {
- return; // TBD
- }
- }
- }
- }
- #region Nested Classes
- /// <summary>
- ///
- /// </summary>
- public class ThreadLittleHelper
- {
- private ITest fTest;
- private TestResult fResult;
- private ActiveTestSuite fSuite;
- /// <summary>
- ///
- /// </summary>
- /// <param name="test"></param>
- /// <param name="result"></param>
- /// <param name="suite"></param>
- public ThreadLittleHelper(ITest test, TestResult result,
- ActiveTestSuite suite)
- {
- fSuite = suite;
- fTest = test;
- fResult = result;
- }
- /// <summary>
- ///
- /// </summary>
- public void Run()
- {
- try
- {
- fSuite.BaseRunTest(fTest, fResult);
- }
- finally
- {
- fSuite.RunFinished(fTest);
- }
- }
- }
- #endregion
- }
-}
diff --git a/mcs/nunit/src/NUnitCore/AssemblyInfo.cs b/mcs/nunit/src/NUnitCore/AssemblyInfo.cs
deleted file mode 100644
index bd0c7b8eee4..00000000000
--- a/mcs/nunit/src/NUnitCore/AssemblyInfo.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using System;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-// Mark the framework assembly as CLS compliant
-[assembly:CLSCompliant(true)]
-
-//
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-//
-[assembly:AssemblyTitle("NUnit Testing Framework")]
-[assembly:AssemblyDescription("A unit testing framework for the .Net platform, ported from junit by Kent Beck and Erich Gamma.")]
-[assembly:AssemblyConfiguration("")]
-[assembly:AssemblyCompany("")]
-[assembly:AssemblyProduct("NUnit")]
-[assembly:AssemblyCopyright("")]
-[assembly:AssemblyTrademark("")]
-[assembly:AssemblyCulture("")]
-
-//
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Revision
-// Build Number
-//
-// You can specify all the value or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-
-[assembly:AssemblyVersion("1.11.*")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified - the assembly cannot be signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine.
-// (*) If the key file and a key name attributes are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP - that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the file is installed into the CSP and used.
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-//[assembly: AssemblyDelaySign(false)]
-//[assembly: AssemblyKeyFile(@"..\..\..\..\NUnit.key")]
-//[assembly: AssemblyKeyName("")]
diff --git a/mcs/nunit/src/NUnitCore/AssemblyTestCollector.cs b/mcs/nunit/src/NUnitCore/AssemblyTestCollector.cs
deleted file mode 100755
index 9c707c43e33..00000000000
--- a/mcs/nunit/src/NUnitCore/AssemblyTestCollector.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-using System;
-using NUnit.Framework;
-
-namespace NUnit.Runner
-{
- /// <summary>
- /// Collects the names of all classes in an assembly that are tests.
- /// </summary>
- public sealed class AssemblyTestCollector : MarshalByRefObject, ITestCollector
- {
- #region Instance Variables
- private string fAssemblyName;
- private StandardLoader fLoader;
- #endregion
-
- #region Constructors
- /// <summary>
- /// Create a new AssemblyTestCollector for the specified
- /// assembly, and uses the supplied loader to load the tests
- /// from the assembly.
- /// </summary>
- /// <param name="assemblyName">The file name of the assembly
- /// from which to load classes</param>
- /// <param name="loader">An instance if the standard loader to
- /// use for loading tests from the assembly.</param>
- public AssemblyTestCollector(string assemblyName,
- StandardLoader loader)
- {
- if(loader!=null)
- fLoader = loader;
- else
- throw new ArgumentNullException("loader");
-
- if(assemblyName != null)
- {
- fAssemblyName = assemblyName;
- }
- else
- throw new ArgumentNullException("assemblyName");
-
- }
- /// <summary>
- /// Create a new AssemblyTestCollector for the specified
- /// assembly.
- /// </summary>
- /// <param name="assemblyName">The file name of the assembly
- /// from which to load classes.</param>
- public AssemblyTestCollector(string assemblyName)
- : this(assemblyName,new StandardLoader()){}
- /// <summary>
- /// returns a System.String[] of FullNames for all test classes
- /// contained within the assembly.
- /// Implements ITestCollector.CollectTestsClassNames()
- /// </summary>
- #endregion
-
- #region ITestCollector Methods
- public string[] CollectTestsClassNames()
- {
- Type[] tests = fLoader.GetTestTypes(fAssemblyName);
- string[] ret = new string[tests.Length];
- int i=0;
- foreach (Type testType in tests)
- {
- ret[i] = testType.FullName;
- i++;
- }
- return ret;
- }
- #endregion
- }
-}
diff --git a/mcs/nunit/src/NUnitCore/Assertion.cs b/mcs/nunit/src/NUnitCore/Assertion.cs
deleted file mode 100644
index f9dbff90457..00000000000
--- a/mcs/nunit/src/NUnitCore/Assertion.cs
+++ /dev/null
@@ -1,184 +0,0 @@
-namespace NUnit.Framework
-{
- using System;
-
- /// <summary>A set of Assert methods.</summary>
- public class Assertion : MarshalByRefObject
- {
-
- /// <summary>
- /// Protect constructor since it is a static only class
- /// </summary>
- protected Assertion():base(){}
- /// <summary>
- /// Asserts that a condition is true. If it isn't it throws
- /// an <see cref="AssertionFailedError"/>.
- /// </summary>
- /// <param name="message">The message to display is the condition
- /// is false</param>
- /// <param name="condition">The evaluated condition</param>
- static public void Assert(string message, bool condition)
- {
- if (!condition)
- Assertion.Fail(message);
- }
-
- /// <summary>
- /// Asserts that a condition is true. If it isn't it throws
- /// an <see cref="AssertionFailedError"/>.
- /// </summary>
- /// <param name="condition">The evaluated condition</param>
- static public void Assert(bool condition)
- {
- Assertion.Assert(string.Empty, condition);
- }
- /// <summary>
- /// /// Asserts that two doubles are equal concerning a delta. If the
- /// expected value is infinity then the delta value is ignored.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="delta">The maximum acceptable difference between the
- /// the expected and the actual</param>
- static public void AssertEquals(double expected, double actual, double delta)
- {
- Assertion.AssertEquals(string.Empty, expected, actual, delta);
- }
- /// <summary>
- /// /// Asserts that two singles are equal concerning a delta. If the
- /// expected value is infinity then the delta value is ignored.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="delta">The maximum acceptable difference between the
- /// the expected and the actual</param>
- static public void AssertEquals(float expected, float actual, float delta)
- {
- Assertion.AssertEquals(string.Empty, expected, actual, delta);
- }
-
- /// <summary>Asserts that two objects are equal. If they are not
- /// an <see cref="AssertionFailedError"/> is thrown.</summary>
- static public void AssertEquals(Object expected, Object actual)
- {
- Assertion.AssertEquals(string.Empty, expected, actual);
- }
-
- /// <summary>Asserts that two doubles are equal concerning a delta.
- /// If the expected value is infinity then the delta value is ignored.
- /// </summary>
- static public void AssertEquals(string message, double expected,
- double actual, double delta)
- {
- // handle infinity specially since subtracting two infinite values gives
- // NaN and the following test fails
- if (double.IsInfinity(expected))
- {
- if (!(expected == actual))
- Assertion.FailNotEquals(message, expected, actual);
- }
- else if (!(Math.Abs(expected-actual) <= delta))
- Assertion.FailNotEquals(message, expected, actual);
- }
-
- /// <summary>Asserts that two floats are equal concerning a delta.
- /// If the expected value is infinity then the delta value is ignored.
- /// </summary>
- static public void AssertEquals(string message, float expected,
- float actual, float delta)
- {
- // handle infinity specially since subtracting two infinite values gives
- // NaN and the following test fails
- if (float.IsInfinity(expected))
- {
- if (!(expected == actual))
- Assertion.FailNotEquals(message, expected, actual);
- }
- else if (!(Math.Abs(expected-actual) <= delta))
- Assertion.FailNotEquals(message, expected, actual);
- }
-
- /// <summary>Asserts that two objects are equal. If they are not
- /// an <see cref="AssertionFailedError"/> is thrown.</summary>
- static public void AssertEquals(string message, Object expected, Object actual)
- {
- if (expected == null && actual == null)
- return;
- if (expected != null && expected.Equals(actual))
- return;
- Assertion.FailNotEquals(message, expected, actual);
- }
-
- /// <summary>Asserts that an object isn't null.</summary>
- static public void AssertNotNull(Object anObject)
- {
- Assertion.AssertNotNull(string.Empty, anObject);
- }
-
- /// <summary>Asserts that an object isn't null.</summary>
- static public void AssertNotNull(string message, Object anObject)
- {
- Assertion.Assert(string.Empty, anObject != null);
- }
-
- /// <summary>Asserts that an object is null.</summary>
- static public void AssertNull(Object anObject)
- {
- Assertion.AssertNull(string.Empty, anObject);
- }
-
- /// <summary>Asserts that an object is null.</summary>
- static public void AssertNull(string message, Object anObject)
- {
- Assertion.Assert(message, anObject == null);
- }
-
- /// <summary>Asserts that two objects refer to the same object. If they
- /// are not the same an <see cref="AssertionFailedError"/> is thrown.
- /// </summary>
- static public void AssertSame(Object expected, Object actual)
- {
- Assertion.AssertSame(string.Empty, expected, actual);
- }
-
- /// <summary>Asserts that two objects refer to the same object.
- /// If they are not an <see cref="AssertionFailedError"/> is thrown.
- /// </summary>
- static public void AssertSame(string message, Object expected, Object actual)
- {
- if (expected == actual)
- return;
- Assertion.FailNotSame(message, expected, actual);
- }
-
- /// <summary>Fails a test with no message.</summary>
- static public void Fail()
- {
- Assertion.Fail(string.Empty);
- }
-
- /// <summary>Fails a test with the given message.</summary>
- static public void Fail(string message)
- {
- if (message == null)
- message = string.Empty;
- throw new AssertionFailedError(message);
- }
-
- static private void FailNotEquals(string message, Object expected, Object actual)
- {
- string formatted=string.Empty;
- if (message != null)
- formatted= message+" ";
- Assertion.Fail(formatted+"expected:<"+expected+"> but was:<"+actual+">");
- }
-
- static private void FailNotSame(string message, Object expected, Object actual)
- {
- string formatted=string.Empty;
- if (message != null)
- formatted= message+" ";
- Assertion.Fail(formatted+"expected same");
- }
- }
-} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/AssertionFailedError.cs b/mcs/nunit/src/NUnitCore/AssertionFailedError.cs
deleted file mode 100644
index 9afebde079c..00000000000
--- a/mcs/nunit/src/NUnitCore/AssertionFailedError.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-namespace NUnit.Framework
-{
- using System;
- using System.Runtime.Serialization;
-
- /// <summary>
- /// Thrown when an assertion failed.
- /// </summary>
- [Serializable]
- public class AssertionFailedError : ApplicationException//NUnitException
- {
- /// <summary>
- /// Serialization Constructor
- /// </summary>
- protected AssertionFailedError(SerializationInfo info,
- StreamingContext context) : base(info,context){}
- /// <summary>
- ///
- /// </summary>
- /// <param name="message"></param>
- public AssertionFailedError (string message) : base(message) {}
-// public override bool IsAssertionFailure
-// {
-// get{return true;}
-// }
- }
-} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/BaseTestRunner.cs b/mcs/nunit/src/NUnitCore/BaseTestRunner.cs
deleted file mode 100644
index 7f3adfc6733..00000000000
--- a/mcs/nunit/src/NUnitCore/BaseTestRunner.cs
+++ /dev/null
@@ -1,323 +0,0 @@
-namespace NUnit.Runner
-{
- using System;
- using System.Collections;
- using System.Collections.Specialized;
- using System.IO;
- using System.IO.IsolatedStorage;
- using System.Reflection;
- using NUnit.Framework;
-
- /// <summary>
- /// Base class for all test runners.
- /// </summary>
- /// <remarks>
- ///
- /// </remarks>
- public abstract class BaseTestRunner: MarshalByRefObject, ITestListener
- {
- /// <summary>
- ///
- /// </summary>
- [Obsolete("Shoud be handled by a loader")]
- public static string SUITE_PROPERTYNAME="Suite";
-
- private static NameValueCollection fPreferences = new NameValueCollection();
- private static int fgMaxMessageLength = 500;
- private static bool fgFilterStack = true;
-
- private bool fLoading = true;
- /// <summary>
- ///
- /// </summary>
- public BaseTestRunner()
- {
- fPreferences = new NameValueCollection();
- fPreferences.Add("loading", "true");
- fPreferences.Add("filterstack", "true");
- ReadPreferences();
- fgMaxMessageLength = GetPreference("maxmessage", fgMaxMessageLength);
- }
-
- #region ITestListener Methods
- /// <summary>
- ///
- /// </summary>
- /// <param name="test"></param>
- /// <param name="t"></param>
- public abstract void AddError(ITest test, Exception t);
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="test"></param>
- /// <param name="t"></param>
- public abstract void AddFailure(ITest test, AssertionFailedError t);
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="test"></param>
- public abstract void EndTest(ITest test);
- #endregion
-
-#if false
- /// <summary>
- /// Clears the status message.
- /// </summary>
- protected virtual void ClearStatus()
- {
- // Belongs in the GUI TestRunner class.
- }
-#endif
- /// <summary>
- /// Returns the formatted string of the elapsed time.
- /// </summary>
- public static string ElapsedTimeAsString(long runTime)
- {
- return ((double)runTime/1000).ToString();
- }
- /// <summary>
- /// Extract the class name from a string in VA/Java style
- /// </summary>
- public static string ExtractClassName(string className)
- {
- if(className.StartsWith("Default package for"))
- return className.Substring(className.LastIndexOf(".")+1);
- return className;
- }
-
- static bool FilterLine(string line)
- {
- string[] patterns = new string[]
- {
- "NUnit.Framework.TestCase",
- "NUnit.Framework.TestResult",
- "NUnit.Framework.TestSuite",
- "NUnit.Framework.Assertion." // don't filter AssertionFailure
- };
- for (int i = 0; i < patterns.Length; i++)
- {
- if (line.IndexOf(patterns[i]) > 0)
- return true;
- }
- return false;
- }
-
- /// <summary>
- /// Filters stack frames from internal NUnit classes
- /// </summary>
- public static string FilterStack(string stack)
- {
- string pref = GetPreference("filterstack");
- if (((pref != null) && !GetPreference("filterstack").Equals("true"))
- || fgFilterStack == false)
- return stack;
-
- StringWriter sw = new StringWriter();
- StringReader sr = new StringReader(stack);
-
- try
- {
- string line;
- while ((line = sr.ReadLine()) != null)
- {
- if (!FilterLine(line))
- sw.WriteLine(line);
- }
- }
- catch (Exception)
- {
- return stack; // return the stack unfiltered
- }
- return sw.ToString();
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="t"></param>
- /// <returns></returns>
- public static string GetFilteredTrace(Exception t)
- {
- return BaseTestRunner.FilterStack(t.StackTrace);
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="key"></param>
- /// <returns></returns>
- public static string GetPreference(string key)
- {
- return fPreferences.Get(key);
- }
-
- private static int GetPreference(String key, int dflt)
- {
- String value= GetPreference(key);
- int intValue= dflt;
- if (value != null)
- {
- try
- {
- intValue= int.Parse(value);
- }
- catch (FormatException) {}
- }
- return intValue;
- }
-
- private static FileStream GetPreferencesFile()
- {
- return new IsolatedStorageFileStream("NUnit.Prefs", FileMode.OpenOrCreate);
- }
- /// <summary>
- ///
- /// </summary>
- /// <returns></returns>
- public virtual ITestLoader GetLoader()
- {
- if (UseReloadingTestSuiteLoader())
- return new UnloadingLoader();
- return new StandardLoader();
- }
-
- /// <summary>
- /// Returns the ITest corresponding to the given suite. This is
- /// a template method, subclasses override RunFailed(), ClearStatus().
- /// </summary>
- public ITest GetTest(string suiteClassName)
- {
- ITest test = null;
- try
- {
- test = LoadSuiteClass(suiteClassName);
- }
- catch (TypeLoadException e)
- {
- RunFailed(e.Message);
- return null;
- }
- catch (Exception e)
- {
- RunFailed("Error: " + e.ToString());
- return null;
- }
- //ClearStatus();
- return test;
- }
-
- /// <summary>
- /// Returns the loaded Class for a suite name.
- /// </summary>
- protected ITest LoadSuiteClass(string suiteClassName)
- {
- return GetLoader().LoadTest(suiteClassName);
- }
-
- private static void ReadPreferences()
- {
- FileStream fs= null;
- try
- {
- fs= GetPreferencesFile();
- fPreferences= new NameValueCollection(fPreferences);
- ReadPrefsFromFile(ref fPreferences, fs);
- }
- catch (IOException)
- {
- try
- {
- if (fs != null)
- fs.Close();
- }
- catch (IOException)
- {
- }
- }
- }
-
- /// <summary>
- /// Real method reads name/value pairs, populates, or maybe just
- /// deserializes...
- /// </summary>
- /// <param name="prefs"></param>
- /// <param name="fs"></param>
- private static void ReadPrefsFromFile(ref NameValueCollection prefs, FileStream fs)
- {
- }
-
- /// <summary>
- /// Override to define how to handle a failed loading of a test suite.
- /// </summary>
- protected abstract void RunFailed(string message);
-
- /// <summary>
- /// Truncates a String to the maximum length.
- /// </summary>
- /// <param name="message"></param>
- /// <returns></returns>
- public static string Truncate(string message)
- {
- if (fgMaxMessageLength != -1 && message.Length > fgMaxMessageLength)
- message = message.Substring(0, fgMaxMessageLength)+"...";
- return message;
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="test"></param>
- public abstract void StartTest(ITest test);
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="args"></param>
- /// <param name="wait"></param>
- /// <returns></returns>
- protected string ProcessArguments(string[] args, ref bool wait)
- {
- string suiteName="";
- wait = false;
- foreach (string arg in args)
- {
- if (arg.Equals("/noloading"))
- SetLoading(false);
- else if (arg.Equals("/nofilterstack"))
- fgFilterStack = false;
- else if (arg.Equals("/wait"))
- wait = true;
- else if (arg.Equals("/c"))
- suiteName= ExtractClassName(arg);
- else if (arg.Equals("/v"))
- {
- Console.Error.WriteLine("NUnit "+NUnit.Runner.Version.id()
- + " by Philip Craig");
- Console.Error.WriteLine("ported from JUnit 3.6 by Kent Beck"
- + " and Erich Gamma");
- }
- else
- suiteName = arg;
- }
- return suiteName;
- }
-
- /// <summary>
- /// Sets the loading behaviour of the test runner
- /// </summary>
- protected void SetLoading(bool enable)
- {
- fLoading = enable;
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <returns></returns>
- protected bool UseReloadingTestSuiteLoader()
- {
- return bool.TrueString.Equals( GetPreference("loading")) && fLoading;
- }
- }
-}
diff --git a/mcs/nunit/src/NUnitCore/ClassPathTestCollector.cs b/mcs/nunit/src/NUnitCore/ClassPathTestCollector.cs
deleted file mode 100644
index 0669a285c07..00000000000
--- a/mcs/nunit/src/NUnitCore/ClassPathTestCollector.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-namespace NUnit.Runner
-{
- using System;
- using System.Collections;
- using System.Collections.Specialized;
- using System.IO;
-
- /// <summary>
- /// A TestCollector that consults the
- /// class path. It considers all classes on the class path
- /// excluding classes in JARs. It leaves it up to subclasses
- /// to decide whether a class is a runnable Test.
- /// <see cref="ITestCollector"/>
- /// </summary>
- [Obsolete("Use StandardLoader or UnloadingLoader")]
- public abstract class ClassPathTestCollector : ITestCollector
- {
- /// <summary>
- ///
- /// </summary>
- public ClassPathTestCollector() {}
- /// <summary>
- ///
- /// </summary>
- /// <returns></returns>
- public string[] CollectTestsClassNames()
- {
- string classPath = Environment.GetEnvironmentVariable("Path");
- char separator= Path.PathSeparator;
- ArrayList result = new ArrayList();
- CollectFilesInRoots(classPath.Split(separator), result);
- string[] retVal = new string[result.Count];
- result.CopyTo(retVal);
- return retVal;
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="classFileName"></param>
- /// <returns></returns>
- protected string ClassNameFromFile(string classFileName)
- {
- return classFileName;
- }
-
- private void CollectFilesInRoots(string[] roots, IList result)
- {
- foreach (string directory in roots)
- {
- DirectoryInfo dirInfo=new DirectoryInfo(directory);
- if (dirInfo.Exists)
- {
- string[] files=Directory.GetFiles(dirInfo.FullName);
- foreach (string file in files)
- {
- if (IsTestClass(file))
- {
- string className=ClassNameFromFile(file);
- result.Add(className);
- }
- }
- }
- }
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="classFileName"></param>
- /// <returns></returns>
- protected virtual bool IsTestClass(string classFileName)
- {
- return
- ( classFileName.EndsWith(".dll")
- || classFileName.EndsWith(".exe"))
- && classFileName.IndexOf("Test") > 0;
- }
- }
-} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/ExceptionTestCase.cs b/mcs/nunit/src/NUnitCore/ExceptionTestCase.cs
deleted file mode 100644
index a5ae174fd61..00000000000
--- a/mcs/nunit/src/NUnitCore/ExceptionTestCase.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-namespace NUnit.Extensions
-{
- using System;
- using NUnit.Framework;
-
- /// <summary>A TestCase that expects an Exception of class fExpected
- /// to be thrown.</summary>
- /// <remarks> The other way to check that an expected exception is thrown is:
- /// <code>
- /// try {
- /// ShouldThrow();
- /// }catch (SpecialException) {
- /// return;
- /// }
- /// Assertion.Fail("Expected SpecialException");
- /// </code>
- ///
- /// To use ExceptionTestCase, create a TestCase like:
- /// <code>
- /// new ExceptionTestCase("TestShouldThrow", typeof(SpecialException));
- /// </code></remarks>
- public class ExceptionTestCase: TestCase
- {
- private readonly Type fExpected;
- /// <summary>
- ///
- /// </summary>
- /// <param name="name"></param>
- /// <param name="exception"></param>
- public ExceptionTestCase(string name, Type exception) : base(name)
- {
- fExpected= exception;
- }
-
- /// <summary>Execute the test method expecting that an Exception of
- /// class fExpected or one of its subclasses will be thrown.</summary>
- protected override void RunTest()
- {
- try
- {
- base.RunTest();
- }
- catch (Exception e)
- {
- if (fExpected.IsAssignableFrom(e.InnerException.GetType()))
- return;
- else
- throw e.InnerException;
- }
- Assertion.Fail("Expected exception " + fExpected);
- }
- }
-}
diff --git a/mcs/nunit/src/NUnitCore/ExpectExceptionAttribute.cs b/mcs/nunit/src/NUnitCore/ExpectExceptionAttribute.cs
deleted file mode 100644
index 401049da416..00000000000
--- a/mcs/nunit/src/NUnitCore/ExpectExceptionAttribute.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-namespace NUnit.Framework {
- using System;
-
- /// <summary>
- /// The given exception should be thrown by the annotated method.
- /// </summary>
- /// <remarks>
- /// To use this attribute, attach it to a method in a
- /// <see cref="TestCase"/> subclass.
- /// <example>Here is an example:
- /// <code>
- /// public class FooTest : TestCase {
- /// public ExpectExceptionTest(string name) : base(name) {}
- /// [ExpectException(typeof(ArgumentException))]
- /// [ExpectException(typeof(IndexOutOfRangeException))]
- /// public void TestBar() {
- /// throw new ArgumentException("bad argument");
- /// }
- /// }
- /// </code>
- /// </example>
- /// </remarks>
- [AttributeUsage(AttributeTargets.Method, AllowMultiple=true)]
- public class ExpectExceptionAttribute : Attribute {
- private Type expected;
- /// <summary>
- ///
- /// </summary>
- /// <param name="exceptionExpected"></param>
- public ExpectExceptionAttribute(Type exceptionExpected) {
- this.expected = exceptionExpected;
- }
- /// <summary>
- ///
- /// </summary>
- /// <returns></returns>
- public override string ToString() {
- return expected.ToString();
- }
- /// <summary>
- ///
- /// </summary>
- public Type ExceptionExpected {
- get { return expected; }
- }
- }
-}
diff --git a/mcs/nunit/src/NUnitCore/IFailureDetailView.cs b/mcs/nunit/src/NUnitCore/IFailureDetailView.cs
deleted file mode 100644
index 55553b505ad..00000000000
--- a/mcs/nunit/src/NUnitCore/IFailureDetailView.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-namespace NUnit.Runner {
-
- using System;
-
- using NUnit.Framework;
-
- /// <summary>
- /// A view to show details about a failure
- /// </summary>
- public interface IFailureDetailView {
- /// <summary>
- /// Clears the view
- /// </summary>
- void Clear();
-
- /// <summary>
- /// Shows details of a TestFailure
- /// </summary>
- void ShowFailure(TestFailure failure);
- }
-}
diff --git a/mcs/nunit/src/NUnitCore/IProtectable.cs b/mcs/nunit/src/NUnitCore/IProtectable.cs
deleted file mode 100644
index ad86136602f..00000000000
--- a/mcs/nunit/src/NUnitCore/IProtectable.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-namespace NUnit.Framework
-{
- /// <summary>
- /// An <c>IProtectable</c> can be run and can throw an Exception.
- /// </summary>
- /// <seealso cref="TestResult"/>
- public interface IProtectable
- {
- /// <summary>Run the the following method protected.</summary>
- void Protect();
- }
-} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/ITest.cs b/mcs/nunit/src/NUnitCore/ITest.cs
deleted file mode 100644
index 098f4c0f23f..00000000000
--- a/mcs/nunit/src/NUnitCore/ITest.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-namespace NUnit.Framework
-{
- /// <summary>An <c>ITest</c> can be run and collect its results.</summary>
- /// <seealso cref="TestResult"/>
- public interface ITest
- {
- /// <summary>
- /// Counts the number of test cases that will be run by this test.
- /// </summary>
- int CountTestCases { get; }
- /// <summary>
- /// Runs a test and collects its result in a
- /// <see cref="TestResult"/> instance.
- /// </summary>
- /// <param name="result"></param>
- void Run(TestResult result);
- }
-}
diff --git a/mcs/nunit/src/NUnitCore/ITestCollector.cs b/mcs/nunit/src/NUnitCore/ITestCollector.cs
deleted file mode 100644
index 40bf089be83..00000000000
--- a/mcs/nunit/src/NUnitCore/ITestCollector.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-namespace NUnit.Runner
-{
- using System;
-
- /// <summary>
- /// Collects Test classes to be presented by the TestSelector.
- /// <see foocref="TestSelector"/>
- /// </summary>
- public interface ITestCollector
- {
- /// <summary>
- /// Returns an array of FullNames for classes that are tests.
- /// </summary>
- string[] CollectTestsClassNames();
- }
-}
diff --git a/mcs/nunit/src/NUnitCore/ITestListener.cs b/mcs/nunit/src/NUnitCore/ITestListener.cs
deleted file mode 100644
index 87726ea95d4..00000000000
--- a/mcs/nunit/src/NUnitCore/ITestListener.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-namespace NUnit.Framework
-{
- using System;
-
- /// <summary>A Listener for test progress</summary>
- public interface ITestListener
- {
- /// <summary>An error occurred.</summary>
- void AddError(ITest test, Exception ex);
-
- /// <summary>A failure occurred.</summary>
- void AddFailure(ITest test, AssertionFailedError ex);
-
- /// <summary>A test ended.</summary>
- void EndTest(ITest test);
-
- /// <summary>A test started.</summary>
- void StartTest(ITest test);
- }
-#if false
- public class TestEventArgs : System.EventArgs
- {
- private readonly ITest fTest;
- public TestEventArgs(ITest test) : base()
- {
- fTest = test;
- }
- public ITest Test
- {
- get { return fTest;}
- }
- }
- public class TestErrorArgs : TestEventArgs
- {
- private readonly Exception fThrownException;
-
- public TestErrorArgs(ITest test, Exception thrownException) : base(test)
- {
- fThrownException = thrownException;
- }
-
- public TestErrorArgs(TestFailure error)
- : this(error.FailedTest,error.ThrownException){}
-
- public Exception ThrownException
- {
- get { return fThrownException;}
-
- }
- }
-
- public delegate void TestErrorHandler(TestFailure failure);
- public delegate void TestEventHandler(ITest test);
-
- public interface ITestEvents
- {
- event TestErrorHandler TestErred;
- event TestErrorHandler TestFailed;
- event TestEventHandler TestStarted;
- event TestEventHandler TestEnded;
- event TestEventHandler RunStarted;
- event TestEventHandler RunEnded;
- }
-#endif
-} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/ITestLoader.cs b/mcs/nunit/src/NUnitCore/ITestLoader.cs
deleted file mode 100755
index ed0a08ed73c..00000000000
--- a/mcs/nunit/src/NUnitCore/ITestLoader.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-namespace NUnit.Runner
-{
- using System;
- using NUnit.Framework;
- using System.Runtime.Serialization;
-
- /// <summary>
- /// Basic contract governing loading of tests
- /// </summary>
- public interface ITestLoader
- {
- /// <summary>
- /// Loads an instance of the test class specified by the name.
- /// Loadable in most cases will be an assembly qualified name.
- ///
- /// Other loaders could dynamically construct a test case from
- /// an XML file or a database record.
- /// </summary>
- ITest LoadTest(string loadableName);
-
- /// <summary>
- /// Return the name used by the loader to load an instance
- /// of the supplied test
- /// </summary>
- /// <param name="test"></param>
- /// <returns></returns>
- string GetLoadName(ITest test);
- }
-
- /// <summary>
- /// Error thrown during assembly and class loading problems
- /// </summary>
- [Serializable]
- public class LoaderException : NUnitException
- {
- /// <summary>
- /// Serialization Constructor
- /// </summary>
- protected LoaderException(SerializationInfo info,
- StreamingContext context) : base(info,context){}
- /// <summary>
- /// Standard constructor
- /// </summary>
- /// <param name="message">The error message that explains
- /// the reason for the exception</param>
- /// <param name="innerException">The exception that caused the
- /// current exception</param>
- public LoaderException(string message, Exception innerException) :
- base(message, innerException) {}
- /// <summary>
- /// Standard constructor
- /// </summary>
- /// <param name="message">The error message that explains
- /// the reason for the exception</param>
- public LoaderException(string message) :
- base(message) {}
- }
-} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/ITestSuiteLoader.cs b/mcs/nunit/src/NUnitCore/ITestSuiteLoader.cs
deleted file mode 100644
index 71f7da29f6e..00000000000
--- a/mcs/nunit/src/NUnitCore/ITestSuiteLoader.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-namespace NUnit.Runner
-{
- using System;
-
- /// <summary>
- /// An interface to define how a test suite should be loaded.
- /// </summary>
- [Obsolete("Use ILoader")]
- public interface ITestSuiteLoader
- {
- /// <summary>
- ///
- /// </summary>
- Type Load(string suiteClassName);
- //Type Reload(Type aType);
- }
-}
diff --git a/mcs/nunit/src/NUnitCore/LoadingTestCollector.cs b/mcs/nunit/src/NUnitCore/LoadingTestCollector.cs
deleted file mode 100644
index 4938ee952e9..00000000000
--- a/mcs/nunit/src/NUnitCore/LoadingTestCollector.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-namespace NUnit.Runner
-{
- using System;
- using System.Reflection;
- using NUnit.Framework;
-
- /// <summary>
- /// An implementation of a TestCollector that loads
- /// all classes on the class path and tests whether
- /// it is assignable from ITest or provides a static Suite property.
- /// <see cref="ITestCollector"/>
- /// </summary>
- [Obsolete("Use StandardLoader or UnloadingLoader")]
- public class LoadingClassPathTestCollector: ClassPathTestCollector
- {
-
- TestCaseClassLoader fLoader;
- /// <summary>
- ///
- /// </summary>
- public LoadingClassPathTestCollector()
- {
- fLoader= new TestCaseClassLoader();
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="classFileName"></param>
- /// <returns></returns>
- protected override bool IsTestClass(string classFileName)
- {
- try
- {
- if (classFileName.EndsWith(".dll") || classFileName.EndsWith(".exe"))
- {
- Type testClass= ClassFromFile(classFileName);
- return (testClass != null); //HACK: && TestCase.IsTest(testClass);
- }
- }
- catch (TypeLoadException)
- {
- }
- return false;
- }
-
- private Type ClassFromFile(string classFileName)
- {
- string className = base.ClassNameFromFile(classFileName);
- if (!fLoader.IsExcluded(className))
- return fLoader.LoadClass(className, false);
- return null;
- }
- }
-} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/NUnitCore.csproj b/mcs/nunit/src/NUnitCore/NUnitCore.csproj
deleted file mode 100755
index e53d5db8fff..00000000000
--- a/mcs/nunit/src/NUnitCore/NUnitCore.csproj
+++ /dev/null
@@ -1,238 +0,0 @@
-<VisualStudioProject>
- <CSHARP
- ProjectType = "Local"
- ProductVersion = "7.0.9466"
- SchemaVersion = "1.0"
- >
- <Build>
- <Settings
- ApplicationIcon = ""
- AssemblyKeyContainerName = ""
- AssemblyName = "NUnitCore"
- AssemblyOriginatorKeyFile = ""
- DefaultClientScript = "JScript"
- DefaultHTMLPageLayout = "Flow"
- DefaultTargetSchema = "IE32Nav30"
- DelaySign = "false"
- OutputType = "Library"
- RootNamespace = "NUnitCore"
- StartupObject = ""
- >
- <Config
- Name = "Debug"
- AllowUnsafeBlocks = "false"
- BaseAddress = "0"
- CheckForOverflowUnderflow = "false"
- ConfigurationOverrideFile = ""
- DefineConstants = "DEBUG;TRACE"
- DocumentationFile = "NUnitCore.xml"
- DebugSymbols = "true"
- FileAlignment = "4096"
- IncrementalBuild = "false"
- Optimize = "false"
- OutputPath = "bin\Debug\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "4"
- />
- <Config
- Name = "Release"
- AllowUnsafeBlocks = "false"
- BaseAddress = "0"
- CheckForOverflowUnderflow = "false"
- ConfigurationOverrideFile = ""
- DefineConstants = "TRACE"
- DocumentationFile = ""
- DebugSymbols = "false"
- FileAlignment = "4096"
- IncrementalBuild = "false"
- Optimize = "true"
- OutputPath = "bin\Release\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "4"
- />
- </Settings>
- <References>
- <Reference
- Name = "System"
- AssemblyName = "System"
- />
- <Reference
- Name = "SYSTEM.WINDOWS.FORMS"
- AssemblyName = "System.Windows.Forms"
- />
- <Reference
- Name = "System.Data"
- AssemblyName = "System.Data"
- />
- <Reference
- Name = "System.XML"
- AssemblyName = "System.Xml"
- />
- </References>
- </Build>
- <Files>
- <Include>
- <File
- RelPath = "ActiveTestSuite.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "AssemblyInfo.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "AssemblyTestCollector.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "Assertion.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "AssertionFailedError.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "BaseTestRunner.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "ClassPathTestCollector.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "ExceptionTestCase.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "ExpectExceptionAttribute.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "IFailureDetailView.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "IProtectable.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "ITest.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "ITestCollector.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "ITestListener.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "ITestLoader.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "ITestSuiteLoader.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "LoadingTestCollector.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "NUnitException.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "ReflectionUtils.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "ReloadingTestSuiteLoader.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "RepeatedTest.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "StandardLoader.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "StandardTestSuiteLoader.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "TestCase.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "TestCaseClassLoader.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "TestDecorator.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "TestFailure.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "TestResult.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "TestSetup.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "TestSuite.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "Version.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- </Include>
- </Files>
- </CSHARP>
-</VisualStudioProject>
-
diff --git a/mcs/nunit/src/NUnitCore/NUnitException.cs b/mcs/nunit/src/NUnitCore/NUnitException.cs
deleted file mode 100644
index f0273ef791f..00000000000
--- a/mcs/nunit/src/NUnitCore/NUnitException.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-namespace NUnit.Framework
-{
- using System;
- using System.Diagnostics;
- using System.Runtime.Serialization;
-
- /// <summary>
- /// Thrown when an assertion failed. Here to preserve the inner
- /// exception and hence its stack trace.
- /// </summary>
- [Serializable]
- public class NUnitException : ApplicationException
- {
- /// <summary>
- /// Serialization Constructor
- /// </summary>
- protected NUnitException(SerializationInfo info,
- StreamingContext context) : base(info,context){}
- /// <summary>
- /// Standard constructor
- /// </summary>
- /// <param name="message">The error message that explains
- /// the reason for the exception</param>
- public NUnitException(string message) : base (message){}
- /// <summary>
- /// Standard constructor
- /// </summary>
- /// <param name="message">The error message that explains
- /// the reason for the exception</param>
- /// <param name="inner">The exception that caused the
- /// current exception</param>
- public NUnitException(string message, Exception inner) :
- base(message, inner) {}
-
- /// <summary>
- /// Indicates that this exception wraps an AssertionFailedError
- /// exception
- /// </summary>
- public virtual bool IsAssertionFailure
- {
- get
- {
- AssertionFailedError inner = this.InnerException
- as AssertionFailedError;
- if(inner != null)
- return true;
- return false;
- }
- }
- }
-} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/ReflectionUtils.cs b/mcs/nunit/src/NUnitCore/ReflectionUtils.cs
deleted file mode 100644
index 491e0e7ec91..00000000000
--- a/mcs/nunit/src/NUnitCore/ReflectionUtils.cs
+++ /dev/null
@@ -1,94 +0,0 @@
-namespace NUnit.Runner
-{
-
- using System;
- using System.Collections;
- using System.Collections.Specialized;
- using System.IO;
- using System.Reflection;
-
- using NUnit.Framework;
- /// <summary>
- ///
- /// </summary>
- [Obsolete("Use Standar Loader")]
- public class ReflectionUtils
- {
- /// <summary>
- ///
- /// </summary>
- /// <param name="testClass"></param>
- /// <returns></returns>
- [Obsolete("Use Standar Loader")]
- public static bool HasTests(Type testClass)
- {
-
- PropertyInfo suiteProperty= null;
- suiteProperty = testClass.GetProperty("Suite", new Type[0]);
- if (suiteProperty == null )
- {
- // try to extract a test suite automatically
- TestSuite dummy = new TestSuite(testClass, true);
- return (dummy.CountTestCases > 0);
- }
- ITest test= null;
- try
- {
- // static property
- test= (ITest)suiteProperty.GetValue(null, new Type[0]);
- if (test == null)
- return false;
- }
- catch(Exception)
- {
- return false;
- }
- return true;
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="assemblyName"></param>
- /// <returns></returns>
- [Obsolete("Use Standar Loader")]
- public static StringCollection GetAssemblyClasses(string assemblyName)
- {
- StringCollection classNames = new StringCollection ();
- try
- {
- Assembly testAssembly = Assembly.LoadFrom(assemblyName);
-
- foreach(Type testType in testAssembly.GetExportedTypes())
- {
- if(testType.IsClass && HasTests(testType))
- {
- classNames.Add(testType.FullName);
- }
- }
- }
- catch(ReflectionTypeLoadException rcle)
- {
-
- Type[] loadedTypes = rcle.Types;
- Exception[] exceptions = rcle.LoaderExceptions;
-
- int exceptionCount = 0;
-
- for ( int i =0; i < loadedTypes.Length; i++ )
- {
- Console.Error.WriteLine("Unable to load a type because {0}", exceptions[exceptionCount] );
- exceptionCount++;
- }
- }
- catch(FileNotFoundException fnfe)
- {
- Console.Error.WriteLine(fnfe.Message);
- }
- catch(Exception e)
- {
- Console.Error.WriteLine("Error reading file {0}: {1}", assemblyName, e.Message);
- }
- return classNames;
- }
- }
-} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/ReloadingTestSuiteLoader.cs b/mcs/nunit/src/NUnitCore/ReloadingTestSuiteLoader.cs
deleted file mode 100644
index de222ed9d77..00000000000
--- a/mcs/nunit/src/NUnitCore/ReloadingTestSuiteLoader.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-namespace NUnit.Runner
-{
-
- using System;
-
- /// <summary>A TestSuite loader that can reload classes.</summary>
- [Obsolete("Use StandardLoader or UnloadingLoader")]
- public class ReloadingTestSuiteLoader: ITestSuiteLoader
- {
- /// <summary>
- ///
- /// </summary>
- /// <param name="suiteClassName"></param>
- /// <returns></returns>
- public Type Load(string suiteClassName)
- {
- // TestCaseClassLoader loader= new TestCaseClassLoader();
- // return loader.LoadClass(suiteClassName, true);
- return Type.GetType(suiteClassName, true);
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="aClass"></param>
- /// <returns></returns>
- public Type Reload(Type aClass)
- {
- // TestCaseClassLoader loader= new TestCaseClassLoader();
- // return loader.LoadClass(aClass.ToString(), true);
- return aClass;
- }
- }
-}
diff --git a/mcs/nunit/src/NUnitCore/RepeatedTest.cs b/mcs/nunit/src/NUnitCore/RepeatedTest.cs
deleted file mode 100644
index 546bed56d6e..00000000000
--- a/mcs/nunit/src/NUnitCore/RepeatedTest.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-namespace NUnit.Extensions {
-
- using System;
-
- using NUnit.Framework;
- /// <summary>A Decorator that runs a test repeatedly.</summary>
- public class RepeatedTest: TestDecorator {
- private readonly int fTimesRepeat;
- /// <summary>
- ///
- /// </summary>
- /// <param name="test"></param>
- /// <param name="repeat"></param>
- public RepeatedTest(ITest test, int repeat) : base(test) {
- if (repeat < 0) {
- throw new ArgumentOutOfRangeException("repeat", "Repetition count must be > 0");
- }
- fTimesRepeat= repeat;
- }
- /// <summary>
- ///
- /// </summary>
- public override int CountTestCases {
- get { return base.CountTestCases * fTimesRepeat; }
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="result"></param>
- public override void Run(TestResult result) {
- for (int i= 0; i < fTimesRepeat; i++) {
- if (result.ShouldStop)
- break;
- base.Run(result);
- }
- }
- /// <summary>
- ///
- /// </summary>
- /// <returns></returns>
- public override string ToString() {
- return base.ToString()+"(repeated)";
- }
- }
-}
diff --git a/mcs/nunit/src/NUnitCore/SimpleTestCollector.cs b/mcs/nunit/src/NUnitCore/SimpleTestCollector.cs
deleted file mode 100644
index e1f73ea959a..00000000000
--- a/mcs/nunit/src/NUnitCore/SimpleTestCollector.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-namespace NUnit.Runner {
-
- using System;
-
- /// <summary>
- /// An implementation of a TestCollector that considers
- /// a class to be a test class when it contains the
- /// pattern "Test" in its name
- /// <see cref="ITestCollector"/>
- /// </summary>
- public class SimpleTestCollector: ClassPathTestCollector {
- /// <summary>
- ///
- /// </summary>
- public SimpleTestCollector() {
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="classFileName"></param>
- /// <returns></returns>
- protected override bool IsTestClass(string classFileName) {
- return
- (classFileName.EndsWith(".dll") || classFileName.EndsWith(".exe")) &&
- classFileName.IndexOf("Test") > 0;
- }
- }
-} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/StandardLoader.cs b/mcs/nunit/src/NUnitCore/StandardLoader.cs
deleted file mode 100755
index 5666c56aac3..00000000000
--- a/mcs/nunit/src/NUnitCore/StandardLoader.cs
+++ /dev/null
@@ -1,222 +0,0 @@
-namespace NUnit.Runner
-{
- using System;
- using System.Collections;
- using System.Reflection;
- using NUnit.Framework;
-
- /// <summary>
- /// Same as StandardLoader.
- /// TODO: Clean up "Unloading" concepts in framework
- /// </summary>
- public class UnloadingLoader : StandardLoader{}
-
- /// <summary>
- /// TestLoader that
- /// </summary>
- public class StandardLoader : ITestLoader
- {
- #region Overidable loader implementatioons
- /// <summary>
- /// Attempts by all means possible to return a test for the given type.
- /// Check in the following order:
- /// 1. For a static Suite property, that implments ITest.
- /// 2. Tries to dynamically create a suite for the type.
- /// </summary>
- /// <param name="testClass"></param>
- /// <returns></returns>
- protected virtual ITest CoerceTestFrom(Type testClass)
- {
- try
- {
- ITest test = GetStaticSuiteProperty(testClass);
- if (test == null )
- {
- // try to extract a test suite automatically
- test = new TestSuite(testClass);
- }
- return test;
- }
- catch (Exception e)
- {
- throw new NUnitException("Error building test for class: "
- + testClass.FullName,e);
- }
- }
-
- /// <summary>
- /// Searches for the type specified by the testClassName in the
- /// specified assembly, and if found, attempts to coerce a test
- /// from the type.
- /// </summary>
- /// <param name="testClassName"></param>
- /// <param name="assemblyFileName"></param>
- /// <returns></returns>
- public virtual ITest LoadTest(string testClassName,
- string assemblyFileName)
- {
- try
- {
- return this.CoerceTestFrom(
- getAssembly(assemblyFileName).GetType(testClassName));
- }
- catch (Exception e)
- {
- throw new LoaderException("Error loading test class: "
- + testClassName + "," + assemblyFileName, e);
- }
- }
- /// <summary>
- /// Determines if a Type is a test.
- /// </summary>
- /// <param name="typeToCheck"></param>
- protected virtual bool IsTestClass(Type typeToCheck)
- {
- if(typeToCheck!=null)
- {
- if( typeToCheck.IsClass
- && typeToCheck.IsPublic
- && !typeToCheck.IsAbstract)
- {
- try
- {
- if( (typeof(ITest).IsAssignableFrom(typeToCheck)
- // Has public single string constructor
- && (typeToCheck.GetConstructor(new Type[]{typeof(string)})!=null))
- || GetStaticSuiteProperty(typeToCheck)!= null)
- {
- return true;
- }
- }
- catch(System.Security.SecurityException)
- {
- // eat security exceptions, since shouldn't
- // have errors on classes we can't access
- }
- }
- return false;
- }
- else
- {
- throw new ArgumentNullException("typeToCheck");
- }
- }
- /// <summary>
- /// Uses reflection to obtain the suite property for the Type
- /// </summary>
- /// <param name="testClass"></param>
- /// <returns>The Suite property of the Type, or null if the property
- /// does not exist</returns>
- protected virtual TestSuite GetStaticSuiteProperty(Type testClass)
- {
- if(testClass!=null)
- {
- TestSuite test = null;
- PropertyInfo suiteProperty = testClass.GetProperty("Suite"
- ,BindingFlags.Static|BindingFlags.Public
- ,Type.DefaultBinder // unknown
- ,typeof(ITest) // Itest return type
- ,Type.EmptyTypes // no parameters
- ,new ParameterModifier[0] // unknown
- );
- if (suiteProperty != null )
- {
- test = (TestSuite)suiteProperty.GetValue(null, new Object[0]);
- }
- return test;
- }
- else
- {
- throw new ArgumentNullException ("testClass");
- }
- }
- private Assembly getAssembly(string assemblyFileName)
- {
- try
- {
- return Assembly.LoadFrom(assemblyFileName);
- }
- catch(ArgumentNullException)
- {
- throw new ArgumentNullException("assemblyFileName");
- }
- }
- #endregion
-
- #region ILoader Methods
- /// <summary>
- /// Implements ILoader.GetLoadName().
- /// </summary>
- /// <param name="test"></param>
- /// <returns></returns>
- public virtual string GetLoadName(ITest test)
- {
- Type testType = test.GetType();
- if(testType.Equals(typeof(TestSuite)))
- {
- string tname = test.ToString();
- testType = Type.GetType(tname);
- }
- if(testType != null)
- return testType.FullName+","+testType.Assembly.CodeBase;
- else
- return string.Empty;
- }
- /// <summary>
- /// Implements ILoader.LoadTest().
- /// Loads an instance of the test class specified by the
- /// AssemblyQualifiedName. The assembly qualified name
- /// contains the Full Clas Name, followed by the CodeBase
- /// (file or url) of the assembly. If the class is found,
- /// the loader will attempt to return a TestSuite for the
- /// class. Trying first the static Suite property, followed
- /// by trying to dynamically create a suite for the class.
- /// </summary>
- /// <param name="assemblyQualifiedName">The qualified name
- /// for the class taking the form
- /// "Namespace.ClassName,AssemblyFileName" without the quotes.
- /// Assembly file name can be a fulied qualified path name, or
- /// a URL.</param>
- /// <returns></returns>
- public virtual ITest LoadTest(string assemblyQualifiedName)
- {
- if(assemblyQualifiedName==null)
- throw new ArgumentNullException("assemblyQualifiedName");
-
- string[] nameParts = assemblyQualifiedName.Split(new Char[]{','});
- if(nameParts.Length >= 1)
- {
- return this.LoadTest(nameParts[0].Trim(),nameParts[1].Trim());
- }
- else
- {
- throw new ArgumentException("Expected an Assembly Qualified Class"
- + " Name, containing the file name of the assembly",
- "assemblyQualifiedName");
- }
- }
- #endregion
-
- /// <summary>
- /// Examies all types in the specified assembly and returns a list of those
- /// types that can be coerced into tests.
- /// </summary>
- /// <param name="assemblyFileName"></param>
- /// <returns></returns>
- public virtual Type[] GetTestTypes(string assemblyFileName)
- {
- Assembly assembly = getAssembly(assemblyFileName);
- ArrayList Tests = new ArrayList(assembly.GetExportedTypes().Length);
- foreach(Type typeToCheck in assembly.GetExportedTypes())
- {
- if(this.IsTestClass(typeToCheck))
- {
- Tests.Add(typeToCheck);
- }
- }
- Type[] ret = new Type[Tests.Count];
- Tests.CopyTo(ret);
- return ret;
- }
- }
-} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/StandardTestSuiteLoader.cs b/mcs/nunit/src/NUnitCore/StandardTestSuiteLoader.cs
deleted file mode 100644
index ebdd9565760..00000000000
--- a/mcs/nunit/src/NUnitCore/StandardTestSuiteLoader.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-namespace NUnit.Runner
-{
- using System;
- using System.Reflection;
- using System.IO;
- using System.Security;
-
- /// <summary>
- /// The standard test suite loader. It can only load the same
- /// class once.
- /// </summary>
- [Obsolete("Use StandardLoader or UnloadingLoader")]
- public class StandardTestSuiteLoader: ITestSuiteLoader
- {
- /// <summary>
- /// Loads
- /// </summary>
- /// <param name="testClassName"></param>
- /// <returns></returns>
- public Type Load(string testClassName)
- {
- Type testClass;
- string[] classSpec=testClassName.Split(',');
- if (classSpec.Length > 1)
- {
- FileInfo dll=new FileInfo(classSpec[1]);
- if (!dll.Exists)
- throw new FileNotFoundException("File " + dll.FullName + " not found", dll.FullName);
- Assembly a = Assembly.LoadFrom(dll.FullName);
- testClass=a.GetType(classSpec[0], true);
- }
- else
- testClass = Type.GetType(testClassName, true);
- return testClass;
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="aClass"></param>
- /// <returns></returns>
- public Type Reload(Type aClass)
- {
- return aClass;
- }
- }
-} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/TestCase.cs b/mcs/nunit/src/NUnitCore/TestCase.cs
deleted file mode 100644
index e2e746394bf..00000000000
--- a/mcs/nunit/src/NUnitCore/TestCase.cs
+++ /dev/null
@@ -1,241 +0,0 @@
-namespace NUnit.Framework
-{
- using System;
- using System.Reflection;
-
- /// <summary>A test case defines the fixture to run multiple Tests.</summary>
- /// <remarks> To define a test case
- /// <list type="number">
- /// <item><description>implement a subclass of TestCase</description></item>
- /// <item><description>define instance variables that store the state
- /// of the fixture</description></item>
- /// <item><description>initialize the fixture state by overriding
- /// <c>SetUp</c></description></item>
- /// <item><description>clean-up after a test by overriding
- /// <c>TearDown</c></description></item>
- /// </list>
- /// Each test runs in its own fixture so there can be no side effects
- /// among test runs.
- /// <example>Here is an example:
- /// <code>
- /// public class MathTest: TestCase {
- /// protected double fValue1;
- /// protected double fValue2;
- ///
- /// public MathTest(string name) : base(name) {}
- ///
- /// protected override void SetUp() {
- /// fValue1= 2.0;
- /// fValue2= 3.0;
- /// }
- /// }</code>
- /// </example>
- ///
- /// For each test implement a method which interacts with the fixture.
- /// Verify the expected results with Assertions specified by calling
- /// <c>Assert</c> with a bool.
- /// <code>
- /// protected void TestAdd() {
- /// double result= fValue1 + fValue2;
- /// Assert(result == 5.0);
- /// }
- /// </code>
- /// Once the methods are defined you can run them. The framework supports
- /// both a static type safe and more dynamic way to run a test.
- /// In the static way you override the runTest method and define the method
- /// to be invoked.
- /// <code>
- /// protected class AddMathTest: TestCase {
- /// public void AddMathTest(string name) : base(name) {}
- /// protected override void RunTest() { TestAdd(); }
- /// }
- ///
- /// test test= new AddMathTest("Add");
- /// test.Run();
- /// </code>
- /// The dynamic way uses reflection to implement <c>RunTest</c>. It
- /// dynamically finds and invokes a method. In this case the name of the
- /// test case has to correspond to the test method to be run.
- /// <code>
- /// test= new MathTest("TestAdd");
- /// test.Run();
- /// </code>
- /// The Tests to be run can be collected into a <see cref="TestSuite"/>.
- /// NUnit provides different test runners which can run a test suite
- /// and collect the results.
- /// A test runner either expects a static property <c>Suite</c> as the entry
- /// point to get a test to run or it will extract the suite automatically.
- /// <code>
- /// public static ITest Suite {
- /// get {
- /// suite.AddTest(new MathTest("TestAdd"));
- /// suite.AddTest(new MathTest("TestDivideByZero"));
- /// return suite;
- /// }
- /// }
- /// </code></remarks>
- /// <seealso cref="TestResult"/>
- /// <seealso cref="TestSuite"/>
- public abstract class TestCase: Assertion, ITest
- {
- #region Instance Variables
- /// <summary>the name of the test case.</summary>
- private readonly string fName;
- #endregion
-
- #region Constructors
- /// <summary>Constructs a test case with no name.</summary>
- public TestCase() : this(String.Empty){}
-
- /// <summary>Constructs a test case with the given name.</summary>
- public TestCase(string testName)
- {
- this.fName = testName;
- }
- #endregion
-
- #region Properties
- /// <value>Counts the number of test cases executed by
- /// Run(TestResult result).</value>
- public int CountTestCases
- {
- get { return 1; }
- }
-
- /// <value>The name of the test case.</value>
- public string Name
- {
- get { return this.fName; }
- }
- #endregion
-
- #region Utility Methods
- /// <summary>Creates a default <see cref="TestResult"/> object.</summary>
- protected TestResult CreateResult()
- {
- return new TestResult();
- }
- #endregion
-
- #region Run Methods
- /// <summary>A convenience method to run this test, collecting the
- /// results with a default <see cref="TestResult"/> object.</summary>
- public TestResult Run()
- {
- TestResult result = this.CreateResult();
- this.Run(result);
- return result;
- }
-
- /// <summary>Runs the test case and collects the results in
- /// TestResult.</summary>
- public void Run(TestResult result)
- {
- result.Run(this);
- }
-
- /// <summary>Runs the bare test sequence.</summary>
- public void RunBare()
- {
- this.SetUp();
- try
- {
- this.RunTest();
- }
- finally
- {
- this.TearDown();
- }
- }
-
- /// <summary>Override to run the test and Assert its state.</summary>
- protected virtual void RunTest()
- {
- MethodInfo runMethod = GetType().GetMethod(this.Name, new Type[0]);
- if (runMethod == null)
- Assertion.Fail("Method \""+this.Name+"\" not found");
-
- if (runMethod != null && !runMethod.IsPublic)
- {
- Assertion.Fail("Method \""+this.Name+"\" should be public");
- }
-
- object[] exa =
- runMethod.GetCustomAttributes(typeof(ExpectExceptionAttribute),true);
-
- try
- {
- runMethod.Invoke(this, null);
- }
- catch (AssertionFailedError e)
- {
- throw new NUnitException("Run Error: ", e);
- }
- catch (TargetInvocationException e)
- {
- Exception inner = e.InnerException;
- if (inner is AssertionFailedError)
- {
- throw new NUnitException("Run Error: ", inner);
- }
- if (exa.Length>0)
- {
- foreach (ExpectExceptionAttribute ex in exa)
- {
- if (ex.ExceptionExpected.IsAssignableFrom(inner.GetType()))
- return;
- }
- Assertion.Fail("Unexpected Exception thrown: " + inner);
- }
- else
- {
- throw new NUnitException("Run Error: ", inner);
- }
- }
- catch (MemberAccessException e)
- {
- throw new NUnitException("", e);
- }
-
- if (exa.Length > 0)
- {
- System.Text.StringBuilder sb =
- new System.Text.StringBuilder
- ("One of these exceptions should have been thrown: ");
- bool first = true;
- foreach (ExpectExceptionAttribute ex in exa)
- {
- if(first)
- first = false;
- else
- sb.Append(", ");
- sb.Append(ex);
- }
- Assertion.Fail(sb.ToString());
- }
- }
-
- /// <summary>
- /// Sets up the fixture, for example, open a network connection.
- /// This method is called before a test is executed.
- /// </summary>
- protected virtual void SetUp() {}
- /// <summary>
- /// Tears down the fixture, for example, close a network
- /// connection. This method is called after a test is executed.
- /// </summary>
- protected virtual void TearDown() {}
- #endregion
-
- #region Overrides
- /// <summary>
- /// Returns a string representation of the test case.
- /// </summary>
- public override string ToString()
- {
- return this.Name+"("+this.GetType().ToString()+")";
- }
- #endregion
-
- }
-} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/TestCaseClassLoader.cs b/mcs/nunit/src/NUnitCore/TestCaseClassLoader.cs
deleted file mode 100644
index 80fc7e89100..00000000000
--- a/mcs/nunit/src/NUnitCore/TestCaseClassLoader.cs
+++ /dev/null
@@ -1,208 +0,0 @@
-namespace NUnit.Runner
-{
- using System;
-
- /// <summary>
- ///
- /// </summary>
- [Obsolete("Use StandardLoader or UnloadingLoader")]
- public class TestCaseClassLoader : StandardTestSuiteLoader
- {
- /// <summary>
- ///
- /// </summary>
- /// <param name="name"></param>
- /// <param name="resolve"></param>
- /// <returns></returns>
- public Type LoadClass(string name, bool resolve)
- {
- return Load(name);
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="name"></param>
- /// <returns></returns>
- public bool IsExcluded(string name)
- {
- return false;
- }
- }
-}
-
-
-#if false
-// commented out till figure out .net class reloading
-
-namespace NUnit.Runner {
-
- /**
- * A custom class loader which enables the reloading
- * of classes for each test run. The class loader
- * can be configured with a list of package paths that
- * should be excluded from loading. The loading
- * of these packages is delegated to the system class
- * loader. They will be shared across test runs.
- * <p>
- * The list of excluded package paths is specified in
- * a properties file "excluded.properties" that is located in
- * the same place as the TestCaseClassLoader class.
- * <p>
- * <b>Known limitation:</b> the TestCaseClassLoader cannot load classes
- * from jar files.
- */
-
-
- public class TestCaseClassLoader: ClassLoader {
- /** scanned class path */
- private string[] fPathItems;
- /** excluded paths */
- private string[] fExcluded= { "com.sun.", "sun."};
- /** name of excluded properties file */
- static final string EXCLUDED_FILE= "excluded.properties";
- /**
- * Constructs a TestCaseLoader. It scans the class path
- * and the excluded package paths
- */
- public TestCaseClassLoader() {
- super();
- string classPath= System.getProperty("java.class.path");
- string separator= System.getProperty("path.separator");
-
- // first pass: count elements
- StringTokenizer st= new StringTokenizer(classPath, separator);
- int i= 0;
- while (st.hasMoreTokens()) {
- st.nextToken();
- i++;
- }
- // second pass: split
- fPathItems= new string[i];
- st= new StringTokenizer(classPath, separator);
- i= 0;
- while (st.hasMoreTokens()) {
- fPathItems[i++]= st.nextToken();
- }
-
- string[] excluded= ReadExcludedPackages();
- if (excluded != null)
- fExcluded= excluded;
- }
- public java.net.URL GetResource(string name) {
- return ClassLoader.getSystemResource(name);
- }
- public InputStream GetResourceAsStream(string name) {
- return ClassLoader.getSystemResourceAsStream(name);
- }
- protected boolean IsExcluded(string name) {
- // exclude the "java" and "junit" packages.
- // They always need to be excluded so that they are loaded by the system class loader
- if (name.startsWith("java.") ||
- name.startsWith("junit.framework") ||
- name.startsWith("junit.extensions") ||
- name.startsWith("junit.util") ||
- name.startsWith("junit.ui"))
- return true;
-
- // exclude the user defined package paths
- for (int i= 0; i < fExcluded.length; i++) {
- if (name.startsWith(fExcluded[i])) {
- return true;
- }
- }
- return false;
- }
- public synchronized Class LoadClass(string name, boolean resolve)
- throws ClassNotFoundException {
-
- Class c= FindLoadedClass(name);
- if (c != null)
- return c;
- //
- // Delegate the loading of excluded classes to the
- // standard class loader.
- //
- if (IsExcluded(name)) {
- try {
- c= findSystemClass(name);
- return c;
- } catch (ClassNotFoundException e) {
- // keep searching
- }
- }
- if (c == null) {
- File file= Locate(name);
- if (file == null)
- throw new ClassNotFoundException();
- byte data[]= LoadClassData(file);
- c= defineClass(name, data, 0, data.length);
- }
- if (resolve)
- resolveClass(c);
- return c;
- }
- private byte[] LoadClassData(File f) throws ClassNotFoundException {
- try {
- //System.out.println("loading: "+f.getPath());
- FileInputStream stream= new FileInputStream(f);
-
- try {
- byte[] b= new byte[stream.available()];
- stream.read(b);
- stream.close();
- return b;
- }
- catch (IOException e) {
- throw new ClassNotFoundException();
- }
- }
- catch (FileNotFoundException e) {
- throw new ClassNotFoundException();
- }
- }
- /**
- * Locate the given file.
- * @return Returns null if file couldn't be found.
- */
- private File Locate(string fileName) {
- fileName= fileName.replace('.', '/')+".class";
- File path= null;
-
- if (fileName != null) {
- for (int i= 0; i < fPathItems.length; i++) {
- path= new File(fPathItems[i], fileName);
- if (path.exists())
- return path;
- }
- }
- return null;
- }
- private string[] ReadExcludedPackages() {
- InputStream is= getClass().GetResourceAsStream(EXCLUDED_FILE);
- if (is == null)
- return null;
- Properties p= new Properties();
- try {
- p.Load(is);
- }
- catch (IOException e) {
- return null;
- }
- Vector v= new Vector(10);
- for (Enumeration e= p.propertyNames(); e.hasMoreElements(); ) {
- string key= (string)e.nextElement();
- if (key.startsWith("excluded.")) {
- string path= p.getProperty(key);
- if (path.endsWith("*"))
- path= path.substring(0, path.length()-1);
- if (path.length() > 0)
- v.addElement(path);
- }
- }
- string[] excluded= new string[v.size()];
- for (int i= 0; i < v.size(); i++)
- excluded[i]= (string)v.elementAt(i);
- return excluded;
- }
- }
-#endif
diff --git a/mcs/nunit/src/NUnitCore/TestDecorator.cs b/mcs/nunit/src/NUnitCore/TestDecorator.cs
deleted file mode 100644
index eded1c24ba5..00000000000
--- a/mcs/nunit/src/NUnitCore/TestDecorator.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-namespace NUnit.Extensions
-{
- using System;
- using NUnit.Framework;
-
- /// <summary>A Decorator for Tests.</summary>
- /// <remarks>Use TestDecorator as the base class
- /// for defining new test decorators. TestDecorator subclasses
- /// can be introduced to add behaviour before or after a test
- /// is run.</remarks>
- public class TestDecorator: Assertion, ITest
- {
- /// <summary>
- /// A reference to the test that is being decorated
- /// </summary>
- protected readonly ITest fTest;
- /// <summary>
- /// Creates a decorator for the supplied test
- /// </summary>
- /// <param name="test">The test to be decorated</param>
- public TestDecorator(ITest test)
- {
- if(test!= null)
- {
- this.fTest= test;
- }
- else
- throw new ArgumentNullException("test");
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="result"></param>
- public virtual void Run(TestResult result)
- {
- this.BasicRun(result);
- }
- /// <summary>The basic run behaviour.</summary>
- public void BasicRun(TestResult result)
- {
- this.fTest.Run(result);
- }
- /// <summary>
- ///
- /// </summary>
- public virtual int CountTestCases
- {
- get { return fTest.CountTestCases; }
- }
- /// <summary>
- ///
- /// </summary>
- public ITest GetTest
- {
- get { return fTest; }
- }
- //public string Name
- //{
- // get{return fTest.Name;}
- //}
-
- /// <summary>
- ///
- /// </summary>
- /// <returns></returns>
- public override string ToString()
- {
- return fTest.ToString();
- }
- }
-} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/TestFailure.cs b/mcs/nunit/src/NUnitCore/TestFailure.cs
deleted file mode 100644
index 4dad5bd02bd..00000000000
--- a/mcs/nunit/src/NUnitCore/TestFailure.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-namespace NUnit.Framework
-{
- using System;
- using System.Diagnostics;
- using System.IO;
- using System.Text;
-
- /// <summary>
- /// A <c>TestFailure</c> collects a failed test together with
- /// the caught exception.
- /// </summary>
- /// <seealso cref="TestResult"/>
- public class TestFailure : MarshalByRefObject
- {
- private readonly ITest fFailedTest;
- private readonly Exception fThrownException;
-
- /// <summary>
- /// Constructs a TestFailure with the given test and exception.
- /// </summary>
- public TestFailure(ITest theFailedTest, Exception theThrownException)
- {
- if(theFailedTest==null)
- throw new ArgumentNullException("theFailedTest");
- if(theThrownException==null)
- throw new ArgumentNullException("theThrownException");
- this.fFailedTest = theFailedTest;
- this.fThrownException = theThrownException;
- }
-
- /// <value>Gets the failed test.</value>
- public ITest FailedTest
- {
- get { return this.fFailedTest; }
- }
-
- /// <value>True if it's a failure, false if error.</value>
- public bool IsFailure
- {
- get { return this.fThrownException is AssertionFailedError; }
- }
-
- /// <value>Gets the thrown exception.</value>
- public Exception ThrownException
- {
- get { return this.fThrownException; }
- }
-
- /// <summary>Returns a short description of the failure.</summary>
- public override string ToString()
- {
- return this.fFailedTest + ": " + this.fThrownException.Message;
- }
- }
-} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/TestResult.cs b/mcs/nunit/src/NUnitCore/TestResult.cs
deleted file mode 100644
index ff274a8c4ff..00000000000
--- a/mcs/nunit/src/NUnitCore/TestResult.cs
+++ /dev/null
@@ -1,249 +0,0 @@
-namespace NUnit.Framework
-{
- using System;
- using System.Collections;
- using System.Threading;
-
- /// <summary>A <c>TestResult</c> collects the results of executing
- /// a test case. It is an instance of the Collecting Parameter pattern.
- /// </summary><remarks>
- /// The test framework distinguishes between failures and errors.
- /// A failure is anticipated and checked for with assertions. Errors are
- /// unanticipated problems like an <c>ArgumentOutOfRangeException</c>.
- /// </remarks><seealso cref="ITest"/>
- public class TestResult : MarshalByRefObject
- {
- #region Instance Variables
- private ArrayList fFailures;
- private ArrayList fErrors;
- private ArrayList fListeners;
- private int fRunTests;
- private bool fStop;
- #endregion
-
- #region Constructors
- /// <summary>
- ///
- /// </summary>
- public TestResult()
- {
- fFailures= new ArrayList();
- fErrors= new ArrayList();
- fListeners= new ArrayList();
- }
- #endregion
-
- #region Collection Methods
- /// <summary>
- /// Adds an error to the list of errors. The passed in exception
- /// caused the error.
- /// </summary>
- public void AddError(ITest test, Exception error)
- {
- lock(this)
- {
- this.fErrors.Add(new TestFailure(test, error));
- foreach (ITestListener listner in CloneListeners())
- {
- listner.AddError(test, error);
- }
- }
- }
- /// <summary>
- /// Adds a failure to the list of failures. The passed in
- /// exception caused the failure.
- /// </summary>
- public void AddFailure(ITest test, AssertionFailedError failure)
- {
- lock(this)
- {
- fFailures.Add(new TestFailure(test, failure));
- foreach (ITestListener listner in CloneListeners())
- {
- listner.AddFailure(test, failure);
- }
- }
- }
- #endregion
-
- #region Events
- /// <summary>Registers a TestListener.</summary>
- public void AddListener(ITestListener listener)
- {
- lock(this)
- this.fListeners.Add(listener);
- }
- /// <summary>Unregisters a TestListener</summary>
- public void RemoveListener(ITestListener listener)
- {
- lock(this)
- {
- fListeners.Remove(listener);
- }
- }
- /// <summary>Returns a copy of the listeners.</summary>
- private ArrayList CloneListeners()
- {
- lock(this)
- {
- return (ArrayList)fListeners.Clone();
- }
- }
- /// <summary>Informs the result that a test was completed.</summary>
- public void EndTest(ITest test)
- {
- foreach (ITestListener listner in CloneListeners())
- {
- listner.EndTest(test);
- }
- }
- /// <summary>Informs the result that a test will be started.</summary>
- public void StartTest(ITest test)
- {
- lock(this)
- {
- this.fRunTests += test.CountTestCases;
- }
- foreach (ITestListener listner in CloneListeners())
- {
- listner.StartTest(test);
- }
- }
- #endregion
-
- #region Properties
- /// <value>Gets the number of run tests.</value>
- public int RunCount
- {
- get {lock(this)return this.fRunTests; }
- }
- /// <value>Gets the number of detected errors.</value>
- public int ErrorCount
- {
- get {lock(this)return this.fErrors.Count; }
- }
- /// <value>Gets the number of detected failures.</value>
- public int FailureCount
- {
- get {lock(this)return this.fFailures.Count; }
- }
- /// <summary>Checks whether the test run should stop.</summary>
- public bool ShouldStop
- {
- get {lock(this)return this.fStop; }
- }
- /// <value>Returns whether the entire test was successful or not.</value>
- public bool WasSuccessful
- {
- get
- {
- lock(this)
- {
- return (this.FailureCount == 0)
- && (this.ErrorCount == 0);
- }
- }
- }
- /// <value>Returns a TestFailure[] for the errors.</value>
- public TestFailure[] Errors
- {
- get
- {
- lock(this)
- {
- TestFailure[] retVal = new TestFailure[this.fErrors.Count];
- this.fErrors.CopyTo(retVal);
- return retVal;
- }
- }
- }
- /// <value>Returns a TestFauiler[] for the failures.</value>
- public TestFailure[] Failures
- {
- get
- {
- lock(this)
- {
- TestFailure[] retVal = new TestFailure[this.fFailures.Count];
- this.fFailures.CopyTo(retVal);
- return retVal;
- }
- }
- }
- #endregion
-
- #region Nested Classes
- /// <summary>Runs a TestCase.</summary>
- protected class ProtectedProtect: IProtectable
- {
- private TestCase fTest;
- /// <summary>
- ///
- /// </summary>
- /// <param name="test"></param>
- public ProtectedProtect(TestCase test)
- {
- if(test != null)
- {
- this.fTest = test;
- }
- else
- {
- throw new ArgumentNullException("test");
- }
- }
- /// <summary>
- ///
- /// </summary>
- public void Protect()
- {
- this.fTest.RunBare();
- }
- }
- #endregion
-
- #region Run Methods
- /// <summary>Runs a TestCase.</summary>
- internal void Run(TestCase test)
- {
- StartTest(test);
- IProtectable p = new ProtectedProtect(test);
- RunProtected(test, p);
- EndTest(test);
- }
-
- /// <summary>Runs a TestCase.</summary>
- public void RunProtected(ITest test, IProtectable p)
- {
- try
- {
- p.Protect();
- }
- catch (AssertionFailedError e)
- {
- AddFailure(test, e);
- }
- catch (NUnitException e)
- {
- if (e.IsAssertionFailure)
- AddFailure(test, (AssertionFailedError)e.InnerException);
- else
- AddError(test, e.InnerException);
- }
- catch (ThreadAbortException e)
- { // don't catch by accident
- throw e;
- }
- catch (System.Exception e)
- {
- AddError(test, e);
- }
- }
- /// <summary>Marks that the test run should stop.</summary>
- public void Stop()
- {
- fStop= true;
- }
- #endregion
- }
-} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/TestSetup.cs b/mcs/nunit/src/NUnitCore/TestSetup.cs
deleted file mode 100644
index 95823504015..00000000000
--- a/mcs/nunit/src/NUnitCore/TestSetup.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-namespace NUnit.Extensions
-{
- using System;
- using NUnit.Framework;
-
- /// <summary>A Decorator to set up and tear down additional fixture state.
- /// </summary><remarks>
- /// Subclass TestSetup and insert it into your tests when you want
- /// to set up additional state once before the tests are run.</remarks>
- public class TestSetup: TestDecorator
- {
- #region Constructors
- /// <summary>
- ///
- /// </summary>
- /// <param name="test"></param>
- public TestSetup(ITest test) : base(test) {}
- #endregion
-
- #region Nested Classes
- /// <summary>
- ///
- /// </summary>
- protected class ProtectedProtect: IProtectable
- {
- private readonly TestSetup fTestSetup;
- private readonly TestResult fTestResult;
- /// <summary>
- ///
- /// </summary>
- /// <param name="testSetup"></param>
- /// <param name="testResult"></param>
- public ProtectedProtect(TestSetup testSetup, TestResult testResult)
- {
- if(testSetup == null)
- throw new ArgumentNullException("testSetup");
- if(testResult == null)
- throw new ArgumentNullException("testResult");
- this.fTestSetup = testSetup;
- this.fTestResult = testResult;
- }
- /// <summary>
- ///
- /// </summary>
- void IProtectable.Protect()
- {
- this.fTestSetup.SetUp();
- this.fTestSetup.BasicRun(fTestResult);
- this.fTestSetup.TearDown();
- }
- }
- #endregion
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="result"></param>
- public override void Run(TestResult result)
- {
- IProtectable p = new ProtectedProtect(this, result);
- result.RunProtected(this, p);
- }
- /// <summary>Sets up the fixture. Override to set up additional fixture
- /// state.</summary>
- protected virtual void SetUp() {}
- /// <summary>Tears down the fixture. Override to tear down the additional
- /// fixture state.</summary>
- protected virtual void TearDown() {}
- }
-}
diff --git a/mcs/nunit/src/NUnitCore/TestSuite.cs b/mcs/nunit/src/NUnitCore/TestSuite.cs
deleted file mode 100644
index ea40612de16..00000000000
--- a/mcs/nunit/src/NUnitCore/TestSuite.cs
+++ /dev/null
@@ -1,294 +0,0 @@
-namespace NUnit.Framework
-{
- using System;
- using System.Collections;
- using System.Collections.Specialized;
- using System.Reflection;
-
- /// <summary>A <c>TestSuite</c> is a <c>Composite</c> of Tests.</summary>
- /// <remarks>It runs a collection of test cases. Here is an example using
- /// the dynamic test definition.
- /// <code>
- /// TestSuite suite= new TestSuite();
- /// suite.AddTest(new MathTest("TestAdd"));
- /// suite.AddTest(new MathTest("TestDivideByZero"));
- /// </code>
- /// Alternatively, a TestSuite can extract the Tests to be run automatically.
- /// To do so you pass the class of your TestCase class to the
- /// TestSuite constructor.
- /// <code>
- /// TestSuite suite= new TestSuite(typeof(MathTest));
- /// </code>
- /// This constructor creates a suite with all the methods
- /// starting with "Test" that take no arguments.</remarks>
- /// <seealso cref="ITest"/>
- public class TestSuite: MarshalByRefObject, ITest
- {
- #region Instance Variables
- private ArrayList fTests= new ArrayList(10);
- private string fName;
- private bool fSupressWarnings = false;
- private string fDynamicConstructionQualifiedName= string.Empty;
-
- #endregion
-
- #region Constructors
- /// <summary>Constructs an empty TestSuite with a name.</summary>
- public TestSuite(string name)
- {
- if(name == null)
- this.fName = String.Empty;
- else
- this.fName = name;
- }
-
- /// <summary>Constructs an empty TestSuite with no name.</summary>
- public TestSuite() : this(String.Empty){}
-
- /// <summary>Constructs a TestSuite from the given class.</summary>
- /// <remarks>Adds all the methods starting with "Test" as test cases
- /// to the suite. Parts of this method was written at 2337 meters in
- /// the Hüffihütte, Kanton Uri</remarks>
- /// <param name="theClass"></param>
- /// <param name="supressWarnings"></param>
- public TestSuite(Type theClass, bool supressWarnings) :
- this(theClass.FullName)
- {
- this.fSupressWarnings = supressWarnings;
- //REFACTOR: these checks are also found in AssemblyTestCollector
- if( theClass.IsClass
- && (theClass.IsPublic || theClass.IsNestedPublic)
- && !theClass.IsAbstract
- && typeof(ITest).IsAssignableFrom(theClass)
- )
- {
- ConstructorInfo FixtureConstructor = GetConstructor(theClass);
- if(FixtureConstructor != null)
- {
- {
- MethodInfo[] methods = theClass.GetMethods(
- BindingFlags.Public
- |BindingFlags.NonPublic
- |BindingFlags.Instance
- );
- foreach (MethodInfo method in methods)
- {
- AddTestMethod(method, FixtureConstructor);
- }
- if (this.fTests.Count == 0)
- AddWarning("No Tests found in "+theClass.ToString());
- }
- }
- else
- {
- AddWarning("Class "+theClass.Name
- +" has no public constructor TestCase(String name)");
- }
- }
- else
- {
- AddWarning("Type '" + theClass.Name
- +"' must be a public, not abstract class that"
- +" implements ITest.");
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="theClass"></param>
- public TestSuite(Type theClass) : this(theClass,false){}
- #endregion
-
- #region Collection Methods
- /// <summary>Adds a test to the suite.</summary>
- public void AddTest(ITest test)
- {
- fTests.Add(test);
- }
-
- /// <summary>Adds the tests from the given class to the suite</summary>
- public void AddTestSuite(Type testClass)
- {
- AddTest(new TestSuite(testClass));
- }
- #endregion
-
- #region Dynamic Test Case Creation
- //private void AddTestMethod(MethodInfo m, StringCollection names,
- private void AddTestMethod(MethodInfo m,
- ConstructorInfo constructor)
- {
- string name = m.Name;
- if (IsPublicTestMethod(m))
- {
- Object[] args= new Object[]{name};
- try
- {
- AddTest((ITest)constructor.Invoke(args));
- }
- catch (TypeLoadException e)
- {
- AddWarning("Cannot instantiate test case: "+name + "( " + e.ToString() + ")");
- }
- catch (TargetInvocationException e)
- {
- AddWarning("Exception in constructor: "+name + "( " + e.ToString() + ")");
- }
- catch (MemberAccessException e)
- {
- AddWarning("Cannot access test case: "+name + "( " + e.ToString() + ")");
- }
- }
- else
- { // almost a test method
- if (IsTestMethod(m))
- AddWarning("test method isn't public: "+m.Name);
- }
- }
-
- /// <summary>Gets a constructor which takes a single string as
- /// its argument.</summary>
- private ConstructorInfo GetConstructor(Type theClass)
- {
- //REFACTOR: these checks are also found in AssemblyTestCollector
- return theClass.GetConstructor(new Type[]{typeof(string)});
- }
-
- private bool IsPublicTestMethod(MethodInfo methodToCheck)
- {
- return methodToCheck.IsPublic
- && IsTestMethod(methodToCheck);
- }
-
- private bool IsTestMethod(MethodInfo methodToCheck)
- {
- return
- !methodToCheck.IsAbstract
- && methodToCheck.GetParameters().Length == 0
- && methodToCheck.ReturnType.Equals(typeof(void))
- && methodToCheck.Name.ToLower().StartsWith("test")
- ;
- }
- #endregion
-
- #region Properties
- /// <summary>
- /// Returns the name of the suite. Not all test suites have a name
- /// and this method can return null.
- /// </summary>
- public string Name
- {
- get { return this.fName; }
- }
-
- /// <summary>
- /// The number of test cases that will be run by this test.
- /// </summary>
- public int CountTestCases
- {
- get
- {
- int count= 0;
- foreach (ITest test in this.Tests)
- {
- count += test.CountTestCases;
- }
- return count;
- }
- }
-
- /// <value>The number of Tests in this suite.</value>
- public int TestCount
- {
- get {return this.fTests.Count; }
- }
-
- /// <value>The test at the given index.</value>
- /// <remarks>Formerly TestAt(int).</remarks>
- public ITest this[int index]
- {
- get {return (ITest)this.fTests[index]; }
- }
-
- /// <value>The Tests as a Test[].</value>
- public ITest[] Tests
- {
- get {
- ITest[] ret = new ITest[this.fTests.Count];
- this.fTests.CopyTo(ret);
- return ret;
- }
- }
- #endregion
-
- #region Utility Methods
- private void AddWarning(string message)
- {
- if(!this.fSupressWarnings)
- AddTest(new WarningFail(message));
- }
- #endregion
-
- #region Run Methods
- /// <summary>Runs the Tests and collects their result in a
- /// TestResult.</summary>
- public virtual void Run(TestResult result)
- {
- foreach (ITest test in Tests)
- {
- if (result.ShouldStop )
- break;
- RunTest(test, result);
- }
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="test"></param>
- /// <param name="result"></param>
- public virtual void RunTest(ITest test, TestResult result)
- {
- test.Run(result);
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <returns></returns>
- #endregion
-
- #region Overrides
- public override string ToString()
- {
- return this.Name;
- }
- #endregion
-
- #region Nested Classes
- /// <summary>A test which will fail and log a warning
- /// message.</summary>
- public class WarningFail : TestCase
- {
- private string fMessage;
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="message"></param>
- public WarningFail(string message): base("warning")
- {
- this.fMessage = message;
- }
-
- /// <summary>
- ///
- /// </summary>
- protected override void RunTest()
- {
- Assertion.Fail(fMessage);
- }
- }
- #endregion
- }
-}
diff --git a/mcs/nunit/src/NUnitCore/Version.cs b/mcs/nunit/src/NUnitCore/Version.cs
deleted file mode 100644
index bc7770df126..00000000000
--- a/mcs/nunit/src/NUnitCore/Version.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-namespace NUnit.Runner
-{
- using System.Reflection;
- /// <summary>
- /// This class defines the current version of NUnit
- /// </summary>
- public class Version
- {
- private Version()
- {
- // don't instantiate
- }
- /// <summary>
- ///
- /// </summary>
- /// <returns></returns>
- public static string id()
- {
- return Assembly.GetExecutingAssembly().GetName().Version.ToString();
- //return "1.10";
- }
- }
-}
diff --git a/mcs/nunit/src/NUnitCore/list.unix b/mcs/nunit/src/NUnitCore/list.unix
deleted file mode 100644
index feea26597ff..00000000000
--- a/mcs/nunit/src/NUnitCore/list.unix
+++ /dev/null
@@ -1,32 +0,0 @@
-ActiveTestSuite.cs
-AssemblyInfo.cs
-AssemblyTestCollector.cs
-Assertion.cs
-AssertionFailedError.cs
-BaseTestRunner.cs
-ClassPathTestCollector.cs
-ExceptionTestCase.cs
-ExpectExceptionAttribute.cs
-IFailureDetailView.cs
-IProtectable.cs
-ITestCollector.cs
-ITest.cs
-ITestListener.cs
-ITestLoader.cs
-ITestSuiteLoader.cs
-LoadingTestCollector.cs
-NUnitException.cs
-ReflectionUtils.cs
-ReloadingTestSuiteLoader.cs
-RepeatedTest.cs
-SimpleTestCollector.cs
-StandardLoader.cs
-StandardTestSuiteLoader.cs
-TestCaseClassLoader.cs
-TestCase.cs
-TestDecorator.cs
-TestFailure.cs
-TestResult.cs
-TestSetup.cs
-TestSuite.cs
-Version.cs
diff --git a/mcs/nunit/src/NUnitCore/makefile.gnu b/mcs/nunit/src/NUnitCore/makefile.gnu
deleted file mode 100644
index 479f03cd1e4..00000000000
--- a/mcs/nunit/src/NUnitCore/makefile.gnu
+++ /dev/null
@@ -1,21 +0,0 @@
-topdir = ../../..
-
-LIBRARY = $(topdir)/class/lib/NUnitCore_mono.dll
-
-LIB_LIST = list.unix
-LIB_FLAGS = -r corlib -r System
-
-SOURCES_INCLUDE=*.cs
-SOURCES_EXCLUDE=\
- SimpleTestCollector.cs \
- ClassPathTestCollector.cs \
- ReflectionUtils.cs \
- ITestSuiteLoader.cs \
- LoadingTestCollector.cs \
- ReloadingTestSuiteLoader.cs \
- StandardTestSuiteLoader.cs \
- TestCaseClassLoader.cs
-
-MONO_PATH=$(topdir)/class/lib
-
-include $(topdir)/class/library.make
diff --git a/mcs/nunit/src/makefile.gnu b/mcs/nunit/src/makefile.gnu
deleted file mode 100644
index ee1cb2f3669..00000000000
--- a/mcs/nunit/src/makefile.gnu
+++ /dev/null
@@ -1,11 +0,0 @@
-DIRS = NUnitCore NUnitConsole
-
-default: all
-
-all install clean:
- @for i in $(DIRS) ; do \
- if [ -d "$$i" ] && [ -f "$$i/makefile.gnu" ] ; then \
- $(MAKE) -C $$i -f makefile.gnu $@ || exit 1; \
- fi \
- done
-