Add Nunit2
authorNick Drochak <nickd@mono-cvs.ximian.com>
Mon, 9 Dec 2002 14:39:22 +0000 (14:39 -0000)
committerNick Drochak <nickd@mono-cvs.ximian.com>
Mon, 9 Dec 2002 14:39:22 +0000 (14:39 -0000)
svn path=/trunk/mcs/; revision=9480

50 files changed:
mcs/nunit20/framework/AssemblyInfo.cs [new file with mode: 0755]
mcs/nunit20/framework/Assertion.cs [new file with mode: 0755]
mcs/nunit20/framework/AssertionException.cs [new file with mode: 0755]
mcs/nunit20/framework/AssertionFailureMessage.cs [new file with mode: 0755]
mcs/nunit20/framework/ConsoleWriter.cs [new file with mode: 0755]
mcs/nunit20/framework/EventListener.cs [new file with mode: 0755]
mcs/nunit20/framework/ExpectedExceptionAttribute.cs [new file with mode: 0755]
mcs/nunit20/framework/ExpectedExceptionTestCase.cs [new file with mode: 0755]
mcs/nunit20/framework/IgnoreAttribute.cs [new file with mode: 0755]
mcs/nunit20/framework/InvalidFixture.cs [new file with mode: 0755]
mcs/nunit20/framework/InvalidSuiteException.cs [new file with mode: 0755]
mcs/nunit20/framework/InvalidTestFixtureException.cs [new file with mode: 0755]
mcs/nunit20/framework/LongLivingMarshalByRefObject.cs [new file with mode: 0755]
mcs/nunit20/framework/NoTestFixturesException.cs [new file with mode: 0755]
mcs/nunit20/framework/NormalTestCase.cs [new file with mode: 0755]
mcs/nunit20/framework/NotRunnableTestCase.cs [new file with mode: 0755]
mcs/nunit20/framework/NullListener.cs [new file with mode: 0755]
mcs/nunit20/framework/NunitException.cs [new file with mode: 0755]
mcs/nunit20/framework/OldTestCase.cs [new file with mode: 0755]
mcs/nunit20/framework/RemoteTestRunner.cs [new file with mode: 0755]
mcs/nunit20/framework/ResultSummarizer.cs [new file with mode: 0755]
mcs/nunit20/framework/ResultVisitor.cs [new file with mode: 0755]
mcs/nunit20/framework/Results.xsd [new file with mode: 0755]
mcs/nunit20/framework/Results.xsx [new file with mode: 0755]
mcs/nunit20/framework/SetUpAttribute.cs [new file with mode: 0755]
mcs/nunit20/framework/StackTraceFilter.cs [new file with mode: 0755]
mcs/nunit20/framework/SuiteAttribute.cs [new file with mode: 0755]
mcs/nunit20/framework/Summary.xslt [new file with mode: 0755]
mcs/nunit20/framework/SummaryVisitor.cs [new file with mode: 0755]
mcs/nunit20/framework/TearDownAttribute.cs [new file with mode: 0755]
mcs/nunit20/framework/TemplateTestCase.cs [new file with mode: 0755]
mcs/nunit20/framework/Test.cs [new file with mode: 0755]
mcs/nunit20/framework/TestAttribute.cs [new file with mode: 0755]
mcs/nunit20/framework/TestCase.cs [new file with mode: 0755]
mcs/nunit20/framework/TestCaseBuilder.cs [new file with mode: 0755]
mcs/nunit20/framework/TestCaseResult.cs [new file with mode: 0755]
mcs/nunit20/framework/TestDomain.cs [new file with mode: 0755]
mcs/nunit20/framework/TestFixtureAttribute.cs [new file with mode: 0755]
mcs/nunit20/framework/TestFixtureSetUpAttribute.cs [new file with mode: 0755]
mcs/nunit20/framework/TestFixtureTearDownAttribute.cs [new file with mode: 0755]
mcs/nunit20/framework/TestInfo.cs [new file with mode: 0755]
mcs/nunit20/framework/TestResult.cs [new file with mode: 0755]
mcs/nunit20/framework/TestSuite.cs [new file with mode: 0755]
mcs/nunit20/framework/TestSuiteBuilder.cs [new file with mode: 0755]
mcs/nunit20/framework/TestSuiteResult.cs [new file with mode: 0755]
mcs/nunit20/framework/Transform.resx [new file with mode: 0755]
mcs/nunit20/framework/WarningSuite.cs [new file with mode: 0755]
mcs/nunit20/framework/XmlResultVisitor.cs [new file with mode: 0755]
mcs/nunit20/framework/makefile.gnu [new file with mode: 0755]
mcs/nunit20/framework/nunit.framework.dll.csproj [new file with mode: 0755]

diff --git a/mcs/nunit20/framework/AssemblyInfo.cs b/mcs/nunit20/framework/AssemblyInfo.cs
new file mode 100755 (executable)
index 0000000..16bd384
--- /dev/null
@@ -0,0 +1,63 @@
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+[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("")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]                
+
+//
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers 
+// by using the '*' as shown below:
+
+[assembly: AssemblyVersion("2.0.9.001")]
+
+//
+// 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 is not signed.
+//   (*) KeyName refers to a key that has been installed in the Crypto Service
+//       Provider (CSP) on your machine. KeyFile refers to a file which contains
+//       a key.
+//   (*) If the KeyFile and the KeyName values 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 KeyFile is installed into the CSP and used.
+//   (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
+//       When specifying the KeyFile, the location of the KeyFile should be
+//       relative to the project output directory which is
+//       %Project Directory%\obj\<configuration>. For example, if your KeyFile is
+//       located in the project directory, you would specify the AssemblyKeyFile 
+//       attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
+//   (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
+//       documentation for more information on this.
+//
+#if !StronglyNamedAssembly
+[assembly: AssemblyDelaySign(false)]
+#else
+[assembly: AssemblyKeyFile("..\\..\\..\\Nunit.key")]
+[assembly: AssemblyKeyName("")]
+#endif
diff --git a/mcs/nunit20/framework/Assertion.cs b/mcs/nunit20/framework/Assertion.cs
new file mode 100755 (executable)
index 0000000..f563c0b
--- /dev/null
@@ -0,0 +1,305 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Framework 
+{
+       using System;
+
+       /// <summary>A set of Assert methods.</summary>
+       public class Assertion
+       {
+               /// <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);
+               }
+
+               static public void AssertEquals(int expected, int actual) 
+               {
+                       Assertion.AssertEquals(string.Empty, expected, actual);
+               }
+
+               static public void AssertEquals(string message, int expected, int actual) 
+               {
+                       if (expected != actual)
+                               Assertion.FailNotEquals(message, 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>
+        /// Checks the type of the object, returning true if
+        /// the object is a numeric type.
+        /// </summary>
+        /// <param name="obj"></param>
+        /// <returns></returns>
+        static private bool IsNumericType( Object obj )
+        {
+            if( null != obj )
+            {
+                if( obj is byte    ) return true;
+                if( obj is sbyte   ) return true;
+                if( obj is decimal ) return true;
+                if( obj is double  ) return true;
+                if( obj is float   ) return true;
+                if( obj is int     ) return true;
+                if( obj is uint    ) return true;
+                if( obj is long    ) return true;
+                if( obj is short   ) return true;
+                if( obj is ushort  ) return true;
+
+                if( obj is System.Byte    ) return true;
+                if( obj is System.SByte   ) return true;
+                if( obj is System.Decimal ) return true;
+                if( obj is System.Double  ) return true;
+                if( obj is System.Single  ) return true;
+                if( obj is System.Int32   ) return true;
+                if( obj is System.UInt32  ) return true;
+                if( obj is System.Int64   ) return true;
+                if( obj is System.UInt64  ) return true;
+                if( obj is System.Int16   ) return true;
+                if( obj is System.UInt16  ) return true;
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// Used to compare numeric types.  Comparisons between
+        /// same types are fine (Int32 to Int32, or Int64 to Int64),
+        /// but the Equals method fails across different types.
+        /// This method was added to allow any numeric type to
+        /// be handled correctly, by using <c>ToString</c> and
+        /// comparing the result
+        /// </summary>
+        /// <param name="expected"></param>
+        /// <param name="actual"></param>
+        /// <returns></returns>
+        static private bool ObjectsEqual( Object expected, Object actual )
+        {
+            if( IsNumericType( expected )  &&
+                IsNumericType( actual ) )
+            {
+                //
+                // Convert to strings and compare result to avoid
+                // issues with different types that have the same
+                // value
+                //
+                string sExpected = expected.ToString();
+                string sActual   = actual.ToString();
+                return sExpected.Equals( sActual );
+            }
+            return expected.Equals(actual);
+        }
+
+               /// <summary>
+               /// Asserts that two objects are equal.  Two objects are considered
+               /// equal if both are null, or if both have the same value.  Numeric
+               /// types are compared via string comparision on their contents to
+               /// avoid problems comparing values between different types.  All
+               /// non-numeric types are compared by using the <c>Equals</c> method.
+               /// If they are not equal 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 && actual != null )
+            {
+                if( ObjectsEqual( expected, 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(message, 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 AssertionException(message);
+               }
+
+        /// <summary>
+        /// Called when two objects have been compared and found to be
+        /// different.
+        /// </summary>
+        /// <param name="message"></param>
+        /// <param name="expected"></param>
+        /// <param name="actual"></param>
+               static private void FailNotEquals(string message, Object expected, Object actual) 
+               {
+            Assertion.Fail( 
+                AssertionFailureMessage.FormatMessageForFailNotEquals( 
+                    message, 
+                    expected, 
+                    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/nunit20/framework/AssertionException.cs b/mcs/nunit20/framework/AssertionException.cs
new file mode 100755 (executable)
index 0000000..dfec811
--- /dev/null
@@ -0,0 +1,68 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Framework 
+{
+       using System;
+       using System.Runtime.Serialization;
+       
+       /// <summary>
+       /// Thrown when an assertion failed.
+       /// </summary>
+       /// 
+       [Serializable]
+       public class AssertionException : System.Exception
+       {
+               /// <summary>
+               /// 
+               /// </summary>
+               /// <param name="message"></param>
+               public AssertionException (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 AssertionException(string message, Exception inner) :
+                       base(message, inner) 
+               {}
+
+               /// <summary>
+               /// Serialization Constructor
+               /// </summary>
+               protected AssertionException(SerializationInfo info, 
+                       StreamingContext context) : base(info,context)
+               {}
+
+       }
+}
diff --git a/mcs/nunit20/framework/AssertionFailureMessage.cs b/mcs/nunit20/framework/AssertionFailureMessage.cs
new file mode 100755 (executable)
index 0000000..e1891da
--- /dev/null
@@ -0,0 +1,570 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig, Douglas de la Torre
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2001 Douglas de la Torre
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' Copyright © 2000-2002 Philip A. Craig, or Copyright © 2001 Douglas de la Torre
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+using System;
+using System.Text;
+
+namespace NUnit.Framework
+{
+       /// <summary>
+       /// Summary description for AssertionFailureMessage.
+       /// </summary>
+       public class AssertionFailureMessage
+       {
+        /// <summary>
+        /// Protected constructor, used since this class is only used via
+        /// static methods
+        /// </summary>
+               protected AssertionFailureMessage() 
+               {}
+
+        /// <summary>
+        /// Number of characters before a highlighted position before
+        /// clipping will occur.  Clipped text is replaced with an
+        /// elipses "..."
+        /// </summary>
+        static protected int PreClipLength
+        {
+            get
+            {
+                return 35;
+            }
+        }
+
+        /// <summary>
+        /// Number of characters after a highlighted position before
+        /// clipping will occur.  Clipped text is replaced with an
+        /// elipses "..."
+        /// </summary>
+        static protected int PostClipLength
+        {
+            get
+            {
+                return 35;
+            }
+        }   
+
+        /// <summary>
+        /// Called to test if the position will cause clipping
+        /// to occur in the early part of a string.
+        /// </summary>
+        /// <param name="iPosition"></param>
+        /// <returns></returns>
+        static private bool IsPreClipped( int iPosition )
+        {
+            if( iPosition > PreClipLength )
+            {
+                return true;
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// Called to test if the position will cause clipping
+        /// to occur in the later part of a string past the
+        /// specified position.
+        /// </summary>
+        /// <param name="sString"></param>
+        /// <param name="iPosition"></param>
+        /// <returns></returns>
+        static private bool IsPostClipped( string sString, int iPosition )
+        {
+            if( sString.Length - iPosition > PostClipLength )
+            {
+                return true;
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// Property called to insert newline characters into a string
+        /// </summary>
+        static private string NewLine
+        {
+            get
+            {
+                return "\r\n";
+            }
+        }
+
+        /// <summary>
+        /// Renders up to M characters before, and up to N characters after
+        /// the specified index position.  If leading or trailing text is
+        /// clipped, and elipses "..." is added where the missing text would
+        /// be.
+        /// 
+        /// Clips strings to limit previous or post newline characters,
+        /// since these mess up the comparison
+        /// </summary>
+        /// <param name="sString"></param>
+        /// <param name="iPosition"></param>
+        /// <returns></returns>
+        static protected string ClipAroundPosition( string sString, int iPosition )
+        {
+            if( null == sString || 0 == sString.Length )
+            {
+                return "";
+            }
+
+            return BuildBefore( sString, iPosition ) + BuildAfter(  sString, iPosition );
+        }
+
+        /// <summary>
+        /// Clips the string before the specified position, and appends
+        /// ellipses (...) to show that clipping has occurred 
+        /// </summary>
+        /// <param name="sString"></param>
+        /// <param name="iPosition"></param>
+        /// <returns></returns>
+        static protected string PreClip( string sString, int iPosition )
+        {
+            return "..." + sString.Substring( iPosition - PreClipLength, PreClipLength );
+        }
+
+        /// <summary>
+        /// Clips the string after the specified position, and appends
+        /// ellipses (...) to show that clipping has occurred 
+        /// </summary>
+        /// <param name="sString"></param>
+        /// <param name="iPosition"></param>
+        /// <returns></returns>
+        static protected string PostClip( string sString, int iPosition )
+        {
+            return sString.Substring( iPosition, PostClipLength ) + "...";
+        }
+
+        /// <summary>
+        /// Builds the first half of a string, limiting the number of
+        /// characters before the position, and removing newline
+        /// characters.  If the leading string is truncated, the
+        /// ellipses (...) characters are appened.
+        /// </summary>
+        /// <param name="sString"></param>
+        /// <param name="iPosition"></param>
+        /// <returns></returns>
+        static private string BuildBefore( string sString, int iPosition )
+        {
+            if( IsPreClipped(iPosition) )
+            {
+                return PreClip( sString, iPosition );
+            }
+            return sString.Substring( 0, iPosition );
+        }
+
+        /// <summary>
+        /// Builds the last half of a string, limiting the number of
+        /// characters after the position, and removing newline
+        /// characters.  If the string is truncated, the
+        /// ellipses (...) characters are appened.
+        /// </summary>
+        /// <param name="sString"></param>
+        /// <param name="iPosition"></param>
+        /// <returns></returns>
+        static private string BuildAfter( string sString, int iPosition )
+        {
+            if( IsPostClipped(sString, iPosition) )
+            {
+                return PostClip( sString, iPosition );
+            }
+            return sString.Substring( iPosition );
+        }
+
+        /// <summary>
+        /// Text that is rendered for the expected value
+        /// </summary>
+        /// <returns></returns>
+        static protected string ExpectedText()
+        {
+            return "expected:<";
+        }
+
+        /// <summary>
+        /// Text rendered for the actual value.  This text should
+        /// be the same length as the Expected text, so leading
+        /// spaces should pad this string to ensure they match.
+        /// </summary>
+        /// <returns></returns>
+        static protected string ButWasText()
+        {
+            return " but was:<";
+        }
+
+        /// <summary>
+        /// Raw line that communicates the expected value, and the actual value
+        /// </summary>
+        /// <param name="sbOutput"></param>
+        /// <param name="expected"></param>
+        /// <param name="actual"></param>
+        static protected void AppendExpectedAndActual( StringBuilder sbOutput, Object expected, Object actual )
+        {
+            sbOutput.Append( NewLine );
+            sbOutput.Append( ExpectedText() );
+            sbOutput.Append( (expected != null) ? expected : "(null)" );
+            sbOutput.Append( ">" );
+            sbOutput.Append( NewLine );
+            sbOutput.Append( ButWasText() );
+            sbOutput.Append( (actual != null) ? actual : "(null)" );
+            sbOutput.Append( ">" );
+        }
+
+        /// <summary>
+        /// Draws a marker under the expected/actual strings that highlights
+        /// where in the string a mismatch occurred.
+        /// </summary>
+        /// <param name="sbOutput"></param>
+        /// <param name="iPosition"></param>
+        static protected void AppendPositionMarker( StringBuilder sbOutput, int iPosition )
+        {
+            sbOutput.Append( new String( '-', ButWasText().Length ) );
+            if( iPosition > 0 )
+            {
+                sbOutput.Append( new string( '-', iPosition ) );
+            }
+            sbOutput.Append( "^" );
+        }
+
+        /// <summary>
+        /// Tests two objects to determine if they are strings.
+        /// </summary>
+        /// <param name="expected"></param>
+        /// <param name="actual"></param>
+        /// <returns></returns>
+        static protected bool InputsAreStrings( Object expected, Object actual )
+        {
+            if( null != expected  &&
+                null != actual    &&
+                expected is string &&
+                actual   is string )
+            {
+                return true;
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// Tests if two strings are different lengths.
+        /// </summary>
+        /// <param name="sExpected"></param>
+        /// <param name="sActual"></param>
+        /// <returns>True if string lengths are different</returns>
+        static protected bool LengthsDifferent( string sExpected, string sActual )
+        {
+            if( sExpected.Length != sActual.Length )
+            {
+                return true;
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// Used to construct a message when the lengths of two strings are
+        /// different.  Also includes the strings themselves, to allow them
+        /// to be compared visually.
+        /// </summary>
+        /// <param name="sbOutput"></param>
+        /// <param name="sExpected"></param>
+        /// <param name="sActual"></param>
+        static protected void BuildLengthsDifferentMessage( StringBuilder sbOutput, string sExpected, string sActual )
+        {
+            BuildContentDifferentMessage( sbOutput, sExpected, sActual );
+        }
+
+        /// <summary>
+        /// Reports the length of two strings that are different lengths
+        /// </summary>
+        /// <param name="sbOutput"></param>
+        /// <param name="sExpected"></param>
+        /// <param name="sActual"></param>
+        static protected void BuildStringLengthDifferentReport( StringBuilder sbOutput, string sExpected, string sActual )
+        {
+            sbOutput.Append( "String lengths differ.  Expected length=" );
+            sbOutput.Append( sExpected.Length );
+            sbOutput.Append( ", but was length=" );
+            sbOutput.Append( sActual.Length );
+            sbOutput.Append( "." );
+            sbOutput.Append( NewLine );
+        }
+
+        /// <summary>
+        /// Reports the length of two strings that are the same length
+        /// </summary>
+        /// <param name="sbOutput"></param>
+        /// <param name="sExpected"></param>
+        /// <param name="sActual"></param>
+        static protected void BuildStringLengthSameReport(  StringBuilder sbOutput, string sExpected, string sActual )
+        {
+            sbOutput.Append( "String lengths are both " );
+            sbOutput.Append( sExpected.Length );
+            sbOutput.Append( "." );
+            sbOutput.Append( NewLine );
+        }
+
+        /// <summary>
+        /// Reports whether the string lengths are the same or different, and
+        /// what the string lengths are.
+        /// </summary>
+        /// <param name="sbOutput"></param>
+        /// <param name="sExpected"></param>
+        /// <param name="sActual"></param>
+        static protected void BuildStringLengthReport( StringBuilder sbOutput, string sExpected, string sActual )
+        {
+            if( sExpected.Length != sActual.Length )
+            {
+                BuildStringLengthDifferentReport( sbOutput, sExpected, sActual );
+            }
+            else
+            {
+                BuildStringLengthSameReport( sbOutput, sExpected, sActual );
+            }
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="sbOutput"></param>
+        /// <param name="sExpected"></param>
+        /// <param name="sActual"></param>
+        /// <param name="iPosition"></param>
+        static private void BuildContentDifferentAtPosition( StringBuilder sbOutput, string sExpected, string sActual, int iPosition )
+        {
+            BuildStringLengthReport( sbOutput, sExpected, sActual );
+
+            sbOutput.Append( "Strings differ at index " );
+            sbOutput.Append( iPosition );
+            sbOutput.Append( "." );
+            sbOutput.Append( NewLine );
+
+            //
+            // Clips the strings, then turns any hidden whitespace into visible
+            // characters
+            //
+            string sClippedExpected = ConvertWhitespace(ClipAroundPosition( sExpected, iPosition ));
+            string sClippedActual   = ConvertWhitespace(ClipAroundPosition( sActual,   iPosition ));
+
+            AppendExpectedAndActual( 
+                sbOutput, 
+                sClippedExpected, 
+                sClippedActual );
+            sbOutput.Append( NewLine );
+
+            // Add a line showing where they differ.  If the string lengths are
+            // different, they start differing just past the length of the 
+            // shorter string
+            AppendPositionMarker( 
+                sbOutput, 
+                FindMismatchPosition( sClippedExpected, sClippedActual, 0 ) );
+            sbOutput.Append( NewLine );
+        }
+
+        /// <summary>
+        /// Turns CR, LF, or TAB into visual indicator to preserve visual marker 
+               /// position.   This is done by replacing the '\r' into '\\' and 'r' 
+               /// characters, and the '\n' into '\\' and 'n' characters, and '\t' into
+               /// '\\' and 't' characters.  
+               /// 
+               /// Thus the single character becomes two characters for display.
+        /// </summary>
+        /// <param name="sInput"></param>
+        /// <returns></returns>
+        static protected string ConvertWhitespace( string sInput )
+        {
+            if( null != sInput )
+            {
+                sInput = sInput.Replace( "\r", "\\r" );
+                sInput = sInput.Replace( "\n", "\\n" );
+                               sInput = sInput.Replace( "\t", "\\t" );
+                       }
+            return sInput;
+        }
+
+        /// <summary>
+        /// Shows the position two strings start to differ.  Comparison 
+        /// starts at the start index.
+        /// </summary>
+        /// <param name="sExpected"></param>
+        /// <param name="sActual"></param>
+        /// <param name="iStart"></param>
+        /// <returns>-1 if no mismatch found, or the index where mismatch found</returns>
+        static private int FindMismatchPosition( string sExpected, string sActual, int iStart )
+        {
+            int iLength = Math.Min( sExpected.Length, sActual.Length );
+            for( int i=iStart; i<iLength; i++ )
+            {
+                //
+                // If they mismatch at a specified position, report the
+                // difference.
+                //
+                if( sExpected[i] != sActual[i] )
+                {
+                    return i;
+                }
+            }
+            //
+            // Strings have same content up to the length of the shorter string.
+            // Mismatch occurs because string lengths are different, so show
+            // that they start differing where the shortest string ends
+            //
+            if( sExpected.Length != sActual.Length )
+            {
+                return iLength;
+            }
+            
+            //
+            // Same strings
+            //
+            Assertion.Assert( sExpected.Equals( sActual ) );
+            return -1;
+        }
+
+        /// <summary>
+        /// Constructs a message that can be displayed when the content of two
+        /// strings are different, but the string lengths are the same.  The
+        /// message will clip the strings to a reasonable length, centered
+        /// around the first position where they are mismatched, and draw 
+        /// a line marking the position of the difference to make comparison
+        /// quicker.
+        /// </summary>
+        /// <param name="sbOutput"></param>
+        /// <param name="sExpected"></param>
+        /// <param name="sActual"></param>
+        static protected void BuildContentDifferentMessage( StringBuilder sbOutput, string sExpected, string sActual )
+        {
+            //
+            // If they mismatch at a specified position, report the
+            // difference.
+            //
+            int iMismatch = FindMismatchPosition( sExpected, sActual, 0 );
+            if( -1 != iMismatch )
+            {
+                BuildContentDifferentAtPosition( 
+                    sbOutput, 
+                    sExpected, 
+                    sActual, 
+                    iMismatch );
+                return;
+            }
+
+            //
+            // If the lengths differ, but they match up to the length,
+            // show the difference just past the length of the shorter
+            // string
+            //
+            if( sExpected.Length != sActual.Length )
+            {
+                BuildContentDifferentAtPosition( 
+                    sbOutput, 
+                    sExpected, 
+                    sActual, 
+                    Math.Min(sExpected.Length, sActual.Length) );
+            }
+        }
+
+        /// <summary>
+        /// Called to append a message when the input strings are different.
+        /// A different message is rendered when the lengths are mismatched,
+        /// and when the lengths match but content is mismatched.
+        /// </summary>
+        /// <param name="sbOutput"></param>
+        /// <param name="expected"></param>
+        /// <param name="actual"></param>
+        static private void BuildStringsDifferentMessage( StringBuilder sbOutput, string expected, string actual )
+        {
+            sbOutput.Append( NewLine );
+            if( LengthsDifferent( expected, actual ) )
+            {
+                BuildLengthsDifferentMessage( sbOutput, expected, actual );
+            }
+            else
+            {
+                BuildContentDifferentMessage( sbOutput, expected, actual );
+            }
+        }
+
+        /// <summary>
+        /// Used to create a StringBuilder that is used for constructing
+        /// the output message when text is different.  Handles initialization
+        /// when a message is provided.  If message is null, an empty
+        /// StringBuilder is returned.
+        /// </summary>
+        /// <param name="message"></param>
+        /// <returns></returns>
+        static protected StringBuilder CreateStringBuilder( string message )
+        {
+            StringBuilder sbOutput;
+            if (message != null) 
+            {
+                sbOutput = new StringBuilder( message );
+            }
+            else
+            {
+                sbOutput = new StringBuilder();
+            }
+            return sbOutput;
+        }
+
+        /// <summary>
+        /// Called to create a message when two objects have been found to
+        /// be unequal.  If the inputs are strings, a special message is
+        /// rendered that can help track down where the strings are different,
+        /// based on differences in length, or differences in content.
+        /// 
+        /// If the inputs are not strings, the ToString method of the objects
+        /// is used to show what is different about them.
+        /// </summary>
+        /// <param name="message"></param>
+        /// <param name="expected"></param>
+        /// <param name="actual"></param>
+        /// <returns></returns>
+        static public string FormatMessageForFailNotEquals(string message, Object expected, Object actual) 
+        {
+            StringBuilder sbOutput = CreateStringBuilder( message );
+            if( null != message )
+            {
+                if( message.Length > 0 )
+                {
+                    sbOutput.Append( " " );
+                }
+            }
+
+            if( InputsAreStrings( expected, actual ) )
+            {
+                BuildStringsDifferentMessage( 
+                    sbOutput, 
+                    (string)expected, 
+                    (string)actual );
+            }
+            else
+            {
+                AppendExpectedAndActual( sbOutput, expected, actual );
+            }
+            return sbOutput.ToString();
+        }
+       }
+}
diff --git a/mcs/nunit20/framework/ConsoleWriter.cs b/mcs/nunit20/framework/ConsoleWriter.cs
new file mode 100755 (executable)
index 0000000..27110c2
--- /dev/null
@@ -0,0 +1,73 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Core
+{
+       using System;
+       using System.IO;
+       using System.Text;
+
+       /// <summary>
+       /// Summary description for ConsoleWriter.
+       /// </summary>
+       public class ConsoleWriter : TextWriter
+       {
+               private TextWriter console;
+                       
+               public ConsoleWriter(TextWriter console)
+               {
+                       this.console = console;
+               }
+                       
+               public override void Write(char c)
+               {
+                       console.Write(c);
+               }
+
+               public override void Write(String s)
+               {
+                       console.Write(s);
+               }
+
+               public override void WriteLine(string s)
+               {
+                       console.WriteLine(s);
+               }
+
+               public override Encoding Encoding
+               {
+                       get { return Encoding.Default; }
+               }
+
+               public override Object InitializeLifetimeService()
+               {
+                       return null;
+               }
+       }
+}
diff --git a/mcs/nunit20/framework/EventListener.cs b/mcs/nunit20/framework/EventListener.cs
new file mode 100755 (executable)
index 0000000..7b2a7a7
--- /dev/null
@@ -0,0 +1,47 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Core
+{
+       using System;
+
+       /// <summary>
+       /// Summary description for EventListener.
+       /// </summary>
+       public interface EventListener
+       {
+               void TestStarted(TestCase testCase);
+                       
+               void TestFinished(TestCaseResult result);
+
+               void SuiteStarted(TestSuite suite);
+
+               void SuiteFinished(TestSuiteResult result);
+       }
+}
diff --git a/mcs/nunit20/framework/ExpectedExceptionAttribute.cs b/mcs/nunit20/framework/ExpectedExceptionAttribute.cs
new file mode 100755 (executable)
index 0000000..4e31d47
--- /dev/null
@@ -0,0 +1,55 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Framework
+{
+       using System;
+
+       /// <summary>
+       /// ExpectedAttributeException.
+       /// </summary>
+       /// 
+       [AttributeUsage(AttributeTargets.Method, AllowMultiple=false)]
+       public sealed class ExpectedExceptionAttribute : Attribute
+       {
+               private Type expectedException;
+
+               public ExpectedExceptionAttribute(Type exceptionType)
+               {
+                       expectedException = exceptionType;
+               }
+
+               public Type ExceptionType 
+               {
+                       get{ return expectedException; }
+                       set{ expectedException = value; }
+               }
+
+}
+}
diff --git a/mcs/nunit20/framework/ExpectedExceptionTestCase.cs b/mcs/nunit20/framework/ExpectedExceptionTestCase.cs
new file mode 100755 (executable)
index 0000000..8aa5abf
--- /dev/null
@@ -0,0 +1,69 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Core
+{
+       using System;
+       using System.Diagnostics;
+       using System.Reflection;
+
+       /// <summary>
+       /// Summary description for ExpectedExceptionTestCase.
+       /// </summary>
+       public class ExpectedExceptionTestCase : TemplateTestCase
+       {
+               private Type expectedException;
+
+               public ExpectedExceptionTestCase(object fixture, MethodInfo info, Type expectedException)
+                       : base(fixture, info)
+               {
+                       this.expectedException = expectedException;
+               }
+
+               protected override internal void ProcessException(Exception exception, TestCaseResult testResult)
+               {
+                       if (expectedException.Equals(exception.GetType()))
+                       {
+                               testResult.Success();
+                       }
+                       else
+                       {
+                               string message = "Expected: " + expectedException.Name + " but was " + exception.GetType().Name;
+                               testResult.Failure(message, exception.StackTrace);
+                       }
+
+                       return;
+               }
+
+               protected override internal void ProcessNoException(TestCaseResult testResult)
+               {
+                       testResult.Failure(expectedException.Name + " was expected", null);
+               }
+       }
+}
diff --git a/mcs/nunit20/framework/IgnoreAttribute.cs b/mcs/nunit20/framework/IgnoreAttribute.cs
new file mode 100755 (executable)
index 0000000..aa54241
--- /dev/null
@@ -0,0 +1,53 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+
+namespace NUnit.Framework
+{
+       using System;
+       /// <summary>
+       /// IgnoreAttribute.
+       /// </summary>
+       /// 
+       [AttributeUsage(AttributeTargets.Method|AttributeTargets.Class, AllowMultiple=false)]
+       public sealed class IgnoreAttribute : Attribute
+       {
+               private string reason;
+
+               public IgnoreAttribute(string reason)
+               {
+                       this.reason = reason;
+               }
+
+               public string Reason
+               {
+                       get { return reason; }
+               }
+       }
+}
diff --git a/mcs/nunit20/framework/InvalidFixture.cs b/mcs/nunit20/framework/InvalidFixture.cs
new file mode 100755 (executable)
index 0000000..0a6ea1a
--- /dev/null
@@ -0,0 +1,58 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+using System;
+
+namespace NUnit.Core
+{
+       /// <summary>
+       /// Summary description for InvalidFixture.
+       /// </summary>
+       public class InvalidFixture
+       {
+               private Type fixtureType;
+               private string message;
+
+               public InvalidFixture(Type original, string why)
+               {
+                       fixtureType = original;
+                       message = why;
+               }
+
+               public Type OriginalType
+               {
+                       get { return fixtureType; }
+               }
+
+               public string Message
+               {
+                       get { return message; }
+               }
+       }
+}
diff --git a/mcs/nunit20/framework/InvalidSuiteException.cs b/mcs/nunit20/framework/InvalidSuiteException.cs
new file mode 100755 (executable)
index 0000000..1a50b3d
--- /dev/null
@@ -0,0 +1,67 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Core
+{
+       using System;
+       using System.Runtime.Serialization;
+
+       [Serializable]
+       public class InvalidSuiteException : ApplicationException 
+       {
+               public InvalidSuiteException () : base() 
+               {} 
+
+               /// <summary>
+               /// Standard constructor
+               /// </summary>
+               /// <param name="message">The error message that explains 
+               /// the reason for the exception</param>
+               public InvalidSuiteException(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 InvalidSuiteException(string message, Exception inner) :
+                       base(message, inner) 
+               {}
+
+               /// <summary>
+               /// Serialization Constructor
+               /// </summary>
+               protected InvalidSuiteException(SerializationInfo info, 
+                       StreamingContext context) : base(info,context){}
+
+       }
+}
\ No newline at end of file
diff --git a/mcs/nunit20/framework/InvalidTestFixtureException.cs b/mcs/nunit20/framework/InvalidTestFixtureException.cs
new file mode 100755 (executable)
index 0000000..83e57b5
--- /dev/null
@@ -0,0 +1,57 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Core
+{
+       using System;
+       using System.Runtime.Serialization;
+
+       /// <summary>
+       /// Summary description for NoTestMethodsException.
+       /// </summary>
+       /// 
+       [Serializable]
+       public class InvalidTestFixtureException : ApplicationException
+       {
+               public InvalidTestFixtureException() : base() {}
+
+               public InvalidTestFixtureException(string message) : base(message)
+               {}
+
+               public InvalidTestFixtureException(string message, Exception inner) : base(message, inner)
+               {}
+
+               /// <summary>
+               /// Serialization Constructor
+               /// </summary>
+               protected InvalidTestFixtureException(SerializationInfo info, 
+                       StreamingContext context) : base(info,context){}
+
+       }
+}
\ No newline at end of file
diff --git a/mcs/nunit20/framework/LongLivingMarshalByRefObject.cs b/mcs/nunit20/framework/LongLivingMarshalByRefObject.cs
new file mode 100755 (executable)
index 0000000..21cb821
--- /dev/null
@@ -0,0 +1,29 @@
+using System;
+
+namespace NUnit.Core
+{
+       /// <summary>
+       /// All objects which are marshalled by reference
+       /// and whose lifetime is manually controlled by
+       /// the app, should derive from this class rather
+       /// than MarshalByRefObject.
+       /// 
+       /// This includes the remote test domain objects
+       /// which are accessed by the client and those
+       /// client objects which are called back by the
+       /// remote test domain.
+       /// 
+       /// Objects in this category that already inherit
+       /// from some other class (e.g. from TextWriter)
+       /// which in turn inherits from MarshalByRef object 
+       /// should override InitializeLifetimeService to 
+       /// return null to obtain the same effect.
+       /// </summary>
+       public class LongLivingMarshalByRefObject : MarshalByRefObject
+       {
+               public override Object InitializeLifetimeService()
+               {
+                       return null;
+               }
+       }
+}
diff --git a/mcs/nunit20/framework/NoTestFixturesException.cs b/mcs/nunit20/framework/NoTestFixturesException.cs
new file mode 100755 (executable)
index 0000000..8d08f86
--- /dev/null
@@ -0,0 +1,51 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Core
+{
+       using System;
+       using System.Runtime.Serialization;
+
+       /// <summary>
+       /// Summary description for NoTestFixtureException.
+       /// </summary>
+       [Serializable]
+       public class NoTestFixturesException : ApplicationException
+       {
+               public NoTestFixturesException() : base () {}
+
+               public NoTestFixturesException(string message) : base(message)
+               {}
+
+               public NoTestFixturesException(string message, Exception inner) : base(message, inner) {}
+
+               protected NoTestFixturesException(SerializationInfo info, StreamingContext context) : base(info, context)
+               {}
+       }
+}
diff --git a/mcs/nunit20/framework/NormalTestCase.cs b/mcs/nunit20/framework/NormalTestCase.cs
new file mode 100755 (executable)
index 0000000..51b70e2
--- /dev/null
@@ -0,0 +1,62 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Core
+{
+       using System;
+       using System.Reflection;
+
+       /// <summary>
+       /// Summary description for TestCase.
+       /// </summary>
+       public class NormalTestCase : TemplateTestCase
+       {
+               public NormalTestCase(object fixture, MethodInfo method) : base(fixture, method)
+               {}
+
+               protected internal override void ProcessNoException(TestCaseResult testResult)
+               {
+                       testResult.Success();
+               }
+               
+               protected internal override void ProcessException(Exception exception, TestCaseResult testResult)
+               {
+                       if(exception is NUnit.Framework.AssertionException)
+                       {
+                               NUnit.Framework.AssertionException error = (NUnit.Framework.AssertionException)exception;
+                               testResult.Failure(error.Message, error.StackTrace);
+                       }
+                       else
+                       {
+                               testResult.Failure(exception.Message, exception.StackTrace);
+                       }
+               }
+       }
+}
+
diff --git a/mcs/nunit20/framework/NotRunnableTestCase.cs b/mcs/nunit20/framework/NotRunnableTestCase.cs
new file mode 100755 (executable)
index 0000000..f936cd9
--- /dev/null
@@ -0,0 +1,72 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+using System;
+using System.Reflection;
+using System.Diagnostics;
+
+namespace NUnit.Core
+{
+       /// <summary>
+       /// Summary description for NotRunnableTestCase.
+       /// </summary>
+       public class NotRunnableTestCase : TestCase
+       {
+               public NotRunnableTestCase(MethodInfo method, string reason) : base(method.DeclaringType.FullName, method.Name)
+               {
+                       ShouldRun = false;
+                       IgnoreReason = reason;
+               }
+
+               public NotRunnableTestCase(MethodInfo method) : base(method.DeclaringType.FullName, method.Name)
+               {
+                       string reason;
+
+                       if (method.IsAbstract)
+                               reason = "it must not be abstract";
+                       else if (!method.IsPublic)
+                               reason = "it must be a public method";
+                       else if (method.GetParameters().Length != 0)
+                               reason = "it must not have parameters";
+                       else if (!method.ReturnType.Equals(typeof(void)))
+                               reason = "it must return void";
+                       else
+                               reason = "reason not known";
+
+                       ShouldRun = false;
+                       IgnoreReason = String.Format("Method {0}'s signature is not correct: {1}.", method.Name, reason);
+               }
+
+               public override void Run(TestCaseResult result)
+               {
+                       result.NotRun(base.IgnoreReason);
+               }
+       }
+}
+
diff --git a/mcs/nunit20/framework/NullListener.cs b/mcs/nunit20/framework/NullListener.cs
new file mode 100755 (executable)
index 0000000..e68021b
--- /dev/null
@@ -0,0 +1,54 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+using System;
+
+namespace NUnit.Core
+{
+       /// <summary>
+       /// Summary description for NullListener.
+       /// </summary>
+       /// 
+       [Serializable]
+       public class NullListener : EventListener
+       {
+               public void TestStarted(TestCase testCase){}
+                       
+               public void TestFinished(TestCaseResult result){}
+
+               public void SuiteStarted(TestSuite suite){}
+
+               public void SuiteFinished(TestSuiteResult result){}
+
+               public static EventListener NULL
+               {
+                       get { return new NullListener();}
+               }
+       }
+}
diff --git a/mcs/nunit20/framework/NunitException.cs b/mcs/nunit20/framework/NunitException.cs
new file mode 100755 (executable)
index 0000000..16ee4ed
--- /dev/null
@@ -0,0 +1,73 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Core 
+{
+       using System;
+       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 
+       {
+               public NunitException () : base() 
+               {} 
+
+               /// <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>
+               /// Serialization Constructor
+               /// </summary>
+               protected NunitException(SerializationInfo info, 
+                       StreamingContext context) : base(info,context){}
+
+
+       }
+}
diff --git a/mcs/nunit20/framework/OldTestCase.cs b/mcs/nunit20/framework/OldTestCase.cs
new file mode 100755 (executable)
index 0000000..6add910
--- /dev/null
@@ -0,0 +1,52 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Framework
+{
+       using System;
+
+       /// <summary>
+       /// TestFixture
+       /// </summary>
+       /// 
+       [TestFixture]
+       [Obsolete("use TestFixture attribute instead of inheritance",false)]
+       public class TestCase : Assertion
+       {
+               [SetUp]
+               [Obsolete("use SetUp attribute instead of naming convention",false)]
+               protected virtual void SetUp()
+               {}
+
+               [TearDown]
+               [Obsolete("use TearDown attribute instead of naming convention",false)]
+               protected virtual void TearDown()
+               {}
+       }
+}
diff --git a/mcs/nunit20/framework/RemoteTestRunner.cs b/mcs/nunit20/framework/RemoteTestRunner.cs
new file mode 100755 (executable)
index 0000000..d853202
--- /dev/null
@@ -0,0 +1,147 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Core
+{
+       using System;
+       using System.IO;
+       using System.Reflection;
+       using System.Runtime.Remoting;
+
+       /// <summary>
+       /// Summary description for RemoteTestRunner.
+       /// </summary>
+       /// 
+       [Serializable]
+       public class RemoteTestRunner : LongLivingMarshalByRefObject
+       {
+               private TestSuite suite;
+               private string fullName;
+               private string assemblyName;
+
+               public void Initialize(string assemblyName)
+               {
+                       this.assemblyName = assemblyName;
+               }
+
+               public void Initialize(string fixtureName, string assemblyName)
+               {
+                       TestName = fixtureName;
+                       Initialize(assemblyName);
+               }
+
+               public void BuildSuite() 
+               {
+                       TestSuiteBuilder builder = new TestSuiteBuilder();
+                       if(fullName == null) 
+                               suite = builder.Build(assemblyName);
+                       else
+                               suite = builder.Build(fullName, assemblyName);
+
+                       if(suite != null) TestName = suite.FullName;
+               }
+
+               public TestResult Run(NUnit.Core.EventListener listener, TextWriter outText, TextWriter errorText)
+               {
+                       Console.SetOut(new StringTextWriter(outText));
+                       Console.SetError(new StringTextWriter(errorText));
+
+                       Test test = FindByName(suite, fullName);
+
+                       TestResult result = test.Run(listener);
+
+                       return result;
+               }
+
+               /// <summary>
+               /// Use this wrapper to ensure that only strings get passed accross the AppDomain
+               /// boundry.  Otherwise tests will break when non-remotable objecs are passed to
+               /// Console.Write/WriteLine.
+               /// </summary>
+               private class StringTextWriter : TextWriter
+               {
+                       public StringTextWriter(TextWriter aTextWriter)
+                       {
+                               theTextWriter = aTextWriter;
+                       }
+                       private TextWriter theTextWriter;
+
+                       override public void Write(char aChar)
+                       {
+                               theTextWriter.Write(aChar);
+                       }
+
+                       override public void Write(string aString)
+                       {
+                               theTextWriter.Write(aString);
+                       }
+
+                       override public void WriteLine(string aString)
+                       {
+                               theTextWriter.WriteLine(aString);
+                       }
+
+                       override public System.Text.Encoding Encoding
+                       {
+                               get { return theTextWriter.Encoding; }
+                       }
+               }
+
+               private Test FindByName(Test test, string fullName)
+               {
+                       if(test.FullName.Equals(fullName)) return test;
+                       
+                       Test result = null;
+                       if(test is TestSuite)
+                       {
+                               TestSuite suite = (TestSuite)test;
+                               foreach(Test testCase in suite.Tests)
+                               {
+                                       result = FindByName(testCase, fullName);
+                                       if(result != null) break;
+                               }
+                       }
+
+                       return result;
+               }
+
+               public string TestName 
+               {
+                       get { return fullName; }
+                       set { fullName = value; }
+               }
+                       
+               public Test Test
+               {
+                       get 
+                       { return suite; }
+               }
+       }
+}
+
diff --git a/mcs/nunit20/framework/ResultSummarizer.cs b/mcs/nunit20/framework/ResultSummarizer.cs
new file mode 100755 (executable)
index 0000000..abe1c17
--- /dev/null
@@ -0,0 +1,86 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Core
+{
+       using System;
+
+       /// <summary>
+       /// Summary description for ResultSummarizer.
+       /// </summary>
+       public class ResultSummarizer
+       {
+               private SummaryVisitor visitor = new SummaryVisitor();
+
+               public ResultSummarizer(TestResult result)
+               {
+                       result.Accept(visitor);
+               }
+
+               public string Name
+               {
+                       get { return visitor.Name; }
+               }
+
+               public bool Success
+               {
+                       get { return visitor.Success; }
+               }
+
+               public int ResultCount
+               {
+                       get { return visitor.Count; }
+               }
+
+//             public int Errors
+//             {
+//                     get { return visitor.Errors; }
+//             }
+
+               public int Failures 
+               {
+                       get { return visitor.Failures; }
+               }
+
+               public double Time
+               {
+                       get { return visitor.Time; }
+               }
+
+               public int TestsNotRun
+               {
+                       get { return visitor.TestsNotRun; }
+               }
+
+               public int SuitesNotRun
+               {
+                       get { return visitor.SuitesNotRun; }
+               }
+       }
+}
diff --git a/mcs/nunit20/framework/ResultVisitor.cs b/mcs/nunit20/framework/ResultVisitor.cs
new file mode 100755 (executable)
index 0000000..fc4c032
--- /dev/null
@@ -0,0 +1,42 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Core
+{
+       using System;
+
+       /// <summary>
+       /// 
+       /// </summary>
+       public interface ResultVisitor
+       {
+               void visit(TestCaseResult caseResult);
+               void visit(TestSuiteResult suiteResult);
+       }
+}
diff --git a/mcs/nunit20/framework/Results.xsd b/mcs/nunit20/framework/Results.xsd
new file mode 100755 (executable)
index 0000000..5f32230
--- /dev/null
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+       <xs:complexType name="failureType">
+               <xs:sequence>
+                       <xs:element ref="message" />
+                       <xs:element ref="stack-trace" />
+               </xs:sequence>
+       </xs:complexType>
+       <xs:complexType name="reasonType">
+               <xs:sequence>
+                       <xs:element ref="message" />
+               </xs:sequence>
+       </xs:complexType>
+       <xs:element name="message" type="xs:string" />
+       <xs:complexType name="resultsType">
+               <xs:choice>
+                       <xs:element name="test-suite" type="test-suiteType" maxOccurs="unbounded" />
+                       <xs:element name="test-case" type="test-caseType" maxOccurs="unbounded" minOccurs="0" />
+               </xs:choice>
+       </xs:complexType>
+       <xs:element name="stack-trace" type="xs:string" />
+       <xs:element name="test-results" type="resultType" />
+       <xs:complexType name="resultType">
+               <xs:sequence>
+                       <xs:element name="test-suite" type="test-suiteType" />
+               </xs:sequence>
+               <xs:attribute name="name" type="xs:string" use="required" />
+               <xs:attribute name="total" type="xs:decimal" use="required" />
+               <xs:attribute name="failures" type="xs:decimal" use="required" />
+               <xs:attribute name="not-run" type="xs:decimal" use="required" />
+               <xs:attribute name="date" type="xs:string" use="required" />
+               <xs:attribute name="time" type="xs:string" use="required" />
+       </xs:complexType>
+       <xs:complexType name="test-caseType">
+               <xs:choice>
+                       <xs:element name="failure" type="failureType" minOccurs="0" />
+                       <xs:element name="reason" type="reasonType" minOccurs="0" />
+               </xs:choice>
+               <xs:attribute name="name" type="xs:string" use="required" />
+               <xs:attribute name="success" type="xs:string" use="optional" />
+               <xs:attribute name="time" type="xs:string" use="optional" />
+               <xs:attribute name="executed" type="xs:string" use="required" />
+       </xs:complexType>
+       <xs:complexType name="test-suiteType">
+               <xs:sequence>
+                       <xs:element name="results" type="resultsType" />
+               </xs:sequence>
+               <xs:attribute name="name" type="xs:string" use="required" />
+               <xs:attribute name="success" type="xs:string" use="required" />
+               <xs:attribute name="time" type="xs:string" use="required" />
+       </xs:complexType>
+</xs:schema>
\ No newline at end of file
diff --git a/mcs/nunit20/framework/Results.xsx b/mcs/nunit20/framework/Results.xsx
new file mode 100755 (executable)
index 0000000..0e6b750
--- /dev/null
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--This file is auto-generated by the XML Schema Designer. It holds layout information for components on the designer surface.-->
+<XSDDesignerLayout layoutVersion="1" viewPortLeft="0" viewPortTop="0">
+    <failureType_XmlComplexType left="635" top="635" width="5292" height="2963" selected="0" zOrder="1" index="0" />
+    <reasonType_XmlComplexType left="7197" top="635" width="5292" height="2963" selected="0" zOrder="2" index="1" />
+    <message_XmlElement left="13759" top="635" width="5292" height="714" selected="0" zOrder="4" index="2" />
+    <resultsType_XmlComplexType left="26883" top="635" width="5292" height="2963" selected="0" zOrder="6" index="3">
+        <test-suite_XmlElement left="20321" top="4868" width="5292" height="2963" selected="0" zOrder="7" index="0" />
+        <test-case_XmlElement left="30164" top="4868" width="5292" height="2963" selected="0" zOrder="11" index="1">
+            <failure_XmlElement left="26883" top="9101" width="5292" height="2963" selected="0" zOrder="13" index="0" />
+            <reason_XmlElement left="33445" top="9101" width="5292" height="2963" selected="0" zOrder="16" index="1" />
+        </test-case_XmlElement>
+    </resultsType_XmlComplexType>
+    <stack-trace_XmlElement left="40007" top="635" width="5292" height="714" selected="0" zOrder="18" index="4" />
+    <test-results_XmlElement left="49850" top="635" width="5292" height="2963" selected="0" zOrder="19" index="5">
+        <test-suite_XmlElement left="49850" top="4868" width="5292" height="2963" selected="0" zOrder="20" index="0">
+            <results_XmlElement left="49850" top="9101" width="5292" height="2963" selected="0" zOrder="22" index="0">
+                <test-case_XmlElement left="49850" top="13334" width="5292" height="2963" selected="0" zOrder="24" index="1">
+                    <failure_XmlElement left="46569" top="17567" width="5292" height="2963" selected="0" zOrder="26" index="0" />
+                    <reason_XmlElement left="53131" top="17567" width="5292" height="2963" selected="0" zOrder="28" index="1" />
+                </test-case_XmlElement>
+            </results_XmlElement>
+        </test-suite_XmlElement>
+    </test-results_XmlElement>
+    <resultType_XmlComplexType left="62974" top="635" width="5292" height="2963" selected="0" zOrder="30" index="6">
+        <test-suite_XmlElement left="62974" top="4868" width="5292" height="2963" selected="0" zOrder="31" index="0">
+            <results_XmlElement left="62974" top="9101" width="5292" height="2963" selected="0" zOrder="33" index="0">
+                <test-case_XmlElement left="62974" top="13334" width="5292" height="2963" selected="0" zOrder="35" index="1">
+                    <failure_XmlElement left="59693" top="17567" width="5292" height="2963" selected="0" zOrder="37" index="0" />
+                    <reason_XmlElement left="66255" top="17567" width="5292" height="2963" selected="0" zOrder="39" index="1" />
+                </test-case_XmlElement>
+            </results_XmlElement>
+        </test-suite_XmlElement>
+    </resultType_XmlComplexType>
+    <test-caseType_XmlComplexType left="76098" top="635" width="5292" height="2963" selected="0" zOrder="41" index="7">
+        <failure_XmlElement left="72817" top="4868" width="5292" height="2963" selected="0" zOrder="42" index="0" />
+        <reason_XmlElement left="79379" top="4868" width="5292" height="2963" selected="0" zOrder="44" index="1" />
+    </test-caseType_XmlComplexType>
+    <test-suiteType_XmlComplexType left="89222" top="635" width="5292" height="2963" selected="0" zOrder="46" index="8">
+        <results_XmlElement left="89222" top="4868" width="5292" height="2963" selected="0" zOrder="47" index="0">
+            <test-case_XmlElement left="89222" top="9101" width="5292" height="2963" selected="0" zOrder="49" index="1">
+                <failure_XmlElement left="85941" top="13334" width="5292" height="2963" selected="0" zOrder="51" index="0" />
+                <reason_XmlElement left="92503" top="13334" width="5292" height="2963" selected="0" zOrder="53" index="1" />
+            </test-case_XmlElement>
+        </results_XmlElement>
+    </test-suiteType_XmlComplexType>
+</XSDDesignerLayout>
\ No newline at end of file
diff --git a/mcs/nunit20/framework/SetUpAttribute.cs b/mcs/nunit20/framework/SetUpAttribute.cs
new file mode 100755 (executable)
index 0000000..eb309bd
--- /dev/null
@@ -0,0 +1,40 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Framework
+{
+       using System;
+       /// <summary>
+       /// SetUpAttribute.
+       /// </summary>
+       /// 
+       [AttributeUsage(AttributeTargets.Method, AllowMultiple=false)]
+       public sealed class SetUpAttribute : Attribute
+       {}
+}
diff --git a/mcs/nunit20/framework/StackTraceFilter.cs b/mcs/nunit20/framework/StackTraceFilter.cs
new file mode 100755 (executable)
index 0000000..be6b307
--- /dev/null
@@ -0,0 +1,84 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Core
+{
+       using System;
+       using System.IO;
+
+       /// <summary>
+       /// Summary description for StackTraceFilter.
+       /// </summary>
+       public class StackTraceFilter
+       {
+               public static string Filter(string stack) 
+               {
+                       if(stack == null) return null;
+                       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 sw.ToString();
+               }
+
+               static bool FilterLine(string line) 
+               {
+                       string[] patterns = new string[]
+                       {
+                               "NUnit.Core.TestCase",
+                               "NUnit.Core.ExpectedExceptionTestCase",
+                               "NUnit.Core.TemplateTestCase",
+                               "NUnit.Core.TestResult",
+                               "NUnit.Core.TestSuite",
+                               "NUnit.Framework.Assertion" 
+                       };
+
+                       for (int i = 0; i < patterns.Length; i++) 
+                       {
+                               if (line.IndexOf(patterns[i]) > 0)
+                                       return true;
+                       }
+
+                       return false;
+               }
+
+       }
+}
diff --git a/mcs/nunit20/framework/SuiteAttribute.cs b/mcs/nunit20/framework/SuiteAttribute.cs
new file mode 100755 (executable)
index 0000000..984c5e5
--- /dev/null
@@ -0,0 +1,40 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Framework
+{
+       using System;
+       /// <summary>
+       /// SuiteAttribute.
+       /// </summary>
+       /// 
+       [AttributeUsage(AttributeTargets.Property, AllowMultiple=false)]
+       public sealed class SuiteAttribute : Attribute
+       {}
+}
diff --git a/mcs/nunit20/framework/Summary.xslt b/mcs/nunit20/framework/Summary.xslt
new file mode 100755 (executable)
index 0000000..40188c4
--- /dev/null
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:output method='text'/>
+
+<xsl:template match="/">
+       <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="test-results">
+<xsl:text>Tests run: </xsl:text>
+<xsl:value-of select="@total"/>
+<xsl:text>, Failures: </xsl:text>
+<xsl:value-of select="@failures"/>
+<xsl:text>, Not run: </xsl:text>
+<xsl:value-of select="@not-run"/>
+<xsl:text>, Time: </xsl:text>
+<xsl:value-of select="test-suite/@time"/>
+<xsl:text> seconds
+</xsl:text>
+<xsl:text>
+</xsl:text>
+
+<xsl:if test="//test-case[failure]"><xsl:text>Failures:
+</xsl:text></xsl:if>
+<xsl:apply-templates select="//test-case[failure]"/>
+<xsl:if test="//test-case[@executed='False']"><xsl:text>Tests not run:
+</xsl:text></xsl:if>
+<xsl:apply-templates select="//test-case[@executed='False']"/>
+<xsl:text disable-output-escaping='yes'>&#xA;</xsl:text>
+</xsl:template>
+
+<xsl:template match="test-case">
+       <xsl:value-of select="position()"/><xsl:text>) </xsl:text>
+       <xsl:value-of select="@name"/>
+       <xsl:text> : </xsl:text>
+       <xsl:value-of select="child::node()/message"/>
+<xsl:text disable-output-escaping='yes'>&#xA;</xsl:text>
+       <xsl:if test="failure">
+               <xsl:value-of select="failure/stack-trace"/>
+<xsl:text>
+</xsl:text>
+       </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>
+
+  
\ No newline at end of file
diff --git a/mcs/nunit20/framework/SummaryVisitor.cs b/mcs/nunit20/framework/SummaryVisitor.cs
new file mode 100755 (executable)
index 0000000..47149d3
--- /dev/null
@@ -0,0 +1,128 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Core
+{
+       using System;
+
+       /// <summary>
+       /// Summary description for SiummaryVisitor.
+       /// </summary>
+       public class SummaryVisitor : ResultVisitor
+       {
+               private int totalCount;
+               private int failureCount;
+               private int testsNotRun;
+               private int suitesNotRun;
+               
+               private double time;
+               private string name;
+               private bool initialized;
+
+               public SummaryVisitor()
+               {
+                       totalCount = 0;
+                       initialized = false;
+               }
+
+               public void visit(TestCaseResult caseResult) 
+               {
+                       SetNameandTime(caseResult.Name, caseResult.Time);
+
+                       if(caseResult.Executed)
+                       {
+                               totalCount++;
+                               if(caseResult.IsFailure)
+                                       failureCount++;
+                       }
+                       else
+                               testsNotRun++;
+               }
+
+               public void visit(TestSuiteResult suiteResult) 
+               {
+                       SetNameandTime(suiteResult.Name, suiteResult.Time);
+
+                       
+                       
+                       foreach (TestResult result in suiteResult.Results)
+                       {
+                               result.Accept(this);
+                       }
+                       
+                       if(!suiteResult.Executed)
+                               suitesNotRun++;
+               }
+
+               public double Time
+               {
+                       get { return time; }
+               }
+
+               private void SetNameandTime(string name, double time)
+               {
+                       if(!initialized)
+                       {
+                               this.time = time;
+                               this.name = name;
+                               initialized = true;
+                       }
+               }
+
+               public bool Success
+               {
+                       get { return (failureCount == 0); }
+               }
+
+               public int Count
+               {
+                       get { return totalCount; }
+               }
+
+               public int Failures
+               {
+                       get { return failureCount; }
+               }
+
+               public int TestsNotRun
+               {
+                       get { return testsNotRun; }
+               }
+
+               public int SuitesNotRun
+               {
+                       get { return suitesNotRun; }
+               }
+
+               public string Name
+               {
+                       get { return name; }
+               }
+       }
+}
diff --git a/mcs/nunit20/framework/TearDownAttribute.cs b/mcs/nunit20/framework/TearDownAttribute.cs
new file mode 100755 (executable)
index 0000000..c8e3a24
--- /dev/null
@@ -0,0 +1,40 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Framework
+{
+       using System;
+       /// <summary>
+       /// TearDownAttribute.
+       /// </summary>
+       /// 
+       [AttributeUsage(AttributeTargets.Method, AllowMultiple=false)]
+       public sealed class TearDownAttribute : Attribute
+       {}
+}
diff --git a/mcs/nunit20/framework/TemplateTestCase.cs b/mcs/nunit20/framework/TemplateTestCase.cs
new file mode 100755 (executable)
index 0000000..e5bc78f
--- /dev/null
@@ -0,0 +1,150 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Core
+{
+       using System;
+       using System.Reflection;
+
+       /// <summary>
+       /// Summary description for TestCase.
+       /// </summary>
+       public abstract class TemplateTestCase : TestCase
+       {
+               private object fixture;
+               private MethodInfo  method;
+
+               public TemplateTestCase(object fixture, MethodInfo method) : base(fixture.GetType().FullName, method.Name)
+               {
+                       this.fixture = fixture;
+                       this.method = method;
+               }
+
+               public override void Run(TestCaseResult testResult)
+               {
+                       if(ShouldRun)
+                       {
+                               DateTime start = DateTime.Now;
+#if NUNIT_LEAKAGE_TEST
+                               long before = System.GC.GetTotalMemory( true );
+#endif
+
+                               try 
+                               {
+                                       InvokeSetUp();
+                                       InvokeTestCase();
+                                       ProcessNoException(testResult);
+                               }
+                               catch(NunitException exception)
+                               {
+                                       ProcessException(exception.InnerException, testResult); 
+                               }
+                               catch(Exception exp)
+                               {
+                                       ProcessException(exp, testResult);
+                               }
+                               finally 
+                               {
+                                       try
+                                       {
+                                               InvokeTearDown();
+                                       }
+                                       catch(NunitException exception)
+                                       {
+                                               ProcessException(exception.InnerException, testResult); 
+                                       }
+                                       catch(Exception exp)
+                                       {
+                                               ProcessException(exp, testResult);
+                                       }
+                                       
+                                       DateTime stop = DateTime.Now;
+                                       TimeSpan span = stop.Subtract(start);
+                                       testResult.Time = (double)span.Ticks / (double)TimeSpan.TicksPerSecond;
+
+#if NUNIT_LEAKAGE_TEST
+                                       long after = System.GC.GetTotalMemory( true );
+                                       testResult.Leakage = after - before;
+#endif
+                               }
+                       }
+                       else
+                       {
+                               testResult.NotRun(this.IgnoreReason);
+                       }
+
+                       return;
+               }
+
+               private void InvokeTearDown()
+               {
+                       MethodInfo method = FindTearDownMethod(fixture);
+                       if(method != null)
+                       {
+                               InvokeMethod(method, fixture);
+                       }
+               }
+
+               private MethodInfo FindTearDownMethod(object fixture)
+               {                       
+                       return FindMethodByAttribute(fixture, typeof(NUnit.Framework.TearDownAttribute));
+               }
+
+               private void InvokeSetUp()
+               {
+                       MethodInfo method = FindSetUpMethod(fixture);
+                       if(method != null)
+                       {
+                               InvokeMethod(method, fixture);
+                       }
+               }
+
+               private MethodInfo FindSetUpMethod(object fixture)
+               {
+                       return FindMethodByAttribute(fixture, typeof(NUnit.Framework.SetUpAttribute));
+               }
+
+               private void InvokeTestCase() 
+               {
+                       try
+                       {
+                               method.Invoke(fixture, null);
+                       }
+                       catch(TargetInvocationException e)
+                       {
+                               Exception inner = e.InnerException;
+                               throw new NunitException("Rethrown",inner);
+                       }
+               }
+
+               protected internal abstract void ProcessNoException(TestCaseResult testResult);
+               
+               protected internal abstract void ProcessException(Exception exception, TestCaseResult testResult);
+       }
+}
diff --git a/mcs/nunit20/framework/Test.cs b/mcs/nunit20/framework/Test.cs
new file mode 100755 (executable)
index 0000000..813117e
--- /dev/null
@@ -0,0 +1,114 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Core
+{
+       using System;
+       using System.Collections;
+       using System.Reflection;
+
+       /// <summary>
+       ///             Test Class.
+       /// </summary>
+       public abstract class Test : LongLivingMarshalByRefObject, TestInfo
+       {
+               private string fullName;
+               private string testName;
+               private bool shouldRun;
+               private string ignoreReason;
+
+               protected Test(string pathName, string testName) 
+               { 
+                       fullName = pathName + "." + testName;
+                       this.testName = testName;
+                       shouldRun = true;
+               }
+
+               public string IgnoreReason
+               {
+                       get { return ignoreReason; }
+                       set { ignoreReason = value; }
+               }
+
+               public bool ShouldRun
+               {
+                       get { return shouldRun; }
+                       set { shouldRun = value; }
+               }
+
+               public Test(string name)
+               {
+                       fullName = testName = name;
+               }
+
+               public string FullName 
+               {
+                       get { return fullName; }
+               }
+
+               public string Name
+               {
+                       get { return testName; }
+               }
+
+               public abstract int CountTestCases { get; }
+               public abstract bool IsSuite { get; }
+               public abstract ArrayList Tests { get; }
+
+               public abstract TestResult Run(EventListener listener);
+
+               protected MethodInfo FindMethodByAttribute(object fixture, Type type)
+               {
+                       foreach(MethodInfo method in fixture.GetType().GetMethods(BindingFlags.Public|BindingFlags.Instance|BindingFlags.NonPublic))
+                       {
+                               if(method.IsDefined(type,true)) 
+                               {
+                                       return method;
+                               }
+                       }
+                       return null;
+               }
+
+               protected void InvokeMethod(MethodInfo method, object fixture) 
+               {
+                       if(method != null)
+                       {
+                               try
+                               {
+                                       method.Invoke(fixture, null);
+                               }
+                               catch(TargetInvocationException e)
+                               {
+                                       Exception inner = e.InnerException;
+                                       throw new NunitException("Rethrown",inner);
+                               }
+                       }
+               }
+       }
+}
diff --git a/mcs/nunit20/framework/TestAttribute.cs b/mcs/nunit20/framework/TestAttribute.cs
new file mode 100755 (executable)
index 0000000..24c819c
--- /dev/null
@@ -0,0 +1,40 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Framework
+{
+       using System;
+       /// <summary>
+       /// TestAttribute.
+       /// </summary>
+       /// 
+       [AttributeUsage(AttributeTargets.Method, AllowMultiple=false)]
+       public sealed class TestAttribute : Attribute
+       {}
+}
diff --git a/mcs/nunit20/framework/TestCase.cs b/mcs/nunit20/framework/TestCase.cs
new file mode 100755 (executable)
index 0000000..7c1f1c2
--- /dev/null
@@ -0,0 +1,82 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Core
+{
+       using System;
+       using System.Collections;
+
+       /// <summary>
+       /// Summary description for TestCase.
+       /// </summary>
+       public abstract class TestCase : Test
+       {
+               public TestCase(string path, string name) : base(path, name)
+               {}
+
+               public override int CountTestCases 
+               {
+                       get { return 1; }
+               }
+
+               public override TestResult Run(EventListener listener)
+               {
+                       TestCaseResult testResult = new TestCaseResult(this);
+
+                       listener.TestStarted(this);
+                       
+                       long startTime = DateTime.Now.Ticks;
+
+                       Run(testResult);
+
+                       long stopTime = DateTime.Now.Ticks;
+
+                       double time = ((double)(stopTime - startTime)) / (double)TimeSpan.TicksPerSecond;
+
+                       testResult.Time = time;
+
+                       listener.TestFinished(testResult);
+       
+                       return testResult;
+               }
+
+               public override bool IsSuite
+               {
+                       get { return false; }
+               }
+
+               public override ArrayList Tests
+               {
+                       get { return null; }
+               }
+
+               public abstract void Run(TestCaseResult result);
+
+       }
+}
diff --git a/mcs/nunit20/framework/TestCaseBuilder.cs b/mcs/nunit20/framework/TestCaseBuilder.cs
new file mode 100755 (executable)
index 0000000..24f3883
--- /dev/null
@@ -0,0 +1,169 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Core
+{
+       using System;
+       using System.Reflection;
+
+       /// <summary>
+       /// Summary description for TestCaseBuilder.
+       /// </summary>
+       public class TestCaseBuilder
+       {
+               public static TestCase Make(object fixture, MethodInfo method)
+               {
+                       TestCase testCase = null;
+
+                       if(HasTestAttribute(method) || HasObsoleteTestName(method))
+                       {
+                               if(IsTestMethodSignatureCorrect(method))
+                               {
+                                       if(!IsExpectedException(method))
+                                               testCase = new NormalTestCase(fixture, method);
+                                       else
+                                       {
+                                               Type expectedException = GetExpectedExceptions(method);
+                                               testCase = new ExpectedExceptionTestCase(fixture, method, expectedException);
+                                       }
+                                       if(HasIgnoreAttribute(method))
+                                       {
+                                               testCase.ShouldRun = false;
+                                               testCase.IgnoreReason = GetIgnoreReason(method);
+                                       }
+
+                               }
+                               else
+                               {
+                                       //                                      string reason = String.Format("Method: {0}'s signature is not correct", method.Name);
+                                       //                                      testCase = new NotRunnableTestCase(method, reason);
+                                       testCase = new NotRunnableTestCase(method);
+                               }
+                       }
+
+                       return testCase;
+               }
+
+               public static TestCase Make(object fixture, string methodName)
+               {
+                       MethodInfo [] methods = fixture.GetType().GetMethods(BindingFlags.NonPublic|BindingFlags.Public|BindingFlags.Instance);
+                       foreach(MethodInfo method in methods)
+                       {
+                               if(method.Name.Equals(methodName))
+                                       return Make(fixture, method);
+                       }
+
+                       return null;
+               }
+
+               private static bool IsExpectedException(MethodInfo method)
+               {
+                       Type exceptionAttr = typeof(NUnit.Framework.ExpectedExceptionAttribute);
+                       object[] attributes = method.GetCustomAttributes(exceptionAttr, false);
+                       return attributes.Length == 1;
+               }
+
+               private static Type GetExpectedExceptions(MethodInfo method)
+               {
+                       Type exceptionAttr = typeof(NUnit.Framework.ExpectedExceptionAttribute);
+                       object[] attributes = method.GetCustomAttributes(exceptionAttr, false);
+
+                       Type returnType = null;
+
+                       if(attributes.Length == 1)
+                       {
+                               NUnit.Framework.ExpectedExceptionAttribute expectedAttr = 
+                                       (NUnit.Framework.ExpectedExceptionAttribute)attributes[0];
+                               returnType = expectedAttr.ExceptionType;
+                       }
+
+                       return returnType;
+               }
+
+               public static int CountTestCases(object fixture) 
+               {
+                       int testCases = 0;
+
+                       MethodInfo [] methods = fixture.GetType().GetMethods();
+                       foreach(MethodInfo method in methods)
+                       {
+                               if(IsTestMethod(method))
+                                       testCases++;
+                       }
+
+                       return testCases;
+               }
+
+
+               public static bool IsTestMethod(MethodInfo methodToCheck) 
+               {
+                       return
+                               (HasTestAttribute(methodToCheck) || HasObsoleteTestName(methodToCheck))
+                               && IsTestMethodSignatureCorrect(methodToCheck);
+               }
+
+               private static bool IsTestMethodSignatureCorrect(MethodInfo methodToCheck)
+               {
+                       return 
+                               !methodToCheck.IsAbstract
+                               && methodToCheck.IsPublic
+                               && methodToCheck.GetParameters().Length == 0
+                               && methodToCheck.ReturnType.Equals(typeof(void));
+               }
+
+               private static bool HasTestAttribute(MethodInfo methodToCheck)
+               {
+                       return methodToCheck.IsDefined(typeof(NUnit.Framework.TestAttribute),false);
+               }
+               
+               private static bool HasObsoleteTestName(MethodInfo methodToCheck)
+               {
+                       return methodToCheck.Name.ToLower().StartsWith("test");
+               }
+
+               private static bool HasIgnoreAttribute(MethodInfo methodToCheck)
+               {
+                       Type ignoreMethodAttribute = typeof(NUnit.Framework.IgnoreAttribute);
+                       object[] attributes = methodToCheck.GetCustomAttributes(ignoreMethodAttribute, false);
+                       return attributes.Length == 1;
+               }
+
+               private static string GetIgnoreReason(MethodInfo methodToCheck)
+               {
+                       Type ignoreMethodAttribute = typeof(NUnit.Framework.IgnoreAttribute);
+                       NUnit.Framework.IgnoreAttribute[] attributes = (NUnit.Framework.IgnoreAttribute[])methodToCheck.GetCustomAttributes(ignoreMethodAttribute, false);
+                       string result = "no reason";
+                       if(attributes.Length > 0)
+                               result = attributes[0].Reason;
+
+                       return result;
+               }
+       }
+}
+
diff --git a/mcs/nunit20/framework/TestCaseResult.cs b/mcs/nunit20/framework/TestCaseResult.cs
new file mode 100755 (executable)
index 0000000..c87a57b
--- /dev/null
@@ -0,0 +1,107 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Core
+{
+       using System;
+       using System.Text;
+
+       /// <summary>
+       /// 
+       /// </summary>
+       //
+       [Serializable]
+       public class TestCaseResult : TestResult
+       {
+               private string message;
+               private string stackTrace;
+
+               public TestCaseResult(TestCase testCase):base(testCase, testCase.FullName)
+               {
+                       Executed = false;
+               }
+
+               public TestCaseResult(string testCaseString) : base(null, testCaseString)
+               {
+                       Executed = false;
+               }
+
+               public void Success() 
+               { 
+                       Executed = true;
+                       IsFailure = false; 
+               }
+
+               public override void NotRun(string reason)
+               {
+                       Executed = false;
+                       message = reason;
+               }
+
+               public void Failure(string message, string stackTrace)
+               {
+                       Executed = true;
+                       IsFailure = true;
+                       this.message = message;
+                       this.stackTrace = stackTrace;
+               }
+
+               public override string Message
+               {
+                       get { return message; }
+               }
+
+               public override string StackTrace
+               {
+                       get 
+                       { 
+                               return stackTrace;
+                       }
+               }
+
+               public override string ToString()
+               {
+                       StringBuilder builder = new StringBuilder();
+                       string name = Name;
+                       if ( Test != null )
+                               name = Test.FullName;
+                       
+                       builder.AppendFormat("{0} : " , name);
+                       if(!IsSuccess)
+                               builder.Append(message);
+
+                       return builder.ToString();
+               }
+
+               public override void Accept(ResultVisitor visitor) 
+               {
+                       visitor.visit(this);
+               }
+       }
+}
diff --git a/mcs/nunit20/framework/TestDomain.cs b/mcs/nunit20/framework/TestDomain.cs
new file mode 100755 (executable)
index 0000000..669890f
--- /dev/null
@@ -0,0 +1,205 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+using System;
+
+namespace NUnit.Framework
+{
+       using NUnit.Core;
+       using System.Runtime.Remoting;
+       using System.Security.Policy;
+       using System.Reflection;
+       using System.Collections;
+       using System.Collections.Specialized;
+       using System.Configuration;
+       using System.IO;
+
+       /// <summary>
+       /// Summary description for TestDomain.
+       /// </summary>
+       public class TestDomain
+       {
+               private string assemblyName; 
+               private AppDomain domain; 
+               private string cachePath;
+               private RemoteTestRunner testRunner;
+               private TextWriter outStream;
+               private TextWriter errorStream;
+
+               public TestDomain(TextWriter outStream, TextWriter errorStream)
+               {
+                       this.outStream = outStream;
+                       this.errorStream = errorStream;
+               }
+
+               private void ThrowIfAlreadyLoaded()
+               {
+                       if ( domain != null || testRunner != null )
+                               throw new InvalidOperationException( "TestDomain already loaded" );
+               }
+
+               public Test Load(string assemblyFileName)
+               {
+                       ThrowIfAlreadyLoaded();
+
+                       assemblyName = assemblyFileName; 
+                       FileInfo file = new FileInfo(assemblyFileName);
+
+                       try
+                       {
+                               domain = MakeAppDomain(file);
+                               testRunner = MakeRemoteTestRunner(file, domain);
+                               return testRunner.Test;
+                       }
+                       catch (Exception e)
+                       {
+                               Unload();
+                               throw e;
+                       }
+               }
+
+               public Test Load(string testFixture, string assemblyFileName)
+               {
+                       ThrowIfAlreadyLoaded();
+
+                       assemblyName = assemblyFileName; 
+                       FileInfo file = new FileInfo(assemblyFileName);
+
+                       try
+                       {
+                               domain = MakeAppDomain(file);
+
+                               testRunner = (
+                                       RemoteTestRunner) domain.CreateInstanceAndUnwrap(
+                                       typeof(RemoteTestRunner).Assembly.FullName, 
+                                       typeof(RemoteTestRunner).FullName,
+                                       false, BindingFlags.Default,null,null,null,null,null);
+                       
+                               if(testRunner != null)
+                               {
+                                       testRunner.Initialize(testFixture, file.FullName);
+                                       domain.DoCallBack(new CrossAppDomainDelegate(testRunner.BuildSuite));
+                                       return testRunner.Test;
+                               }
+                               else
+                               {
+                                       Unload();
+                                       return null;
+                               }
+                       }
+                       catch (Exception e)
+                       {
+                               Unload();
+                               throw e;
+                       }
+               }
+
+               public string AssemblyName
+               {
+                       get { return assemblyName; }
+               }
+
+               public string TestName
+               {
+                       get { return testRunner.TestName; }
+                       set { testRunner.TestName = value; }
+               }
+
+               public TestResult Run(NUnit.Core.EventListener listener)
+               {
+                       return testRunner.Run(listener, outStream, errorStream);
+               }
+
+               public void Unload()
+               {
+                       testRunner = null;
+
+                       if(domain != null) 
+                       {
+                               AppDomain.Unload(domain);
+                               DirectoryInfo cacheDir = new DirectoryInfo(cachePath);
+                               if(cacheDir.Exists) cacheDir.Delete(true);
+                       }
+                       domain = null;
+               }
+
+               private AppDomain MakeAppDomain(FileInfo file)
+               {
+                       AppDomainSetup setup = new AppDomainSetup();
+                       setup.ApplicationBase = Directory.GetDirectoryRoot(file.DirectoryName);
+                       setup.PrivateBinPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase
+                               + ";" + file.DirectoryName;
+                       setup.ApplicationName = "Tests";
+
+                       setup.ShadowCopyFiles = "true";
+                       setup.ShadowCopyDirectories = file.DirectoryName;
+
+
+                       setup.ConfigurationFile = file.DirectoryName + @"\" +
+                               file.Name + ".config";
+
+                       Evidence baseEvidence = AppDomain.CurrentDomain.Evidence;
+                       Evidence evidence = new Evidence(baseEvidence);
+
+                       string domainName = String.Format("domain-{0}", file.Name);
+                       AppDomain runnerDomain = AppDomain.CreateDomain(domainName, evidence, setup);
+                       ConfigureCachePath(runnerDomain);
+                       return runnerDomain;
+               }
+
+               private void ConfigureCachePath(AppDomain domain)
+               {
+                       cachePath = String.Format(@"{0}\{1}", 
+                               ConfigurationSettings.AppSettings["shadowfiles.path"], DateTime.Now.Ticks);
+                       cachePath = Environment.ExpandEnvironmentVariables(cachePath);
+
+                       DirectoryInfo dir = new DirectoryInfo(cachePath);
+                       if(dir.Exists) dir.Delete(true);
+
+                       domain.SetCachePath(cachePath);
+
+                       return;
+               }
+
+               private static RemoteTestRunner MakeRemoteTestRunner(FileInfo file, AppDomain runnerDomain)
+               {
+                       RemoteTestRunner runner = (
+                               RemoteTestRunner) runnerDomain.CreateInstanceAndUnwrap(
+                               typeof(RemoteTestRunner).Assembly.FullName, 
+                               typeof(RemoteTestRunner).FullName,
+                               true, BindingFlags.Default,null,null,null,null,null);
+                       if(runner != null)
+                       {
+                               runner.Initialize(file.FullName);
+                               runnerDomain.DoCallBack(new CrossAppDomainDelegate(runner.BuildSuite));
+                       }
+                       return runner;
+               }
+       }
+}
diff --git a/mcs/nunit20/framework/TestFixtureAttribute.cs b/mcs/nunit20/framework/TestFixtureAttribute.cs
new file mode 100755 (executable)
index 0000000..bf4ee86
--- /dev/null
@@ -0,0 +1,45 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Framework
+{
+       using System;
+
+       /// <summary>
+       /// TestFixtureAttribute
+       /// </summary> 
+       /// <example>
+       /// [TestFixture]
+       /// public class ExampleClass 
+       /// {}
+       /// </example>
+       [AttributeUsage(AttributeTargets.Class, AllowMultiple=false, Inherited=true)]
+       public sealed class TestFixtureAttribute : Attribute
+       {}
+}
\ No newline at end of file
diff --git a/mcs/nunit20/framework/TestFixtureSetUpAttribute.cs b/mcs/nunit20/framework/TestFixtureSetUpAttribute.cs
new file mode 100755 (executable)
index 0000000..4d88cb8
--- /dev/null
@@ -0,0 +1,38 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Framework
+{
+       using System;
+
+       [AttributeUsage(AttributeTargets.Method, AllowMultiple=false)]
+       public class TestFixtureSetUpAttribute : Attribute
+       {
+       }
+}
diff --git a/mcs/nunit20/framework/TestFixtureTearDownAttribute.cs b/mcs/nunit20/framework/TestFixtureTearDownAttribute.cs
new file mode 100755 (executable)
index 0000000..62bd0e0
--- /dev/null
@@ -0,0 +1,39 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Framework
+{
+       using System;
+
+       [AttributeUsage(AttributeTargets.Method, AllowMultiple=false)]
+       public class TestFixtureTearDownAttribute : Attribute
+       {
+       }
+}
+
diff --git a/mcs/nunit20/framework/TestInfo.cs b/mcs/nunit20/framework/TestInfo.cs
new file mode 100755 (executable)
index 0000000..4fb002b
--- /dev/null
@@ -0,0 +1,51 @@
+namespace NUnit.Core
+{
+       using System;
+       using System.Collections;
+
+       /// <summary>
+       /// Common interface supported by all representations
+       /// of a test. Only includes informational fields.
+       /// The Run method is specifically excluded to allow
+       /// for data-only representations of a test.
+       /// </summary>
+       public interface TestInfo
+       {
+               /// <summary>
+               /// Name of the test
+               /// </summary>
+               string Name     { get; }
+               
+               /// <summary>
+               /// Full Name of the test
+               /// </summary>
+               string FullName { get; }
+
+               /// <summary>
+               /// Whether or not the test should be run
+               /// </summary>
+               bool ShouldRun { get; set; }
+
+               /// <summary>
+               /// Reason for not running the test, if applicable
+               /// </summary>
+               string IgnoreReason { get; set; }
+               
+               /// <summary>
+               /// Count of the test cases ( 1 if this is a test case )
+               /// </summary>
+               int CountTestCases { get; }
+
+               /// <summary>
+               /// For a test suite, the child tests or suites
+               /// Null if this is not a test suite
+               /// </summary>
+               ArrayList Tests { get; }
+
+               /// <summary>
+               /// True if this is a suite
+               /// </summary>
+               bool IsSuite { get; }
+       }
+}
+
diff --git a/mcs/nunit20/framework/TestResult.cs b/mcs/nunit20/framework/TestResult.cs
new file mode 100755 (executable)
index 0000000..9bcffda
--- /dev/null
@@ -0,0 +1,112 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Core
+{
+       using System;
+
+       /// <summary>
+       /// Summary description for TestResult.
+       /// </summary>
+       /// 
+       [Serializable]
+       public abstract class TestResult
+       {
+               private bool executed;
+               private bool isFailure; 
+               private double time;
+               private string name;
+               private TestInfo test;
+
+#if NUNIT_LEAKAGE_TEST
+               private long leakage = 0;
+#endif
+               
+               protected TestResult(TestInfo test, string name)
+               {
+                       this.name = name;
+                       this.test = test;
+               }
+
+               public bool Executed 
+               {
+                       get { return executed; }
+                       set { executed = value; }
+               }
+
+               public virtual string Name
+               {
+                       get{ return name;}
+               }
+
+               public TestInfo Test
+               {
+                       get{ return test;}
+               }
+
+               public virtual bool IsSuccess
+               {
+                       get { return !(isFailure); }
+               }
+               
+               public virtual bool IsFailure
+               {
+                       get { return isFailure; }
+                       set { isFailure = value; }
+               }
+
+               public double Time 
+               {
+                       get{ return time; }
+                       set{ time = value; }
+               }
+
+#if NUNIT_LEAKAGE_TEST
+               public long Leakage
+               {
+                       get{ return leakage; }
+                       set{ leakage = value; }
+               }
+#endif
+
+               public abstract string Message
+               {
+                       get;
+               }
+
+               public abstract string StackTrace
+               {
+                       get;
+               }
+
+               public abstract void NotRun(string message);
+
+               public abstract void Accept(ResultVisitor visitor);
+       }
+}
diff --git a/mcs/nunit20/framework/TestSuite.cs b/mcs/nunit20/framework/TestSuite.cs
new file mode 100755 (executable)
index 0000000..ba01a8c
--- /dev/null
@@ -0,0 +1,172 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Core
+{
+       using System;
+       using System.Collections;
+       using System.Reflection;
+
+       /// <summary>
+       /// Summary description for TestSuite.
+       /// </summary>
+       /// 
+       [Serializable]
+       public class TestSuite : Test
+       {
+               private ArrayList tests = new ArrayList();
+               private MethodInfo fixtureSetUp;
+               private MethodInfo fixtureTearDown;
+               private object fixture;
+
+               public TestSuite(string name) : base(name)
+               {
+                       ShouldRun = true;
+               }
+
+               public TestSuite(string parentSuiteName, string name) : base(parentSuiteName,name)
+               {
+                       ShouldRun = true;
+               }
+
+               protected internal virtual void Add(Test test) 
+               {
+                       if(test.ShouldRun)
+                       {
+                               test.ShouldRun = ShouldRun;
+                               test.IgnoreReason = IgnoreReason;
+                       }
+                       tests.Add(test);
+               }
+
+               protected internal virtual TestSuite CreateNewSuite(Type type)
+               {
+                       return new TestSuite(type.Namespace,type.Name);
+               }
+
+               public void Add(object fixture) 
+               {
+                       TestSuite testSuite = CreateNewSuite(fixture.GetType());
+                       testSuite.fixture = fixture;
+                       testSuite.fixtureSetUp = this.FindMethodByAttribute(fixture, typeof(NUnit.Framework.TestFixtureSetUpAttribute));
+                       testSuite.fixtureTearDown = this.FindMethodByAttribute(fixture, typeof(NUnit.Framework.TestFixtureTearDownAttribute));
+                       Add(testSuite);
+
+                       Type ignoreMethodAttribute = typeof(NUnit.Framework.IgnoreAttribute);
+                       object[] attributes = fixture.GetType().GetCustomAttributes(ignoreMethodAttribute, false);
+                       if(attributes.Length == 1)
+                       {
+                               NUnit.Framework.IgnoreAttribute attr = (NUnit.Framework.IgnoreAttribute)attributes[0];
+                               testSuite.ShouldRun = false;
+                               testSuite.IgnoreReason = attr.Reason;
+                       }
+
+                       MethodInfo [] methods = fixture.GetType().GetMethods(BindingFlags.Public|BindingFlags.Instance|BindingFlags.NonPublic);
+                       foreach(MethodInfo method in methods)
+                       {
+                               TestCase testCase = TestCaseBuilder.Make(fixture, method);
+                               if(testCase != null)
+                                       testSuite.Add(testCase);
+                       }
+
+                       if(testSuite.CountTestCases == 0)
+                       {
+                               testSuite.ShouldRun = false;
+                               testSuite.IgnoreReason = testSuite.Name + " does not have any tests";
+                       }
+               }
+
+               public override ArrayList Tests 
+               {
+                       get { return tests; }
+               }
+
+               public override bool IsSuite
+               {
+                       get { return true; }
+               }
+
+               public override int CountTestCases 
+               {
+                       get 
+                       {
+                               int count = 0;
+
+                               foreach(Test test in Tests)
+                               {
+                                       count += test.CountTestCases;
+                               }
+                               return count;
+                       }
+               }
+
+               public override TestResult Run(EventListener listener)
+               {
+                       TestSuiteResult suiteResult = new TestSuiteResult(this, Name);
+
+                       listener.SuiteStarted(this);
+
+                       suiteResult.Executed = true;
+
+                       long startTime = DateTime.Now.Ticks;
+
+                       
+                       try 
+                       {
+                               if (this.fixtureSetUp != null)
+                                       this.InvokeMethod(fixtureSetUp, fixture);
+                               RunAllTests(suiteResult,listener);
+                       } 
+                       finally 
+                       {
+                               if (this.fixtureTearDown != null)
+                                       this.InvokeMethod(fixtureTearDown, fixture);
+                       }
+
+                       long stopTime = DateTime.Now.Ticks;
+
+                       double time = ((double)(stopTime - startTime)) / (double)TimeSpan.TicksPerSecond;
+
+                       suiteResult.Time = time;
+                       if(!ShouldRun) suiteResult.NotRun(this.IgnoreReason);
+
+                       listener.SuiteFinished(suiteResult);
+
+                       return suiteResult;
+               }
+
+               protected virtual void RunAllTests(TestSuiteResult suiteResult,EventListener listener)
+               {
+                       foreach(Test test in Tests)
+                       {
+                               suiteResult.AddResult(test.Run(listener));
+                       }
+               }
+       }
+}
diff --git a/mcs/nunit20/framework/TestSuiteBuilder.cs b/mcs/nunit20/framework/TestSuiteBuilder.cs
new file mode 100755 (executable)
index 0000000..49be2be
--- /dev/null
@@ -0,0 +1,289 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Core
+{
+       using System;
+       using System.IO;
+       using System.Reflection;
+       using System.Collections;
+
+       /// <summary>
+       /// Summary description for TestSuiteBuilder.
+       /// </summary>
+       public class TestSuiteBuilder
+       {
+               Hashtable suites  = new Hashtable();
+               TestSuite rootSuite;
+
+               public string TrimPathAndExtension(string assemblyName) 
+               {
+                       FileInfo info = new FileInfo(assemblyName);
+                       string name = info.Name;
+                       string extension = info.Extension;
+                       if (extension != String.Empty)
+                               name = name.Substring(0, name.IndexOf(extension));
+
+                       return name;
+               }
+
+               public Assembly Load(string assemblyName)
+               {
+                       Assembly assembly = AppDomain.CurrentDomain.Load(TrimPathAndExtension(assemblyName));
+                       return assembly;
+               }
+
+               private TestSuite BuildFromNameSpace(string nameSpace)
+               {
+                       if( nameSpace == null || nameSpace  == "" ) return rootSuite;
+                       TestSuite suite = (TestSuite)suites[nameSpace];
+                       if(suite!=null) return suite;
+                       int index = nameSpace.LastIndexOf(".");
+                       if(index==-1)
+                       {
+                               suite = new TestSuite(nameSpace);
+                               rootSuite.Add(suite);
+                               suites[nameSpace]=suite;
+                               return suite;
+                       }
+                       string parentNameSpace=nameSpace.Substring( 0,index);
+                       TestSuite parent = BuildFromNameSpace(parentNameSpace);
+                       string suiteName = nameSpace.Substring(index+1);
+                       suite = new TestSuite(parentNameSpace,suiteName);
+                       suites[nameSpace]=suite;
+                       parent.Add(suite);
+                       return suite;
+               }
+
+               public TestSuite Build(string assemblyName)
+               {
+                       TestSuiteBuilder builder = new TestSuiteBuilder();
+
+                       Assembly assembly = Load(assemblyName);
+
+                       builder.rootSuite = new TestSuite(assemblyName);
+                       int testFixtureCount = 0;
+                       Type[] testTypes = assembly.GetExportedTypes();
+                       foreach(Type testType in testTypes)
+                       {
+                               if(IsTestFixture(testType))
+                               {
+                                       testFixtureCount++;
+                                       string namespaces = testType.Namespace;
+                                       TestSuite suite = builder.BuildFromNameSpace(namespaces);
+
+                                       try
+                                       {
+                                               object fixture = BuildTestFixture(testType);
+                                               suite.Add(fixture);
+                                       }
+                                       catch(InvalidTestFixtureException exception)
+                                       {
+                                               InvalidFixture fixture = new InvalidFixture(testType, exception.Message);
+                                               suite.Add(fixture);
+                                       }
+                               }
+                       }
+
+                       if(testFixtureCount == 0)
+                               throw new NoTestFixturesException(assemblyName + " has no TestFixtures");
+
+                       return builder.rootSuite;
+               }
+
+
+               public TestSuite Build(string testName, string assemblyName)
+               {
+                       TestSuite suite = null;
+
+                       Assembly assembly = Load(assemblyName);
+
+                       if(assembly != null)
+                       {
+                               Type testType = assembly.GetType(testName);
+                               if(testType != null)
+                               {
+                                       if(IsTestFixture(testType))
+                                       {
+                                               suite = MakeSuiteFromTestFixtureType(testType);
+                                       }
+                                       else if(IsTestSuiteProperty(testType))
+                                       {
+                                               suite = MakeSuiteFromProperty(testType);
+                                       }
+                               }
+                       }
+                       return suite;
+               }
+
+               private bool IsTestFixture(Type type)
+               {
+                       if(type.IsAbstract) return false;
+
+                       return type.IsDefined(typeof(NUnit.Framework.TestFixtureAttribute), true);
+               }
+
+               public object BuildTestFixture(Type fixtureType)
+               {
+                       ConstructorInfo ctor = fixtureType.GetConstructor(Type.EmptyTypes);
+                       if(ctor == null) throw new InvalidTestFixtureException(fixtureType.FullName + " does not have a valid constructor");
+
+                       object testFixture = ctor.Invoke(Type.EmptyTypes);
+                       if(testFixture == null) throw new InvalidTestFixtureException(ctor.Name + " cannot be invoked");
+
+                       if(HasMultipleSetUpMethods(testFixture))
+                       {
+                               throw new InvalidTestFixtureException(ctor.Name + " has multiple SetUp methods");
+                       }
+                       if(HasMultipleTearDownMethods(testFixture))
+                       {
+                               throw new InvalidTestFixtureException(ctor.Name + " has multiple TearDown methods");
+                       }
+                       if(HasMultipleFixtureSetUpMethods(testFixture))
+                       {
+                               throw new InvalidTestFixtureException(ctor.Name + " has multiple TestFixtureSetUp methods");
+                       }
+                       if(HasMultipleFixtureTearDownMethods(testFixture))
+                       {
+                               throw new InvalidTestFixtureException(ctor.Name + " has multiple TestFixtureTearDown methods");
+                       }
+
+                       return testFixture;
+               }
+
+               private int CountMethodWithGivenAttribute(object fixture, Type type)
+               {
+                       int count = 0;
+                       foreach(MethodInfo method in fixture.GetType().GetMethods(BindingFlags.Public|BindingFlags.Instance|BindingFlags.NonPublic|BindingFlags.DeclaredOnly))
+                       {
+                               if(method.IsDefined(type,false)) 
+                                       count++;
+                       }
+                       return count;
+
+               }
+
+               private bool HasMultipleSetUpMethods(object fixture)
+               {
+                       return CountMethodWithGivenAttribute(fixture,typeof(NUnit.Framework.SetUpAttribute)) > 1;
+               }
+
+               private bool HasMultipleTearDownMethods(object fixture)
+               {
+                       return CountMethodWithGivenAttribute(fixture,typeof(NUnit.Framework.TearDownAttribute)) > 1;
+               }
+
+               private bool HasMultipleFixtureSetUpMethods(object fixture)
+               {
+                       return CountMethodWithGivenAttribute(fixture,typeof(NUnit.Framework.TestFixtureSetUpAttribute)) > 1;
+               }
+
+               private bool HasMultipleFixtureTearDownMethods(object fixture)
+               {
+                       return CountMethodWithGivenAttribute(fixture,typeof(NUnit.Framework.TestFixtureTearDownAttribute)) > 1;
+               }
+
+               public TestSuite MakeSuiteFromTestFixtureType(Type fixtureType)
+               {
+                       TestSuite suite = new TestSuite(fixtureType.Name);
+                       try
+                       {
+                               object testFixture = BuildTestFixture(fixtureType);
+                               suite.Add(testFixture);
+                       }
+                       catch(InvalidTestFixtureException exception)
+                       {
+                               InvalidFixture fixture = new InvalidFixture(fixtureType,exception.Message);
+                               suite.ShouldRun = false;
+                               suite.IgnoreReason = exception.Message;
+                               suite.Add(fixture);
+                       }
+
+                       return suite;
+               }
+
+               private bool IsTestSuiteProperty(Type testClass)
+               {
+                       return (GetSuiteProperty(testClass) != null);
+               }
+
+               /// <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>
+               private TestSuite MakeSuiteFromProperty(Type testClass) 
+               {
+                       TestSuite suite = null;
+                       PropertyInfo suiteProperty = null;
+                       try
+                       {
+                               suiteProperty=GetSuiteProperty(testClass);
+                               suite = (TestSuite)suiteProperty.GetValue(null, new Object[0]);
+                       }
+                       catch(InvalidSuiteException)
+                       {
+                               return null;
+                       }
+                       return suite;
+               }
+
+               private PropertyInfo GetSuiteProperty(Type testClass)
+               {
+                       if(testClass != null)
+                       {
+                               PropertyInfo[] properties = testClass.GetProperties(BindingFlags.Static | BindingFlags.Public | BindingFlags.DeclaredOnly);
+                               foreach(PropertyInfo property in properties)
+                               {
+                                       object[] attrributes = property.GetCustomAttributes(typeof(NUnit.Framework.SuiteAttribute),false);
+                                       if(attrributes.Length>0)
+                                       {
+                                               try {
+                                                       CheckSuiteProperty(property);
+                                               }catch(InvalidSuiteException){
+                                                       return null;
+                                               }
+                                               return property;
+                                       }
+                               }
+                       }
+                       return null;
+               }
+
+               private void CheckSuiteProperty(PropertyInfo property)
+               {
+                       MethodInfo method = property.GetGetMethod(true);
+                       if(method.ReturnType!=typeof(NUnit.Core.TestSuite))
+                               throw new InvalidSuiteException("Invalid suite property method signature");
+                       if(method.GetParameters().Length>0)
+                               throw new InvalidSuiteException("Invalid suite property method signature");
+               }
+       }
+}
diff --git a/mcs/nunit20/framework/TestSuiteResult.cs b/mcs/nunit20/framework/TestSuiteResult.cs
new file mode 100755 (executable)
index 0000000..3714339
--- /dev/null
@@ -0,0 +1,105 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Core
+{
+       using System;
+       using System.Collections;
+
+       /// <summary>
+       ///             TestSuiteResult
+       /// </summary>
+       /// 
+       [Serializable]
+       public class TestSuiteResult : TestResult
+       {
+               private ArrayList results = new ArrayList();
+               private string message;
+               
+               public TestSuiteResult(Test test, string name) : base(test, name)
+               {
+                       Executed = false;
+               }
+
+               public void AddResult(TestResult result) 
+               {
+                       results.Add(result);
+               }
+
+               public override bool IsSuccess
+               {
+                       get 
+                       {
+                               bool result = true;
+                               foreach(TestResult testResult in results)
+                                       result &= testResult.IsSuccess;
+                               return result;
+                       }
+               }
+
+               public override bool IsFailure
+               {
+                       get 
+                       {
+                               bool result = false;
+                               foreach(TestResult testResult in results)
+                                       result |= testResult.IsFailure;
+                               return result;
+                       }
+               }
+
+               public override void NotRun(string message)
+               {
+                       this.Executed = false;
+                       this.message = message;
+               }
+
+
+               public override string Message
+               {
+                       get { return message; }
+               }
+
+               public override string StackTrace
+               {
+                       get { return null; }
+               }
+
+
+               public IList Results
+               {
+                       get { return results; }
+               }
+
+               public override void Accept(ResultVisitor visitor) 
+               {
+                       visitor.visit(this);
+               }
+       }
+}
diff --git a/mcs/nunit20/framework/Transform.resx b/mcs/nunit20/framework/Transform.resx
new file mode 100755 (executable)
index 0000000..670c70a
--- /dev/null
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<root>\r
+  <!-- \r
+            Microsoft ResX Schema \r
+        \r
+            Version 1.3\r
+                \r
+            The primary goals of this format is to allow a simple XML format \r
+            that is mostly human readable. The generation and parsing of the \r
+            various data types are done through the TypeConverter classes \r
+            associated with the data types.\r
+        \r
+            Example:\r
+        \r
+                ... ado.net/XML headers & schema ...\r
+                <resheader name="resmimetype">text/microsoft-resx</resheader>\r
+                <resheader name="version">1.3</resheader>\r
+                <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>\r
+                <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>\r
+                <data name="Name1">this is my long string</data>\r
+                <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>\r
+                <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">\r
+                    [base64 mime encoded serialized .NET Framework object]\r
+                </data>\r
+                <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">\r
+                    [base64 mime encoded string representing a byte array form of the .NET Framework object]\r
+                </data>\r
+        \r
+            There are any number of "resheader" rows that contain simple \r
+            name/value pairs.\r
+            \r
+            Each data row contains a name, and value. The row also contains a \r
+            type or mimetype. Type corresponds to a .NET class that support \r
+            text/value conversion through the TypeConverter architecture. \r
+            Classes that don't support this are serialized and stored with the \r
+            mimetype set.\r
+                     \r
+            The mimetype is used for serialized objects, and tells the \r
+            ResXResourceReader how to depersist the object. This is currently not \r
+            extensible. For a given mimetype the value must be set accordingly:\r
+        \r
+            Note - application/x-microsoft.net.object.binary.base64 is the format \r
+                   that the ResXResourceWriter will generate, however the reader can \r
+                   read any of the formats listed below.\r
+        \r
+            mimetype: application/x-microsoft.net.object.binary.base64\r
+            value   : The object must be serialized with \r
+                    : System.Serialization.Formatters.Binary.BinaryFormatter\r
+                    : and then encoded with base64 encoding.\r
+        \r
+            mimetype: application/x-microsoft.net.object.soap.base64\r
+            value   : The object must be serialized with \r
+                    : System.Runtime.Serialization.Formatters.Soap.SoapFormatter\r
+                    : and then encoded with base64 encoding.\r
+            mimetype: application/x-microsoft.net.object.bytearray.base64\r
+            value   : The object must be serialized into a byte array \r
+                    : using a System.ComponentModel.TypeConverter\r
+                    : and then encoded with base64 encoding.\r
+        -->\r
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">\r
+    <xsd:element name="root" msdata:IsDataSet="true">\r
+      <xsd:complexType>\r
+        <xsd:choice maxOccurs="unbounded">\r
+          <xsd:element name="data">\r
+            <xsd:complexType>\r
+              <xsd:sequence>\r
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />\r
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />\r
+              </xsd:sequence>\r
+              <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />\r
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />\r
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />\r
+            </xsd:complexType>\r
+          </xsd:element>\r
+          <xsd:element name="resheader">\r
+            <xsd:complexType>\r
+              <xsd:sequence>\r
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />\r
+              </xsd:sequence>\r
+              <xsd:attribute name="name" type="xsd:string" use="required" />\r
+            </xsd:complexType>\r
+          </xsd:element>\r
+        </xsd:choice>\r
+      </xsd:complexType>\r
+    </xsd:element>\r
+  </xsd:schema>\r
+  <resheader name="resmimetype">\r
+    <value>text/microsoft-resx</value>\r
+  </resheader>\r
+  <resheader name="version">\r
+    <value>1.3</value>\r
+  </resheader>\r
+  <resheader name="reader">\r
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
+  </resheader>\r
+  <resheader name="writer">\r
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
+  </resheader>\r
+  <data name="Summary.xslt">\r
+    <value>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;\r
+&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;\r
+&lt;xsl:output method='text'/&gt;\r
+\r
+&lt;xsl:template match="/"&gt;\r
+       &lt;xsl:apply-templates/&gt;\r
+&lt;/xsl:template&gt;\r
+\r
+&lt;xsl:template match="test-results"&gt;\r
+&lt;xsl:text&gt;Tests run: &lt;/xsl:text&gt;\r
+&lt;xsl:value-of select="@total"/&gt;\r
+&lt;xsl:text&gt;, Failures: &lt;/xsl:text&gt;\r
+&lt;xsl:value-of select="@failures"/&gt;\r
+&lt;xsl:text&gt;, Not run: &lt;/xsl:text&gt;\r
+&lt;xsl:value-of select="@not-run"/&gt;\r
+&lt;xsl:text&gt;, Time: &lt;/xsl:text&gt;\r
+&lt;xsl:value-of select="test-suite/@time"/&gt;\r
+&lt;xsl:text&gt; seconds\r
+&lt;/xsl:text&gt;\r
+&lt;xsl:text&gt;\r
+&lt;/xsl:text&gt;\r
+\r
+&lt;xsl:if test="//test-case[failure]"&gt;&lt;xsl:text&gt;Failures:\r
+&lt;/xsl:text&gt;&lt;/xsl:if&gt;\r
+&lt;xsl:apply-templates select="//test-case[failure]"/&gt;\r
+&lt;xsl:if test="//test-case[@executed='False']"&gt;&lt;xsl:text&gt;Tests not run:\r
+&lt;/xsl:text&gt;&lt;/xsl:if&gt;\r
+&lt;xsl:apply-templates select="//test-case[@executed='False']"/&gt;\r
+&lt;xsl:text disable-output-escaping='yes'&gt;&amp;#xA;&lt;/xsl:text&gt;\r
+&lt;/xsl:template&gt;\r
+\r
+&lt;xsl:template match="test-case"&gt;\r
+       &lt;xsl:value-of select="position()"/&gt;&lt;xsl:text&gt;) &lt;/xsl:text&gt;\r
+       &lt;xsl:value-of select="@name"/&gt;\r
+       &lt;xsl:text&gt; : &lt;/xsl:text&gt;\r
+       &lt;xsl:value-of select="child::node()/message"/&gt;\r
+&lt;xsl:text disable-output-escaping='yes'&gt;&amp;#xA;&lt;/xsl:text&gt;\r
+       &lt;xsl:if test="failure"&gt;\r
+               &lt;xsl:value-of select="failure/stack-trace"/&gt;\r
+&lt;xsl:text&gt;\r
+&lt;/xsl:text&gt;\r
+       &lt;/xsl:if&gt;\r
+&lt;/xsl:template&gt;\r
+\r
+&lt;/xsl:stylesheet&gt;\r
+\r
+  </value>\r
+  </data>\r
+</root>
\ No newline at end of file
diff --git a/mcs/nunit20/framework/WarningSuite.cs b/mcs/nunit20/framework/WarningSuite.cs
new file mode 100755 (executable)
index 0000000..9601532
--- /dev/null
@@ -0,0 +1,61 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+using System;
+
+namespace NUnit.Core
+{
+       /// <summary>
+       /// Summary description for WarningSuite.
+       /// </summary>
+       public class WarningSuite : TestSuite
+       {
+               public WarningSuite(string name) : base(name) 
+               {
+                       ShouldRun=false;
+               }
+
+               public WarningSuite(string parentName, string name) : base(parentName,name) 
+               {
+                       ShouldRun=false;
+               }
+
+               protected internal override void Add(Test test)
+               {
+                       base.Add(test);
+                       test.ShouldRun = false;
+                       test.IgnoreReason = "Containing Suite cannot be run";
+               }
+
+               protected internal override TestSuite CreateNewSuite(Type type) 
+               {
+                       return new WarningSuite(type.Namespace,type.Name);
+               }
+       }
+}
diff --git a/mcs/nunit20/framework/XmlResultVisitor.cs b/mcs/nunit20/framework/XmlResultVisitor.cs
new file mode 100755 (executable)
index 0000000..6faa781
--- /dev/null
@@ -0,0 +1,143 @@
+#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright © 2000-2002 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no 
+' event will the authors be held liable for any damages arising from the use of this 
+' software.
+' 
+' Permission is granted to anyone to use this software for any purpose, including 
+' commercial applications, and to alter it and redistribute it freely, subject to the 
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that 
+' you wrote the original software. If you use this software in a product, an 
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
+' or Copyright © 2000-2002 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be 
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Core
+{
+       using System;
+       using System.Globalization;
+       using System.IO;
+       using System.Xml;
+       using NUnit.Core;
+
+       /// <summary>
+       /// Summary description for XmlResultVisitor.
+       /// </summary>
+       public class XmlResultVisitor : ResultVisitor
+       {
+               private XmlTextWriter xmlWriter;
+
+               public XmlResultVisitor(string fileName, TestResult result)
+               {
+                       ResultSummarizer summaryResults = new ResultSummarizer(result);
+                       try
+                       {
+                               xmlWriter = new XmlTextWriter (fileName, null);
+                       }
+                       catch(Exception e)
+                       {
+                               Console.Error.WriteLine(e.StackTrace);
+                       }
+
+                       xmlWriter.Formatting = Formatting.Indented;
+                       xmlWriter.WriteStartDocument(false);
+                       xmlWriter.WriteComment("This file represents the results of running a test suite");
+
+                       xmlWriter.WriteStartElement("test-results");
+
+                       xmlWriter.WriteAttributeString("name", summaryResults.Name);
+                       xmlWriter.WriteAttributeString("total", summaryResults.ResultCount.ToString());
+                       xmlWriter.WriteAttributeString("failures", summaryResults.Failures.ToString());
+                       xmlWriter.WriteAttributeString("not-run", summaryResults.TestsNotRun.ToString());
+
+                       DateTime now = DateTime.Now;
+                       xmlWriter.WriteAttributeString("date", now.ToShortDateString());
+                       xmlWriter.WriteAttributeString("time", now.ToShortTimeString());
+
+               }
+
+               public void visit(TestCaseResult caseResult) 
+               {
+                       xmlWriter.WriteStartElement("test-case");
+                       xmlWriter.WriteAttributeString("name",caseResult.Name);
+                       xmlWriter.WriteAttributeString("executed", caseResult.Executed.ToString());
+                       if(caseResult.Executed)
+                       {
+                               xmlWriter.WriteAttributeString("success", caseResult.IsSuccess.ToString());
+
+                               xmlWriter.WriteAttributeString("time", caseResult.Time.ToString("#####0.000", NumberFormatInfo.InvariantInfo));
+
+                               if(caseResult.IsFailure)
+                               {
+                                       if(caseResult.IsFailure)
+                                               xmlWriter.WriteStartElement("failure");
+                                       else
+                                               xmlWriter.WriteStartElement("error");
+                               
+                                       xmlWriter.WriteStartElement("message");
+                                       xmlWriter.WriteCData(caseResult.Message);
+                                       xmlWriter.WriteEndElement();
+                               
+                                       xmlWriter.WriteStartElement("stack-trace");
+                                       if(caseResult.StackTrace != null)
+                                               xmlWriter.WriteCData(StackTraceFilter.Filter(caseResult.StackTrace));
+                                       xmlWriter.WriteEndElement();
+                               
+                                       xmlWriter.WriteEndElement();
+                               }
+                               
+                       }
+                       else
+                       {
+                               xmlWriter.WriteStartElement("reason");
+                               xmlWriter.WriteStartElement("message");
+                               xmlWriter.WriteCData(caseResult.Message);
+                               xmlWriter.WriteEndElement();
+                               xmlWriter.WriteEndElement();
+                       }
+            
+                       xmlWriter.WriteEndElement();
+               }
+
+               public void visit(TestSuiteResult suiteResult) 
+               {
+                       xmlWriter.WriteStartElement("test-suite");
+                       xmlWriter.WriteAttributeString("name",suiteResult.Name);
+                       xmlWriter.WriteAttributeString("success", suiteResult.IsSuccess.ToString());
+                       xmlWriter.WriteAttributeString("time", suiteResult.Time.ToString());
+            
+                       xmlWriter.WriteStartElement("results");                  
+                       foreach (TestResult result in suiteResult.Results)
+                       {
+                               result.Accept(this);
+                       }
+                       xmlWriter.WriteEndElement();
+
+                       xmlWriter.WriteEndElement();
+               }
+
+               public void Write()
+               {
+                       xmlWriter.WriteEndElement();
+
+                       xmlWriter.WriteEndDocument();
+                       xmlWriter.Flush();
+                       xmlWriter.Close();
+               }
+       }
+}
diff --git a/mcs/nunit20/framework/makefile.gnu b/mcs/nunit20/framework/makefile.gnu
new file mode 100755 (executable)
index 0000000..3e4e298
--- /dev/null
@@ -0,0 +1,12 @@
+#
+# Makefile for NUnit.Framework.dll
+#
+# Author:
+#   Jackson Harper (Jackson@LatitudeGeo.com)
+#
+
+all:
+       mcs *.cs /target:library /out:../NUnit.Framework.dll
+
+clean:
+       rm -f ../NUnit.Framework.dll
\ No newline at end of file
diff --git a/mcs/nunit20/framework/nunit.framework.dll.csproj b/mcs/nunit20/framework/nunit.framework.dll.csproj
new file mode 100755 (executable)
index 0000000..9500831
--- /dev/null
@@ -0,0 +1,320 @@
+<VisualStudioProject>
+    <CSHARP
+        ProjectType = "Local"
+        ProductVersion = "7.0.9466"
+        SchemaVersion = "1.0"
+        ProjectGuid = "{83DD7E12-A705-4DBA-9D71-09C8973D9382}"
+    >
+        <Build>
+            <Settings
+                ApplicationIcon = ""
+                AssemblyKeyContainerName = ""
+                AssemblyName = "nunit.framework"
+                AssemblyOriginatorKeyFile = ""
+                DefaultClientScript = "JScript"
+                DefaultHTMLPageLayout = "Grid"
+                DefaultTargetSchema = "IE50"
+                DelaySign = "false"
+                OutputType = "Library"
+                RootNamespace = "NUnit.Framework"
+                StartupObject = ""
+            >
+                <Config
+                    Name = "Debug"
+                    AllowUnsafeBlocks = "false"
+                    BaseAddress = "285212672"
+                    CheckForOverflowUnderflow = "false"
+                    ConfigurationOverrideFile = ""
+                    DefineConstants = "DEBUG;TRACE;NUNIT_LEAKAGE_TEST"
+                    DocumentationFile = ""
+                    DebugSymbols = "true"
+                    FileAlignment = "4096"
+                    IncrementalBuild = "true"
+                    Optimize = "false"
+                    OutputPath = "bin\Debug\"
+                    RegisterForComInterop = "false"
+                    RemoveIntegerChecks = "false"
+                    TreatWarningsAsErrors = "false"
+                    WarningLevel = "4"
+                />
+                <Config
+                    Name = "Release"
+                    AllowUnsafeBlocks = "false"
+                    BaseAddress = "285212672"
+                    CheckForOverflowUnderflow = "false"
+                    ConfigurationOverrideFile = ""
+                    DefineConstants = "TRACE;StronglyNamedAssembly"
+                    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"
+                    HintPath = "..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
+                />
+                <Reference
+                    Name = "System.Data"
+                    AssemblyName = "System.Data"
+                    HintPath = "..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
+                />
+                <Reference
+                    Name = "System.XML"
+                    AssemblyName = "System.Xml"
+                    HintPath = "..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
+                />
+            </References>
+        </Build>
+        <Files>
+            <Include>
+                <File
+                    RelPath = "AssemblyInfo.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "Assertion.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "AssertionException.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "AssertionFailureMessage.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "ConsoleWriter.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "EventListener.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "ExpectedExceptionAttribute.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "ExpectedExceptionTestCase.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "IgnoreAttribute.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "InvalidFixture.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "InvalidSuiteException.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "InvalidTestFixtureException.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "LongLivingMarshalByRefObject.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "NormalTestCase.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "NoTestFixturesException.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "NotRunnableTestCase.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "NullListener.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "NunitException.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "OldTestCase.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "RemoteTestRunner.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "Results.xsd"
+                    BuildAction = "Content"
+                />
+                <File
+                    RelPath = "Results.xsx"
+                    DependentUpon = "Results.xsd"
+                    BuildAction = "None"
+                />
+                <File
+                    RelPath = "ResultSummarizer.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "ResultVisitor.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "SetUpAttribute.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "StackTraceFilter.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "SuiteAttribute.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "Summary.xslt"
+                    BuildAction = "Content"
+                />
+                <File
+                    RelPath = "SummaryVisitor.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "TearDownAttribute.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "TemplateTestCase.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "Test.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "TestAttribute.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "TestCase.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "TestCaseBuilder.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "TestCaseResult.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "TestDomain.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "TestFixtureAttribute.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "TestFixtureSetUpAttribute.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "TestFixtureTearDownAttribute.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "TestInfo.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "TestResult.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "TestSuite.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "TestSuiteBuilder.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "TestSuiteResult.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "Transform.resx"
+                    BuildAction = "EmbeddedResource"
+                />
+                <File
+                    RelPath = "WarningSuite.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "XmlResultVisitor.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+            </Include>
+        </Files>
+    </CSHARP>
+</VisualStudioProject>
+