2003-10-12 Todd Berman <tberman@gentoo.org>
authorTodd Berman <tberman@mono-cvs.ximian.com>
Sun, 12 Oct 2003 18:48:28 +0000 (18:48 -0000)
committerTodd Berman <tberman@mono-cvs.ximian.com>
Sun, 12 Oct 2003 18:48:28 +0000 (18:48 -0000)
        * Lots of files changed, upgraded to nunit 2.1.4. I built and ran the
        corlib test, so it seems like existing tests should still work under
        this new version of nunit.

svn path=/trunk/mcs/; revision=18920

67 files changed:
mcs/nunit20/Changelog
mcs/nunit20/framework/AssemblyInfo.cs
mcs/nunit20/framework/Assertion.cs
mcs/nunit20/framework/AssertionException.cs
mcs/nunit20/framework/AssertionFailureMessage.cs
mcs/nunit20/framework/ConsoleWriter.cs
mcs/nunit20/framework/EventListener.cs
mcs/nunit20/framework/ExpectedExceptionAttribute.cs
mcs/nunit20/framework/ExpectedExceptionTestCase.cs
mcs/nunit20/framework/IgnoreAttribute.cs
mcs/nunit20/framework/InvalidFixture.cs
mcs/nunit20/framework/InvalidSuiteException.cs
mcs/nunit20/framework/InvalidTestFixtureException.cs
mcs/nunit20/framework/LongLivingMarshalByRefObject.cs
mcs/nunit20/framework/NUnit.Framework.dll.sources
mcs/nunit20/framework/NoTestFixturesException.cs
mcs/nunit20/framework/NormalTestCase.cs
mcs/nunit20/framework/NotRunnableTestCase.cs
mcs/nunit20/framework/NullListener.cs
mcs/nunit20/framework/NunitException.cs
mcs/nunit20/framework/OldTestCase.cs
mcs/nunit20/framework/RemoteTestRunner.cs
mcs/nunit20/framework/ResultSummarizer.cs
mcs/nunit20/framework/ResultVisitor.cs
mcs/nunit20/framework/Results.xsd
mcs/nunit20/framework/SetUpAttribute.cs
mcs/nunit20/framework/StackTraceFilter.cs
mcs/nunit20/framework/SuiteAttribute.cs
mcs/nunit20/framework/Summary.xslt
mcs/nunit20/framework/SummaryVisitor.cs
mcs/nunit20/framework/TearDownAttribute.cs
mcs/nunit20/framework/TemplateTestCase.cs
mcs/nunit20/framework/Test.cs
mcs/nunit20/framework/TestAttribute.cs
mcs/nunit20/framework/TestCase.cs
mcs/nunit20/framework/TestCaseBuilder.cs
mcs/nunit20/framework/TestCaseResult.cs
mcs/nunit20/framework/TestDomain.cs
mcs/nunit20/framework/TestFixtureAttribute.cs
mcs/nunit20/framework/TestFixtureSetUpAttribute.cs
mcs/nunit20/framework/TestFixtureTearDownAttribute.cs
mcs/nunit20/framework/TestResult.cs
mcs/nunit20/framework/TestSuite.cs
mcs/nunit20/framework/TestSuiteBuilder.cs
mcs/nunit20/framework/TestSuiteResult.cs
mcs/nunit20/framework/Transform.resx
mcs/nunit20/framework/WarningSuite.cs
mcs/nunit20/framework/XmlResultVisitor.cs
mcs/nunit20/framework/nunit.framework.dll.csproj
mcs/nunit20/nunit-console/AssemblyInfo.cs
mcs/nunit20/nunit-console/ConsoleUi.cs
mcs/nunit20/nunit-console/nunit-console.csproj
mcs/nunit20/util/AssemblyInfo.cs
mcs/nunit20/util/AssemblyWatcher.cs
mcs/nunit20/util/CommandLineOptions.cs
mcs/nunit20/util/ConsoleOptions.cs
mcs/nunit20/util/GuiOptions.cs
mcs/nunit20/util/Makefile
mcs/nunit20/util/NUnit.Util.dll.sources
mcs/nunit20/util/NUnitRegistry.cs
mcs/nunit20/util/RegistrySettingsStorage.cs
mcs/nunit20/util/SettingsGroup.cs
mcs/nunit20/util/SettingsStorage.cs
mcs/nunit20/util/TestEventArgs.cs
mcs/nunit20/util/UIHelper.cs
mcs/nunit20/util/UITestNode.cs
mcs/nunit20/util/nunit.util.dll.csproj

index a672b6230e7951c70ecd2774db74a0b0a1462fd6..ba5d2ad11f8770e4807c3b0901016f1ce87a63a9 100755 (executable)
@@ -1,3 +1,9 @@
+2003-10-12  Todd Berman  <tberman@gentoo.org>\r
+\r
+       * Lots of files changed, upgraded to nunit 2.1.4. I built and ran the\r
+       corlib test, so it seems like existing tests should still work under\r
+       this new version of nunit.\r
+\r
 2003-02-22  Martin Baulig  <martin@ximian.com>\r
 \r
        * makefile(s): Added `MCS' and `MCS_FLAGS' variables.\r
index 16bd384e2949a8349b2373e2c2048df79c581dd4..ed13bb4c93c1b06e999e01ccf92ec15ad4137a32 100755 (executable)
@@ -28,7 +28,7 @@ using System.Runtime.CompilerServices;
 // 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")]
+[assembly: AssemblyVersion("2.1.4.0")]
 
 //
 // In order to sign your assembly you must specify a key to use. Refer to the 
index f563c0bb7af2c320dd0a9144db012badb76978cf..c1b364eaa9213288ce83672bc5c23da5e1b5edf5 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright  2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright  2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright  2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright  2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
@@ -32,6 +32,8 @@ namespace NUnit.Framework
        using System;
 
        /// <summary>A set of Assert methods.</summary>
+       /// 
+       //[Obsolete("use Assert class instead")]
        public class Assertion
        {
                /// <summary>
@@ -43,8 +45,7 @@ namespace NUnit.Framework
                /// <param name="condition">The evaluated condition</param>
                static public void Assert(string message, bool condition) 
                {
-                       if (!condition)
-                               Assertion.Fail(message);
+                       NUnit.Framework.Assert.IsTrue(condition, message);
                }
     
                /// <summary>
@@ -96,8 +97,7 @@ namespace NUnit.Framework
 
                static public void AssertEquals(string message, int expected, int actual) 
                {
-                       if (expected != actual)
-                               Assertion.FailNotEquals(message, expected, actual);
+                       NUnit.Framework.Assert.AreEqual(expected, actual, message);
                }
                
                /// <summary>Asserts that two doubles are equal concerning a delta.
@@ -106,15 +106,7 @@ namespace NUnit.Framework
                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);
+                       NUnit.Framework.Assert.AreEqual(expected, actual, delta, message);
                }
                
                /// <summary>Asserts that two floats are equal concerning a delta.
@@ -123,81 +115,9 @@ namespace NUnit.Framework
                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);
+                       NUnit.Framework.Assert.AreEqual(expected, actual, delta, message);
                }
 
-        /// <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
@@ -208,42 +128,31 @@ namespace NUnit.Framework
                /// </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);
+                       NUnit.Framework.Assert.AreEqual(expected, actual, message);
                }
     
                /// <summary>Asserts that an object isn't null.</summary>
                static public void AssertNotNull(Object anObject) 
                {
-                       Assertion.AssertNotNull(string.Empty, anObject);
+                       NUnit.Framework.Assert.IsNotNull(anObject, string.Empty);
                }
     
                /// <summary>Asserts that an object isn't null.</summary>
                static public void AssertNotNull(string message, Object anObject) 
                {
-                       Assertion.Assert(message, anObject != null); 
+                       NUnit.Framework.Assert.IsNotNull(anObject, message);
                }
     
                /// <summary>Asserts that an object is null.</summary>
                static public void AssertNull(Object anObject) 
                {
-                       Assertion.AssertNull(string.Empty, anObject);
+                       NUnit.Framework.Assert.IsNull(anObject, string.Empty);
                }
     
                /// <summary>Asserts that an object is null.</summary>
                static public void AssertNull(string message, Object anObject) 
                {
-                       Assertion.Assert(message, anObject == null); 
+                       NUnit.Framework.Assert.IsNull(anObject, message);
                }
     
                /// <summary>Asserts that two objects refer to the same object. If they
@@ -251,7 +160,7 @@ namespace NUnit.Framework
                /// </summary>
                static public void AssertSame(Object expected, Object actual) 
                {
-                       Assertion.AssertSame(string.Empty, expected, actual);
+                       NUnit.Framework.Assert.AreSame(expected, actual, string.Empty);
                }
     
                /// <summary>Asserts that two objects refer to the same object. 
@@ -259,47 +168,19 @@ namespace NUnit.Framework
                /// </summary>
                static public void AssertSame(string message, Object expected, Object actual)
                {
-                       if (expected == actual)
-                               return;
-                       Assertion.FailNotSame(message, expected, actual);
+                       NUnit.Framework.Assert.AreSame(expected, actual, message);
                }
     
                /// <summary>Fails a test with no message.</summary>
                static public void Fail() 
                {
-                       Assertion.Fail(string.Empty);
+                       NUnit.Framework.Assert.Fail();
                }
     
                /// <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");
+                       NUnit.Framework.Assert.Fail(message);
                }
        }
 }
\ No newline at end of file
index dfec811803fdfbec314f22841ebd6363058068d9..ec5fb5db22342c833ba7c740097fd198ecedcca5 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
index e1891dae31536adca56a576d19ff6b79c4275fe2..59a0283bbb99da9758638aaa91872e48dfa27e34 100755 (executable)
@@ -1,9 +1,9 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig, Douglas de la Torre
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, 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
+' Copyright  2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' 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 
@@ -17,8 +17,8 @@
 ' 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
+' 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.
@@ -110,7 +110,7 @@ namespace NUnit.Framework
         {
             get
             {
-                return "\r\n";
+                return "\r\n\t";
             }
         }
 
@@ -226,14 +226,29 @@ namespace NUnit.Framework
         {
             sbOutput.Append( NewLine );
             sbOutput.Append( ExpectedText() );
-            sbOutput.Append( (expected != null) ? expected : "(null)" );
+            sbOutput.Append( DisplayString( expected ) );
             sbOutput.Append( ">" );
             sbOutput.Append( NewLine );
             sbOutput.Append( ButWasText() );
-            sbOutput.Append( (actual != null) ? actual : "(null)" );
+            sbOutput.Append( DisplayString( actual ) );
             sbOutput.Append( ">" );
         }
 
+               static protected string DisplayString( object  obj )
+               {
+                       if ( obj == null ) 
+                               return "(null)";
+                       else if ( obj is string )
+                               return Quoted( (string)obj );
+                       else
+                               return obj.ToString();
+               }
+
+               static protected string Quoted( string text )
+               {
+                       return string.Format( "\"{0}\"", text );
+               }
+
         /// <summary>
         /// Draws a marker under the expected/actual strings that highlights
         /// where in the string a mismatch occurred.
@@ -439,7 +454,7 @@ namespace NUnit.Framework
             //
             // Same strings
             //
-            Assertion.Assert( sExpected.Equals( sActual ) );
+            Assert.IsTrue( sExpected.Equals( sActual ) );
             return -1;
         }
 
@@ -542,7 +557,7 @@ namespace NUnit.Framework
         /// <param name="expected"></param>
         /// <param name="actual"></param>
         /// <returns></returns>
-        static public string FormatMessageForFailNotEquals(string message, Object expected, Object actual
+        static public string FormatMessageForFailNotEquals(Object expected, Object actual, string message
         {
             StringBuilder sbOutput = CreateStringBuilder( message );
             if( null != message )
index 27110c290a26326ad8e69465dc4ed196775244d3..d9caaafe1c0f1398733d68dc26fa190ff07be96d 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
index 7b2a7a7ff4b39d39d42f15fab1e6ae3aeb0a17e2..228e8709699b11a1016f1a7056a95d8d3834e8d6 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
index 4e31d475a9a201b1c6c68121cf2e7e925b099f87..89fd0b4fe10d5e41393e911dc4114c11f2b35870 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
@@ -39,17 +39,29 @@ namespace NUnit.Framework
        public sealed class ExpectedExceptionAttribute : Attribute
        {
                private Type expectedException;
+               private string expectedMessage;
 
                public ExpectedExceptionAttribute(Type exceptionType)
                {
                        expectedException = exceptionType;
                }
 
+               public ExpectedExceptionAttribute(Type exceptionType, string expectedMessage)
+               {
+                       expectedException = exceptionType;
+                       this.expectedMessage = expectedMessage;
+               }
+
                public Type ExceptionType 
                {
                        get{ return expectedException; }
                        set{ expectedException = value; }
                }
 
-}
+               public string ExpectedMessage 
+               {
+                       get { return expectedMessage; }
+                       set { expectedMessage = value; }
+               }
+       }
 }
index 8aa5abfba39bcc69c8cc94e6ceb73ef8c295c724..3453781357f3b666d4701bd3117de8cd2b1352ac 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
@@ -39,18 +39,29 @@ namespace NUnit.Core
        public class ExpectedExceptionTestCase : TemplateTestCase
        {
                private Type expectedException;
+               private string expectedMessage;
 
-               public ExpectedExceptionTestCase(object fixture, MethodInfo info, Type expectedException)
+               public ExpectedExceptionTestCase(object fixture, MethodInfo info, Type expectedException, string expectedMessage)
                        : base(fixture, info)
                {
                        this.expectedException = expectedException;
+                       this.expectedMessage = expectedMessage;
                }
 
                protected override internal void ProcessException(Exception exception, TestCaseResult testResult)
                {
                        if (expectedException.Equals(exception.GetType()))
                        {
-                               testResult.Success();
+                               if (expectedMessage != null && !expectedMessage.Equals(exception.Message))
+                               {
+                                       string message = string.Format("Expected exception to have message: \" {0} \" but recieved message \" {1}\" ", 
+                                               expectedMessage, exception.Message);
+                                       testResult.Failure(message, exception.StackTrace);
+                               } 
+                               else 
+                               {
+                                       testResult.Success();
+                               }
                        }
                        else
                        {
index aa54241730265864c8494668f94962394743b065..2e691e269cf653e058d08cdd4b7a8b134d0f4062 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
@@ -27,7 +27,6 @@
 '***********************************************************************************/
 #endregion
 
-
 namespace NUnit.Framework
 {
        using System;
index 0a6ea1a4837aea2fedf7142da7462e465b2b3025..ea4af058d9a22e1e783caac519a430edb4244e26 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
index 1a50b3db26c561f1fd48c89c48da3de730f983bc..962b9dc7b03d2d87bd7b03516cb2f2ad3a25ec4a 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
index 83e57b5ca45b0fd77b51d4db4eed87d496454f1a..b321874fd01148cc42612cdd0c20f65d1b29dbc3 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
index 21cb8216faeae50fc81121bce4a5c16f515e2ec9..20d8bc0a720b959eab2ab2523b2bc86548c5a02e 100755 (executable)
@@ -1,3 +1,32 @@
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 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
index 0d017a375eb4c143b18080e7dd935b1c3c423e02..e6f93086342c3048762a0b0ebbd641b48dc3c09b 100644 (file)
@@ -1,4 +1,5 @@
 ./AssemblyInfo.cs
+./Assert.cs
 ./Assertion.cs
 ./AssertionException.cs
 ./AssertionFailureMessage.cs
@@ -9,6 +10,7 @@
 ./IgnoreAttribute.cs
 ./InvalidFixture.cs
 ./InvalidSuiteException.cs
+./ITest.cs
 ./InvalidTestFixtureException.cs
 ./LongLivingMarshalByRefObject.cs
 ./NoTestFixturesException.cs
 ./RemoteTestRunner.cs
 ./ResultSummarizer.cs
 ./ResultVisitor.cs
+./RootTestSuite.cs
 ./SetUpAttribute.cs
 ./StackTraceFilter.cs
+./StringTextWriter.cs
 ./SuiteAttribute.cs
 ./SummaryVisitor.cs
 ./TearDownAttribute.cs
 ./TemplateTestCase.cs
 ./Test.cs
 ./TestAttribute.cs
+./TestAssembly.cs
 ./TestCase.cs
 ./TestCaseBuilder.cs
 ./TestCaseResult.cs
index 8d08f86a015b9c1a99f669c8aa1218d9b055c569..e658c81c0c45bf7e21fa22778c649deb9a63270f 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
index 51b70e21d72513bd59807407e1023c37980f4792..b9fdf726e14ca49f2c43cc779c7631e78c7570b7 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
@@ -47,15 +47,7 @@ namespace NUnit.Core
                
                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);
-                       }
+                       RecordException( exception, testResult );
                }
        }
 }
index f936cd98522c1a2f52ccd5824b789eee1f6697e9..661f4fdb2d827d58500f029fbe890699f04c532d 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
@@ -50,6 +50,8 @@ namespace NUnit.Core
 
                        if (method.IsAbstract)
                                reason = "it must not be abstract";
+                       else if (method.IsStatic)
+                               reason = "it must be an instance method";
                        else if (!method.IsPublic)
                                reason = "it must be a public method";
                        else if (method.GetParameters().Length != 0)
index e68021bec8dc658c4ae46759fd9488eec622aed4..e6a3400d0f830fa043531ab8591d4bea1ecb785e 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
index 16ee4ed046c91175654ae4e4290846d945c9ccc9..a7cc7c616af0384d957930147b89240f3384d4f6 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
index 6add910ed3af88882a947e35723fad2a419a92ea..b6d7b639095d8fb9d2d0611bdd5cd49ad218ccfd 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
index d85320275e32df429dc7796626e941ec0d93360a..05a500318bc1d0369efa6ad65a7eb57d8ac38818 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
@@ -31,6 +31,7 @@ namespace NUnit.Core
 {
        using System;
        using System.IO;
+       using System.Collections;
        using System.Reflection;
        using System.Runtime.Remoting;
 
@@ -41,80 +42,115 @@ namespace NUnit.Core
        [Serializable]
        public class RemoteTestRunner : LongLivingMarshalByRefObject
        {
+               #region Instance variables
+
+               /// <summary>
+               /// The loaded test suite
+               /// </summary>
                private TestSuite suite;
-               private string fullName;
-               private string assemblyName;
 
-               public void Initialize(string assemblyName)
+               /// <summary>
+               /// The test Fixture name to load
+               /// </summary>
+               private string testName;
+
+               /// <summary>
+               /// The test file to load. If assemblies is null,
+               /// this must be an assembly file, otherwise it
+               /// is only used to provide a name for the root
+               /// test node having the assemblies as children.
+               /// </summary>
+               private string testFileName;
+
+               /// <summary>
+               /// The list of assemblies to load
+               /// </summary>
+               private IList assemblies;
+
+               #endregion
+
+               #region Properties
+
+               public string TestName 
+               {
+                       get { return testName; }
+                       set { testName = value; }
+               }
+                       
+               public Test Test
+               {
+                       get { return suite; }
+               }
+
+               public string TestFileName
                {
-                       this.assemblyName = assemblyName;
+                       get { return testFileName; }
+                       set { testFileName = value; }
                }
 
-               public void Initialize(string fixtureName, string assemblyName)
+               public IList Assemblies
                {
-                       TestName = fixtureName;
-                       Initialize(assemblyName);
+                       get { return assemblies; }
+                       set { assemblies = value; }
                }
 
+               #endregion
+
+               #region Public Methods
+
                public void BuildSuite() 
                {
                        TestSuiteBuilder builder = new TestSuiteBuilder();
-                       if(fullName == null) 
-                               suite = builder.Build(assemblyName);
+
+                       if(testName == null )
+                               if ( assemblies == null )
+                                       suite = builder.Build( testFileName );
+                               else
+                                       suite = builder.Build( testFileName, assemblies );
                        else
-                               suite = builder.Build(fullName, assemblyName);
+                               if ( assemblies == null )
+                                       suite = builder.Build( testFileName, testName );
+                               else
+                                       suite = builder.Build( assemblies, testName );
 
                        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));
+                       BufferedStringTextWriter outBuffer = new BufferedStringTextWriter( outText );
+                       BufferedStringTextWriter errorBuffer = new BufferedStringTextWriter( errorText );
 
-                       Test test = FindByName(suite, fullName);
+                       Console.SetOut( outBuffer );
+                       Console.SetError( errorBuffer );
 
-                       TestResult result = test.Run(listener);
+                       Test test = FindByName(suite, testName);
 
-                       return result;
-               }
+                       string currentDirectory = Environment.CurrentDirectory;
 
-               /// <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;
+                       string assemblyName = assemblies == null ? testFileName : (string)assemblies[test.AssemblyKey];
+                       string assemblyDirectory = Path.GetDirectoryName( assemblyName );
 
-                       override public void Write(char aChar)
-                       {
-                               theTextWriter.Write(aChar);
-                       }
+                       if ( assemblyDirectory != null && assemblyDirectory != string.Empty )
+                               Environment.CurrentDirectory = assemblyDirectory;
 
-                       override public void Write(string aString)
-                       {
-                               theTextWriter.Write(aString);
-                       }
+                       TestResult result = test.Run(listener);
 
-                       override public void WriteLine(string aString)
-                       {
-                               theTextWriter.WriteLine(aString);
-                       }
+                       Environment.CurrentDirectory = currentDirectory;
 
-                       override public System.Text.Encoding Encoding
-                       {
-                               get { return theTextWriter.Encoding; }
-                       }
+                       outBuffer.Close();
+                       errorBuffer.Close();
+
+                       return result;
                }
 
+               #endregion
+
+               #region FindByName Helper
+
                private Test FindByName(Test test, string fullName)
                {
+                       if(test.UniqueName.Equals(fullName)) return test;
                        if(test.FullName.Equals(fullName)) return test;
                        
                        Test result = null;
@@ -130,18 +166,8 @@ namespace NUnit.Core
 
                        return result;
                }
-
-               public string TestName 
-               {
-                       get { return fullName; }
-                       set { fullName = value; }
-               }
-                       
-               public Test Test
-               {
-                       get 
-                       { return suite; }
-               }
        }
+
+       #endregion
 }
 
index abe1c17d698ef48369fe417b0e6304c01e269b10..8b34cbd68b5a80411546beb0f69d1acd5793f17c 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
index fc4c0329934b6b1b49e26a458ad101c71dd682fa..69074bca29f0f487161f49ec508e3d090395050e 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
@@ -36,7 +36,7 @@ namespace NUnit.Core
        /// </summary>
        public interface ResultVisitor
        {
-               void visit(TestCaseResult caseResult);
-               void visit(TestSuiteResult suiteResult);
+               void Visit(TestCaseResult caseResult);
+               void Visit(TestSuiteResult suiteResult);
        }
 }
index 5f32230c8704f6817f97a09ba8c74eb93dc21726..61a7c085b5e833e2b2d511793a29171dbb664ca2 100755 (executable)
@@ -37,6 +37,7 @@
                        <xs:element name="reason" type="reasonType" minOccurs="0" />
                </xs:choice>
                <xs:attribute name="name" type="xs:string" use="required" />
+               <xs:attribute name="description" type="xs:string" use="optional" />
                <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" />
@@ -46,6 +47,7 @@
                        <xs:element name="results" type="resultsType" />
                </xs:sequence>
                <xs:attribute name="name" type="xs:string" use="required" />
+               <xs:attribute name="description" type="xs:string" use="optional" />
                <xs:attribute name="success" type="xs:string" use="required" />
                <xs:attribute name="time" type="xs:string" use="required" />
        </xs:complexType>
index eb309bd138a487c7d64bce9a84699052d1efe9c8..0897c8b3d521da1c604e8be9844c8f637dd06a87 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
index be6b307be29a6d925df1c5414043b0f9002a91f4..573dc704e7f27b364ed480e117927f0f8318398f 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
@@ -68,7 +68,8 @@ namespace NUnit.Core
                                "NUnit.Core.TemplateTestCase",
                                "NUnit.Core.TestResult",
                                "NUnit.Core.TestSuite",
-                               "NUnit.Framework.Assertion" 
+                               "NUnit.Framework.Assertion", 
+                               "NUnit.Framework.Assert" 
                        };
 
                        for (int i = 0; i < patterns.Length; i++) 
index 984c5e5912fed5f80b4db93aca4ec5a1f987df18..d1d67b6c2ca4ffebd38bea63928e4aeaaee372a3 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
index 40188c40954ef2dfa72f6cb90f14dc1d57f9e22a..004806df97821a364cf81c167ea61684232091f7 100755 (executable)
@@ -26,7 +26,7 @@
 <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:text disable-output-escaping='yes'>&#xD;&#xA;</xsl:text>
 </xsl:template>
 
 <xsl:template match="test-case">
@@ -34,7 +34,7 @@
        <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:text disable-output-escaping='yes'>&#xD;&#xA;</xsl:text>
        <xsl:if test="failure">
                <xsl:value-of select="failure/stack-trace"/>
 <xsl:text>
index 47149d317fa854318c465b7d480a543c9abef3f3..81b1c1d2c5785061b50156ab35aa383e81dadc78 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
@@ -51,7 +51,7 @@ namespace NUnit.Core
                        initialized = false;
                }
 
-               public void visit(TestCaseResult caseResult) 
+               public void Visit(TestCaseResult caseResult) 
                {
                        SetNameandTime(caseResult.Name, caseResult.Time);
 
@@ -65,7 +65,7 @@ namespace NUnit.Core
                                testsNotRun++;
                }
 
-               public void visit(TestSuiteResult suiteResult) 
+               public void Visit(TestSuiteResult suiteResult) 
                {
                        SetNameandTime(suiteResult.Name, suiteResult.Time);
 
index c8e3a24f2960884c6e2953020d83afeb11dab827..ad105963a70c07406ab742fb68f7554c0e9693b6 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
index e5bc78f95c02d7b3fa9cd9d1a5cff85693c47837..e42b5875622a81b0898c580edc988ec50e5a9935 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
@@ -30,6 +30,7 @@
 namespace NUnit.Core
 {
        using System;
+       using System.Text;
        using System.Reflection;
 
        /// <summary>
@@ -40,13 +41,22 @@ namespace NUnit.Core
                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)
+               private bool suiteRunning 
+               {
+                       get 
+                       {
+                               return (Suite != null && Suite.SuiteRunning);
+                       }
+               }
+
+               public override void Run(TestCaseResult testResult )
                {
                        if(ShouldRun)
                        {
@@ -54,20 +64,29 @@ namespace NUnit.Core
 #if NUNIT_LEAKAGE_TEST
                                long before = System.GC.GetTotalMemory( true );
 #endif
+                               bool setupComplete = false;
 
                                try 
                                {
+                                       if ( !suiteRunning ) InvokeTestFixtureSetUp();
                                        InvokeSetUp();
+                                       setupComplete = true;
                                        InvokeTestCase();
                                        ProcessNoException(testResult);
                                }
                                catch(NunitException exception)
                                {
-                                       ProcessException(exception.InnerException, testResult); 
+                                       if ( setupComplete )
+                                               ProcessException(exception.InnerException, testResult); 
+                                       else
+                                               RecordException( exception.InnerException, testResult );
                                }
                                catch(Exception exp)
                                {
-                                       ProcessException(exp, testResult);
+                                       if ( setupComplete )
+                                               ProcessException(exp, testResult);
+                                       else
+                                               RecordException( exp, testResult );
                                }
                                finally 
                                {
@@ -77,12 +96,14 @@ namespace NUnit.Core
                                        }
                                        catch(NunitException exception)
                                        {
-                                               ProcessException(exception.InnerException, testResult); 
+                                               RecordException(exception.InnerException, testResult, true); 
                                        }
                                        catch(Exception exp)
                                        {
-                                               ProcessException(exp, testResult);
+                                               RecordException(exp, testResult, true);
                                        }
+
+                                       if ( !suiteRunning ) InvokeTestFixtureTearDown();
                                        
                                        DateTime stop = DateTime.Now;
                                        TimeSpan span = stop.Subtract(start);
@@ -102,6 +123,70 @@ namespace NUnit.Core
                        return;
                }
 
+               protected void RecordException( Exception exception, TestCaseResult testResult )
+               {
+                       RecordException( exception, testResult, false );
+               }
+
+               protected void RecordException( Exception exception, TestCaseResult testResult, bool inTearDown )
+               {
+                       StringBuilder msg = new StringBuilder();
+                       StringBuilder st = new StringBuilder();
+                       
+                       if ( inTearDown )
+                       {
+                               msg.Append( testResult.Message );
+                               msg.Append( Environment.NewLine );
+                               msg.Append( "TearDown : " );
+                               st.Append( testResult.StackTrace );
+                               st.Append( Environment.NewLine );
+                               st.Append( "--TearDown" );
+                               st.Append( Environment.NewLine );
+                       }
+
+                       msg.Append( BuildMessage( exception ) );
+                       st.Append( BuildStackTrace( exception ) );
+                       testResult.Failure( msg.ToString(), st.ToString() );
+               }
+
+               private string BuildMessage(Exception exception)
+               {
+                       StringBuilder sb = new StringBuilder();
+                       if ( exception is NUnit.Framework.AssertionException )
+                               sb.Append( exception.Message );
+                       else
+                               sb.AppendFormat( "{0} : {1}", exception.GetType().ToString(), exception.Message );
+
+                       Exception inner = exception.InnerException;
+                       while( inner != null )
+                       {
+                               sb.Append( Environment.NewLine );
+                               sb.AppendFormat( "  ----> {0} : {1}", inner.GetType().ToString(), inner.Message );
+                               inner = inner.InnerException;
+                       }
+
+                       return sb.ToString();
+               }
+               
+               private string BuildStackTrace(Exception exception)
+               {
+                       if(exception.InnerException!=null)
+                               return exception.StackTrace + Environment.NewLine + 
+                                       "--" + exception.GetType().Name + Environment.NewLine +
+                                       BuildStackTrace(exception.InnerException);
+                       else
+                               return exception.StackTrace;
+               }
+
+               private void InvokeTestFixtureTearDown()
+               {
+                       MethodInfo method = FindTestFixtureTearDownMethod(fixture);
+                       if(method != null)
+                       {
+                               InvokeMethod(method, fixture);
+                       }
+               }
+
                private void InvokeTearDown()
                {
                        MethodInfo method = FindTearDownMethod(fixture);
@@ -116,6 +201,20 @@ namespace NUnit.Core
                        return FindMethodByAttribute(fixture, typeof(NUnit.Framework.TearDownAttribute));
                }
 
+               private MethodInfo FindTestFixtureTearDownMethod(object fixture)
+               {                       
+                       return FindMethodByAttribute(fixture, typeof(NUnit.Framework.TestFixtureTearDownAttribute));
+               }
+
+               private void InvokeTestFixtureSetUp()
+               {
+                       MethodInfo method = FindTestFixtureSetUpMethod(fixture);
+                       if(method != null)
+                       {
+                               InvokeMethod(method, fixture);
+                       }
+               }
+
                private void InvokeSetUp()
                {
                        MethodInfo method = FindSetUpMethod(fixture);
@@ -125,6 +224,11 @@ namespace NUnit.Core
                        }
                }
 
+               private MethodInfo FindTestFixtureSetUpMethod(object fixture)
+               {
+                       return FindMethodByAttribute(fixture, typeof(NUnit.Framework.TestFixtureSetUpAttribute));
+               }
+
                private MethodInfo FindSetUpMethod(object fixture)
                {
                        return FindMethodByAttribute(fixture, typeof(NUnit.Framework.SetUpAttribute));
index 813117ecd284d117b7e560a23f221294c4f14ede..3257e0aa588c803ffdff5642b217f041a14367b9 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
@@ -36,17 +36,31 @@ namespace NUnit.Core
        /// <summary>
        ///             Test Class.
        /// </summary>
-       public abstract class Test : LongLivingMarshalByRefObject, TestInfo
+       public abstract class Test : LongLivingMarshalByRefObject, ITest, IComparable
        {
                private string fullName;
                private string testName;
+               private int assemblyKey;
                private bool shouldRun;
                private string ignoreReason;
+               private string description;
 
-               protected Test(string pathName, string testName) 
+               public Test( string name ) : this( name, 0 ) { }
+
+               public Test( string name, int assemblyKey )
+               {
+                       fullName = testName = name;
+                       this.assemblyKey = assemblyKey;
+               }
+
+               protected Test( string pathName, string testName ) 
+                       : this( pathName, testName, 0 ) { }
+
+               protected Test( string pathName, string testName, int assemblyKey ) 
                { 
                        fullName = pathName + "." + testName;
                        this.testName = testName;
+                       this.assemblyKey = assemblyKey;
                        shouldRun = true;
                }
 
@@ -56,15 +70,16 @@ namespace NUnit.Core
                        set { ignoreReason = value; }
                }
 
-               public bool ShouldRun
+               public virtual bool ShouldRun
                {
                        get { return shouldRun; }
                        set { shouldRun = value; }
                }
 
-               public Test(string name)
+               public String Description
                {
-                       fullName = testName = name;
+                       get { return description; }
+                       set { description = value; }
                }
 
                public string FullName 
@@ -77,10 +92,38 @@ namespace NUnit.Core
                        get { return testName; }
                }
 
+               /// <summary>
+               /// If the name is a path, this just returns the file part
+               /// </summary>
+               public string ShortName
+               {
+                       get
+                       {
+                               string name = Name;
+                               int val = name.LastIndexOf("\\");
+                               if(val != -1)
+                                       name = name.Substring(val+1);
+                               return name;
+                       }
+               }
+
+               public int AssemblyKey
+               {
+                       get { return assemblyKey; }
+                       set { assemblyKey = value; }
+               }
+
+               public string UniqueName
+               {
+                       get { return string.Format( "[{0}]{1}", assemblyKey, fullName ); }
+               }
+
                public abstract int CountTestCases { get; }
                public abstract bool IsSuite { get; }
+               public abstract bool IsFixture{ get; }
+               public abstract bool IsTestCase{ get; }
                public abstract ArrayList Tests { get; }
-
+               
                public abstract TestResult Run(EventListener listener);
 
                protected MethodInfo FindMethodByAttribute(object fixture, Type type)
@@ -110,5 +153,19 @@ namespace NUnit.Core
                                }
                        }
                }
+
+               #region IComparable Members
+
+               public int CompareTo(object obj)
+               {
+                       Test other = obj as Test;
+                       
+                       if ( other == null )
+                               return -1;
+
+                       return this.FullName.CompareTo( other.FullName );
+               }
+
+               #endregion
        }
 }
index 24c819c2b4aab840047159f7a030124003e49a41..88512058df5a147d64446a2752d86f1d3f67c157 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, 
+' Charlie Poole or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
 namespace NUnit.Framework
 {
        using System;
+
        /// <summary>
-       /// TestAttribute.
+       /// Adding this attribute to a method within a <seealso cref="TestFixtureAttribute"/> 
+       /// class makes the method callable from the NUnit test runner. There is a property 
+       /// called Description which is optional which you can provide a more detailed test
+       /// description. This class cannot be inherited.
        /// </summary>
        /// 
+       /// <example>
+       /// [TestFixture]
+       /// public class Fixture
+       /// {
+       ///   [Test]
+       ///   public void MethodToTest()
+       ///   {}
+       ///   
+       ///   [Test(Description = "more detailed description")]
+       ///   publc void TestDescriptionMethod()
+       ///   {}
+       /// }
+       /// </example>
+       /// 
        [AttributeUsage(AttributeTargets.Method, AllowMultiple=false)]
        public sealed class TestAttribute : Attribute
-       {}
+       {
+               private string description;
+
+               public string Description
+               {
+                       get { return description; }
+                       set { description = value; }
+               }
+       }
 }
index 7c1f1c242eaeb4d45eb97f360cd9d05bfce9dba8..3e4cd8dcd2e70d7bc83325cf293395d48a916fbf 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
@@ -45,6 +45,14 @@ namespace NUnit.Core
                        get { return 1; }
                }
 
+               private TestSuite suite;
+
+               public TestSuite Suite 
+               {
+                       get { return suite; }
+                       set { suite = value; }
+               }
+
                public override TestResult Run(EventListener listener)
                {
                        TestCaseResult testResult = new TestCaseResult(this);
@@ -71,6 +79,16 @@ namespace NUnit.Core
                        get { return false; }
                }
 
+               public override bool IsFixture
+               {
+                       get { return false; }
+               }
+
+               public override bool IsTestCase
+               {
+                       get { return true; }
+               }
+
                public override ArrayList Tests
                {
                        get { return null; }
index 24f3883ee5f2bdff1d5dacc05821f2ebb3a364ec..93b3163b910e3f53c6c475b771010f7f6213dbb5 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
@@ -41,7 +41,7 @@ namespace NUnit.Core
                {
                        TestCase testCase = null;
 
-                       if(HasTestAttribute(method) || HasObsoleteTestName(method))
+                       if(HasTestAttribute(method) || HasObsoleteTestName(method) && !HasAnySetUpOrTearDownAttribute(method) )
                        {
                                if(IsTestMethodSignatureCorrect(method))
                                {
@@ -49,20 +49,20 @@ namespace NUnit.Core
                                                testCase = new NormalTestCase(fixture, method);
                                        else
                                        {
-                                               Type expectedException = GetExpectedExceptions(method);
-                                               testCase = new ExpectedExceptionTestCase(fixture, method, expectedException);
+                                               NUnit.Framework.ExpectedExceptionAttribute expectedException = GetExpectedExceptions(method);
+                                               testCase = new ExpectedExceptionTestCase(fixture, method, expectedException.ExceptionType, expectedException.ExpectedMessage);
                                        }
+
                                        if(HasIgnoreAttribute(method))
                                        {
                                                testCase.ShouldRun = false;
                                                testCase.IgnoreReason = GetIgnoreReason(method);
                                        }
 
+                                       testCase.Description = GetDescription(method);
                                }
                                else
                                {
-                                       //                                      string reason = String.Format("Method: {0}'s signature is not correct", method.Name);
-                                       //                                      testCase = new NotRunnableTestCase(method, reason);
                                        testCase = new NotRunnableTestCase(method);
                                }
                        }
@@ -89,23 +89,39 @@ namespace NUnit.Core
                        return attributes.Length == 1;
                }
 
-               private static Type GetExpectedExceptions(MethodInfo method)
+               private static NUnit.Framework.ExpectedExceptionAttribute GetExpectedExceptions(MethodInfo method)
                {
                        Type exceptionAttr = typeof(NUnit.Framework.ExpectedExceptionAttribute);
                        object[] attributes = method.GetCustomAttributes(exceptionAttr, false);
 
-                       Type returnType = null;
+                       NUnit.Framework.ExpectedExceptionAttribute expectedAttr = null;
+
+                       if(attributes.Length == 1)
+                       {
+                               expectedAttr = (NUnit.Framework.ExpectedExceptionAttribute)attributes[0];
+                       }
+
+                       return expectedAttr;
+               }
+
+               private static string GetDescription(MethodInfo method)
+               {
+                       Type testAttr = typeof(NUnit.Framework.TestAttribute);
+                       object[] attributes = method.GetCustomAttributes(testAttr, false);
+
+                       string description = null;
 
                        if(attributes.Length == 1)
                        {
-                               NUnit.Framework.ExpectedExceptionAttribute expectedAttr = 
-                                       (NUnit.Framework.ExpectedExceptionAttribute)attributes[0];
-                               returnType = expectedAttr.ExceptionType;
+                               NUnit.Framework.TestAttribute attribute = 
+                                       (NUnit.Framework.TestAttribute)attributes[0];
+                               description = attribute.Description;
                        }
 
-                       return returnType;
+                       return description;
                }
 
+
                public static int CountTestCases(object fixture) 
                {
                        int testCases = 0;
@@ -131,7 +147,8 @@ namespace NUnit.Core
                private static bool IsTestMethodSignatureCorrect(MethodInfo methodToCheck)
                {
                        return 
-                               !methodToCheck.IsAbstract
+                               !methodToCheck.IsStatic
+                               && !methodToCheck.IsAbstract
                                && methodToCheck.IsPublic
                                && methodToCheck.GetParameters().Length == 0
                                && methodToCheck.ReturnType.Equals(typeof(void));
@@ -147,6 +164,19 @@ namespace NUnit.Core
                        return methodToCheck.Name.ToLower().StartsWith("test");
                }
 
+               private static bool HasAnySetUpOrTearDownAttribute( MethodInfo methodToCheck )
+               {
+                       object[] attributes = methodToCheck.GetCustomAttributes( false );
+                       foreach( Attribute attribute in attributes )
+                               if ( attribute is NUnit.Framework.SetUpAttribute ||
+                                        attribute is NUnit.Framework.TestFixtureSetUpAttribute ||
+                                        attribute is NUnit.Framework.TearDownAttribute || 
+                                        attribute is NUnit.Framework.TestFixtureTearDownAttribute )
+                                       return true;
+
+                       return false;   
+               }
+
                private static bool HasIgnoreAttribute(MethodInfo methodToCheck)
                {
                        Type ignoreMethodAttribute = typeof(NUnit.Framework.IgnoreAttribute);
index c87a57bea7d33eca057aac6400ad263f18cb84f6..442c299e0e6b3fdf0c735ed7e86ce75272a99411 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
@@ -40,9 +40,9 @@ namespace NUnit.Core
        public class TestCaseResult : TestResult
        {
                private string message;
-               private string stackTrace;
+               
 
-               public TestCaseResult(TestCase testCase):base(testCase, testCase.FullName)
+               public TestCaseResult(ITest testCase):base(testCase, testCase.FullName)
                {
                        Executed = false;
                }
@@ -69,7 +69,7 @@ namespace NUnit.Core
                        Executed = true;
                        IsFailure = true;
                        this.message = message;
-                       this.stackTrace = stackTrace;
+                       StackTrace = stackTrace;
                }
 
                public override string Message
@@ -77,14 +77,6 @@ namespace NUnit.Core
                        get { return message; }
                }
 
-               public override string StackTrace
-               {
-                       get 
-                       { 
-                               return stackTrace;
-                       }
-               }
-
                public override string ToString()
                {
                        StringBuilder builder = new StringBuilder();
@@ -101,7 +93,7 @@ namespace NUnit.Core
 
                public override void Accept(ResultVisitor visitor) 
                {
-                       visitor.visit(this);
+                       visitor.Visit(this);
                }
        }
 }
index 669890fa5974118c654b83b2b796074aa8a4b8a8..a5bf7dc15878f36303789c352b7f8b677329ed0c 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
@@ -29,9 +29,8 @@
 
 using System;
 
-namespace NUnit.Framework
+namespace NUnit.Core
 {
-       using NUnit.Core;
        using System.Runtime.Remoting;
        using System.Security.Policy;
        using System.Reflection;
@@ -40,71 +39,123 @@ namespace NUnit.Framework
        using System.Configuration;
        using System.IO;
 
-       /// <summary>
-       /// Summary description for TestDomain.
-       /// </summary>
        public class TestDomain
        {
-               private string assemblyName; 
+               #region Instance Variables
+
+               /// <summary>
+               /// The appdomain used  to load tests
+               /// </summary>
                private AppDomain domain; 
+
+               /// <summary>
+               /// The path to our cache
+               /// </summary>
                private string cachePath;
+               
+               /// <summary>
+               /// The remote runner loaded in the test appdomain
+               /// </summary>
                private RemoteTestRunner testRunner;
-               private TextWriter outStream;
-               private TextWriter errorStream;
 
-               public TestDomain(TextWriter outStream, TextWriter errorStream)
+               #endregion
+
+               #region Properties
+
+               public bool IsTestLoaded
                {
-                       this.outStream = outStream;
-                       this.errorStream = errorStream;
+                       get { return testRunner != null; }
                }
 
-               private void ThrowIfAlreadyLoaded()
+               public Test Test
                {
-                       if ( domain != null || testRunner != null )
-                               throw new InvalidOperationException( "TestDomain already loaded" );
+                       get { return IsTestLoaded ? testRunner.Test : null; }
                }
 
-               public Test Load(string assemblyFileName)
+               public string TestName
                {
-                       ThrowIfAlreadyLoaded();
+                       get { return testRunner.TestName; }
+                       set { testRunner.TestName = value; }
+               }
+
+               #endregion
+
+               #region Public Members
 
-                       assemblyName = assemblyFileName; 
-                       FileInfo file = new FileInfo(assemblyFileName);
+               #region Load a single assembly
+
+               public Test LoadAssembly( string assemblyFileName )
+               {
+                       return LoadAssembly( assemblyFileName, null );
+               }
+
+               public Test LoadAssembly(string assemblyFileName, string testFixture)
+               {
+                       FileInfo testFile = new FileInfo( assemblyFileName );
+
+                       ThrowIfAlreadyLoaded();
 
                        try
                        {
-                               domain = MakeAppDomain(file);
-                               testRunner = MakeRemoteTestRunner(file, domain);
-                               return testRunner.Test;
+                               string assemblyPath = Path.GetFullPath( assemblyFileName );
+
+                               string domainName = string.Format( "domain-{0}", Path.GetFileName( assemblyFileName ) );
+                               domain = MakeAppDomain( domainName, testFile.DirectoryName, testFile.FullName + ".config", testFile.DirectoryName );
+                               testRunner = MakeRemoteTestRunner( domain );
+
+                               if(testRunner != null)
+                               {
+                                       testRunner.TestFileName = assemblyPath;
+                                       if ( testFixture != null )
+                                               testRunner.TestName = testFixture;
+                                       domain.DoCallBack( new CrossAppDomainDelegate( testRunner.BuildSuite ) );
+                                       return testRunner.Test;
+                               }
+                               else
+                               {
+                                       Unload();
+                                       return null;
+                               }
                        }
-                       catch (Exception e)
+                       catch
                        {
                                Unload();
-                               throw e;
+                               throw;
                        }
                }
 
-               public Test Load(string testFixture, string assemblyFileName)
+               #endregion
+
+               #region Load multiple assemblies
+
+               public Test LoadAssemblies( string testFileName, IList assemblies )
                {
-                       ThrowIfAlreadyLoaded();
+                       return LoadAssemblies( testFileName, assemblies, null );
+               }
+
+               public Test LoadAssemblies( string testFileName, IList assemblies, string testFixture )
+               {
+                       FileInfo testFile = new FileInfo( testFileName );               
+                       return LoadAssemblies( testFileName, testFile.DirectoryName, testFile.FullName + ".config", GetBinPath(assemblies), assemblies, testFixture );
+               }
 
-                       assemblyName = assemblyFileName; 
-                       FileInfo file = new FileInfo(assemblyFileName);
+               public Test LoadAssemblies( string testFileName, string appBase, string configFile, string binPath, IList assemblies, string testFixture )
+               {
+                       ThrowIfAlreadyLoaded();
 
                        try
                        {
-                               domain = MakeAppDomain(file);
+                               string domainName = string.Format( "domain-{0}", Path.GetFileName( testFileName ) );
+                               domain = MakeAppDomain( testFileName, appBase, configFile, binPath );
+                               testRunner = MakeRemoteTestRunner( domain );
 
-                               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));
+                                       testRunner.TestFileName = testFileName;
+                                       testRunner.Assemblies = assemblies;
+                                       if ( testFixture != null )
+                                               testRunner.TestName = testFixture;
+                                       domain.DoCallBack( new CrossAppDomainDelegate( testRunner.BuildSuite ) );
                                        return testRunner.Test;
                                }
                                else
@@ -113,25 +164,16 @@ namespace NUnit.Framework
                                        return null;
                                }
                        }
-                       catch (Exception e)
+                       catch
                        {
                                Unload();
-                               throw e;
+                               throw;
                        }
                }
 
-               public string AssemblyName
-               {
-                       get { return assemblyName; }
-               }
+               #endregion
 
-               public string TestName
-               {
-                       get { return testRunner.TestName; }
-                       set { testRunner.TestName = value; }
-               }
-
-               public TestResult Run(NUnit.Core.EventListener listener)
+               public TestResult Run(NUnit.Core.EventListener listener, TextWriter outStream, TextWriter errorStream )
                {
                        return testRunner.Run(listener, outStream, errorStream);
                }
@@ -142,37 +184,73 @@ namespace NUnit.Framework
 
                        if(domain != null) 
                        {
-                               AppDomain.Unload(domain);
-                               DirectoryInfo cacheDir = new DirectoryInfo(cachePath);
-                               if(cacheDir.Exists) cacheDir.Delete(true);
+                               try
+                               {
+                                       AppDomain.Unload(domain);
+                                       DirectoryInfo cacheDir = new DirectoryInfo(cachePath);
+                                       if(cacheDir.Exists) cacheDir.Delete(true);
+                               }
+                               catch( CannotUnloadAppDomainException )
+                               {
+                                       // TODO: Do something useful. For now we just
+                                       // leave the orphaned AppDomain "out there"
+                                       // rather than aborting the application.
+                               }
+                               finally
+                               {
+                                       domain = null;
+                               }
                        }
-                       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;
+               #endregion
 
+               #region Helper Methods
 
-                       setup.ConfigurationFile = file.DirectoryName + @"\" +
-                               file.Name + ".config";
+               private void ThrowIfAlreadyLoaded()
+               {
+                       if ( domain != null || testRunner != null )
+                               throw new InvalidOperationException( "TestDomain already loaded" );
+               }
 
+               /// <summary>
+               /// This method creates appDomains for the framework.
+               /// </summary>
+               /// <param name="domainName">Name of the domain</param>
+               /// <param name="appBase">ApplicationBase for the domain</param>
+               /// <param name="configFile">ConfigurationFile for the domain</param>
+               /// <param name="binPath">PrivateBinPath for the domain</param>
+               /// <returns></returns>
+               private AppDomain MakeAppDomain( string domainName, string appBase, string configFile, string binPath )
+               {
                        Evidence baseEvidence = AppDomain.CurrentDomain.Evidence;
                        Evidence evidence = new Evidence(baseEvidence);
 
-                       string domainName = String.Format("domain-{0}", file.Name);
+                       AppDomainSetup setup = new AppDomainSetup();
+
+                       // We always use the same application name
+                       setup.ApplicationName = "Tests";
+                       // We always want to do shadow copying. Note that we do NOT
+                       // set ShadowCopyDirectories because we  rely on the default
+                       // setting of ApplicationBase plus PrivateBinPath
+                       setup.ShadowCopyFiles = "true";
+                       setup.ShadowCopyDirectories = appBase;
+
+                       setup.ApplicationBase = appBase;
+                       setup.ConfigurationFile =  configFile;
+                       setup.PrivateBinPath = binPath;
+
                        AppDomain runnerDomain = AppDomain.CreateDomain(domainName, evidence, setup);
+                       
                        ConfigureCachePath(runnerDomain);
+
                        return runnerDomain;
                }
 
+               /// <summary>
+               /// Set the location for caching and delete any old cache info
+               /// </summary>
+               /// <param name="domain">Our domain</param>
                private void ConfigureCachePath(AppDomain domain)
                {
                        cachePath = String.Format(@"{0}\{1}", 
@@ -187,19 +265,38 @@ namespace NUnit.Framework
                        return;
                }
 
-               private static RemoteTestRunner MakeRemoteTestRunner(FileInfo file, AppDomain runnerDomain)
+               private static RemoteTestRunner MakeRemoteTestRunner( AppDomain runnerDomain )
                {
-                       RemoteTestRunner runner = (
-                               RemoteTestRunner) runnerDomain.CreateInstanceAndUnwrap(
+                       object obj = runnerDomain.CreateInstanceAndUnwrap(
                                typeof(RemoteTestRunner).Assembly.FullName, 
                                typeof(RemoteTestRunner).FullName,
-                               true, BindingFlags.Default,null,null,null,null,null);
-                       if(runner != null)
+                               false, BindingFlags.Default,null,null,null,null,null);
+                       
+                       return (RemoteTestRunner) obj;
+               }
+
+               public static string GetBinPath( IList assemblies )
+               {
+                       ArrayList dirs = new ArrayList();
+                       string binPath = null;
+
+                       foreach( string path in assemblies )
                        {
-                               runner.Initialize(file.FullName);
-                               runnerDomain.DoCallBack(new CrossAppDomainDelegate(runner.BuildSuite));
+                               string dir = Path.GetDirectoryName( Path.GetFullPath( path ) );
+                               if ( !dirs.Contains( dir ) )
+                               {
+                                       dirs.Add( dir );
+
+                                       if ( binPath == null )
+                                               binPath = dir;
+                                       else
+                                               binPath = binPath + ";" + dir;
+                               }
                        }
-                       return runner;
+
+                       return binPath;
                }
+
+               #endregion
        }
 }
index bf4ee8694b48ed7b486dcbf6d6e2a3240c8e4415..001726f7ff4f5bf434367b65b08029dd291b2673 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
@@ -41,5 +41,14 @@ namespace NUnit.Framework
        /// </example>
        [AttributeUsage(AttributeTargets.Class, AllowMultiple=false, Inherited=true)]
        public sealed class TestFixtureAttribute : Attribute
-       {}
-}
\ No newline at end of file
+       {
+               private string description;
+
+               public string Description
+               {
+                       get { return description; }
+                       set { description = value; }
+               }
+       }
+
+}
index 4d88cb841556ee54e7dd775898c620f3b3159ed1..4006d798337f640b2a1f7cfc4a6000293b29860c 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
index 62bd0e0473160d2db31b460ad7fa95b2b0323a5a..e4251ccfbaa5c93315fd2505f517a4fdcf7d15b9 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
index 9bcffdad1fc4a43321f1c7682df760bfe830afa2..de226adc68aa5b035f5c47dee36e5bb73f8e549d 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
@@ -42,16 +42,20 @@ namespace NUnit.Core
                private bool isFailure; 
                private double time;
                private string name;
-               private TestInfo test;
+               private ITest test;
+               private string stackTrace;
+               private string description;
 
 #if NUNIT_LEAKAGE_TEST
                private long leakage = 0;
 #endif
                
-               protected TestResult(TestInfo test, string name)
+               protected TestResult(ITest test, string name)
                {
                        this.name = name;
                        this.test = test;
+                       if(test != null)
+                               this.description = test.Description;
                }
 
                public bool Executed 
@@ -60,12 +64,17 @@ namespace NUnit.Core
                        set { executed = value; }
                }
 
+               public virtual bool AllTestsExecuted
+               {
+                       get { return executed; }
+               }
+
                public virtual string Name
                {
                        get{ return name;}
                }
 
-               public TestInfo Test
+               public ITest Test
                {
                        get{ return test;}
                }
@@ -81,6 +90,12 @@ namespace NUnit.Core
                        set { isFailure = value; }
                }
 
+               public virtual string Description
+               {
+                       get { return description; }
+                       set { description = value; }
+               }
+
                public double Time 
                {
                        get{ return time; }
@@ -100,9 +115,16 @@ namespace NUnit.Core
                        get;
                }
 
-               public abstract string StackTrace
+               public virtual string StackTrace
                {
-                       get;
+                       get 
+                       { 
+                               return stackTrace;
+                       }
+                       set 
+                       {
+                               stackTrace = value;
+                       }
                }
 
                public abstract void NotRun(string message);
index ba01a8c90fc214670f61219b55e5d9bf0fd7d2c5..6eef75dc38a43922667814320b9095df1bac36e7 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
@@ -44,13 +44,33 @@ namespace NUnit.Core
                private MethodInfo fixtureSetUp;
                private MethodInfo fixtureTearDown;
                private object fixture;
+               private const string FIXTURE_SETUP_FAILED = "Fixture setup failed";
 
-               public TestSuite(string name) : base(name)
+               public TestSuite( string name ) : this( name, 0 ) { }
+
+               public TestSuite( string name, int assemblyKey ) 
+                       : base( name, assemblyKey )
                {
                        ShouldRun = true;
                }
 
-               public TestSuite(string parentSuiteName, string name) : base(parentSuiteName,name)
+               public void Sort()
+               {
+                       this.Tests.Sort();
+
+                       foreach( Test test in Tests )
+                       {
+                               TestSuite suite = test as TestSuite;
+                               if ( suite != null )
+                                       suite.Sort();
+                       }               
+               }
+
+               public TestSuite( string parentSuiteName, string name ) 
+                       : this( parentSuiteName, name, 0 ) { }
+
+               public TestSuite( string parentSuiteName, string name, int assemblyKey ) 
+                       : base( parentSuiteName, name, assemblyKey )
                {
                        ShouldRun = true;
                }
@@ -63,11 +83,15 @@ namespace NUnit.Core
                                test.IgnoreReason = IgnoreReason;
                        }
                        tests.Add(test);
+                       if (test.IsTestCase)
+                               ((TestCase) test).Suite = this;
                }
 
                protected internal virtual TestSuite CreateNewSuite(Type type)
                {
-                       return new TestSuite(type.Namespace,type.Name);
+                       int index = type.FullName.LastIndexOf( "." ) + 1;
+                       string name = type.FullName.Substring( index );
+                       return new TestSuite( type.Namespace, name, this.AssemblyKey);
                }
 
                public void Add(object fixture) 
@@ -82,17 +106,59 @@ namespace NUnit.Core
                        object[] attributes = fixture.GetType().GetCustomAttributes(ignoreMethodAttribute, false);
                        if(attributes.Length == 1)
                        {
-                               NUnit.Framework.IgnoreAttribute attr = (NUnit.Framework.IgnoreAttribute)attributes[0];
+                               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);
+                       Type fixtureAttribute = typeof(NUnit.Framework.TestFixtureAttribute);
+                       attributes = fixture.GetType().GetCustomAttributes(fixtureAttribute, false);
+                       if(attributes.Length == 1)
+                       {
+                               NUnit.Framework.TestFixtureAttribute fixtureAttr = 
+                                       (NUnit.Framework.TestFixtureAttribute)attributes[0];
+                               testSuite.Description = fixtureAttr.Description;
+                       } 
+
+                       ////////////////////////////////////////////////////////////////////////
+                       // Uncomment the following code block to allow including Suites in the
+                       // tree of tests. This causes a problem when the same test is added
+                       // in multiple suites so we need to either fix it or prevent it.
+                       //
+                       // See also a line to change in TestSuiteBuilder.cs
+                       ////////////////////////////////////////////////////////////////////////
+
+                       //                      PropertyInfo [] properties = fixture.GetType().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)
+                       //                              {
+                       //                                      MethodInfo method = property.GetGetMethod(true);
+                       //                                      if(method.ReturnType!=typeof(NUnit.Core.TestSuite) || method.GetParameters().Length>0)
+                       //                                      {
+                       //                                              testSuite.ShouldRun = false;
+                       //                                              testSuite.IgnoreReason = "Invalid suite property method signature";
+                       //                                      }
+                       //                                      else
+                       //                                      {
+                       //                                              TestSuite suite = (TestSuite)property.GetValue(null, new Object[0]);
+                       //                                              foreach( Test test in suite.Tests )
+                       //                                                      testSuite.Add( test );
+                       //                                      }
+                       //                              }
+                       //                      }
+
+                       MethodInfo [] methods = fixture.GetType().GetMethods(BindingFlags.Public|BindingFlags.Instance|BindingFlags.Static|BindingFlags.NonPublic);
                        foreach(MethodInfo method in methods)
                        {
                                TestCase testCase = TestCaseBuilder.Make(fixture, method);
                                if(testCase != null)
+                               {
+                                       testCase.AssemblyKey = testSuite.AssemblyKey;
                                        testSuite.Add(testCase);
+                               }
                        }
 
                        if(testSuite.CountTestCases == 0)
@@ -102,6 +168,15 @@ namespace NUnit.Core
                        }
                }
 
+               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");
+               }
+
                public override ArrayList Tests 
                {
                        get { return tests; }
@@ -112,6 +187,29 @@ namespace NUnit.Core
                        get { return true; }
                }
 
+               public override bool IsTestCase
+               {
+                       get { return false; }
+               }
+
+               /// <summary>
+               /// True if this is a fixture. May populate the test's
+               /// children as a side effect.
+               /// TODO: An easier way to tell this?
+               /// </summary>
+               public override bool IsFixture
+               {
+                       get
+                       {
+                               // We have no way of constructing an empty suite unless it's a fixture
+                               if ( Tests.Count == 0 ) return true;
+                               
+                               // Any suite with children is a fixture if the children are test cases
+                               ITest firstChild = (ITest)Tests[0];
+                               return !firstChild.IsSuite;
+                       }
+               }
+
                public override int CountTestCases 
                {
                        get 
@@ -126,8 +224,16 @@ namespace NUnit.Core
                        }
                }
 
+               private bool suiteRunning = false;
+
+               public bool SuiteRunning 
+               {
+                       get { return suiteRunning; }
+               }
+
                public override TestResult Run(EventListener listener)
                {
+                       suiteRunning = true;
                        TestSuiteResult suiteResult = new TestSuiteResult(this, Name);
 
                        listener.SuiteStarted(this);
@@ -135,37 +241,102 @@ namespace NUnit.Core
                        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);
-                       }
+                       doFixtureSetup(suiteResult);
+                       RunAllTests(suiteResult,listener);
+                       doFixtureTearDown(suiteResult);
 
                        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);
+                       suiteRunning = false;
 
                        return suiteResult;
                }
 
+               public void InvokeFixtureTearDown() 
+               {
+                       if (this.fixtureTearDown != null)
+                               this.InvokeMethod(fixtureTearDown, fixture);
+               }
+
+               private void doFixtureTearDown(TestSuiteResult suiteResult)
+               {
+                       if (this.ShouldRun) 
+                       {
+                               try 
+                               {
+                                       InvokeFixtureTearDown();
+                               } 
+                               catch (Exception ex) 
+                               {
+                                       handleFixtureException(suiteResult, ex);
+                               }
+                       }
+                       if (this.IgnoreReason == FIXTURE_SETUP_FAILED) 
+                       {
+                               this.ShouldRun = true;
+                               this.IgnoreReason = null;
+                       }
+               }
+
+               private void doFixtureSetup(TestSuiteResult suiteResult)
+               {
+                       try 
+                       {
+                               InvoikeFixtureSetUp();
+                       } 
+                       catch (Exception ex) 
+                       {
+                               handleFixtureException(suiteResult, ex);
+                               this.ShouldRun = false;
+                               this.IgnoreReason = FIXTURE_SETUP_FAILED;
+                       }
+               }
+
+               public void InvoikeFixtureSetUp()
+               {
+                       if (this.fixtureSetUp != null)
+                               this.InvokeMethod(fixtureSetUp, fixture);
+               }
+
+               private void handleFixtureException(TestSuiteResult result, Exception ex) 
+               {
+                       NunitException nex = ex as NunitException;
+                       if (nex != null)
+                               ex = nex.InnerException;
+
+                       result.Executed = false;
+                       result.NotRun(ex.ToString());
+                       result.StackTrace = ex.StackTrace;
+               }
+
                protected virtual void RunAllTests(TestSuiteResult suiteResult,EventListener listener)
                {
-                       foreach(Test test in Tests)
+                       foreach(Test test in ArrayList.Synchronized(Tests))
                        {
+                               if (this.ShouldRun == false) 
+                               {
+                                       test.ShouldRun = false;
+                                       if (test.IgnoreReason == null)
+                                               test.IgnoreReason = FIXTURE_SETUP_FAILED;
+                               }
                                suiteResult.AddResult(test.Run(listener));
+                               if (this.ShouldRun == false) 
+                               {
+                                       
+                                       if (test.IgnoreReason == FIXTURE_SETUP_FAILED) 
+                                       {
+                                               test.ShouldRun = true;
+                                               test.IgnoreReason = null;
+                                       }
+                               }
                        }
                }
        }
index 49be2be6aeaf5167881c48bc74735a303e5f240c..a2224cbfe08ac2c48b1c845485bf9ddda156bd07 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
@@ -55,52 +55,103 @@ namespace NUnit.Core
 
                public Assembly Load(string assemblyName)
                {
-                       Assembly assembly = AppDomain.CurrentDomain.Load(TrimPathAndExtension(assemblyName));
-                       return assembly;
+                       // Change currentDirectory in case assembly references unmanaged dlls
+                       string currentDirectory = Environment.CurrentDirectory;
+                       string assemblyDirectory = Path.GetDirectoryName( assemblyName );
+                       bool swap = assemblyDirectory != null && assemblyDirectory != string.Empty;
+
+                       try
+                       {
+                               if ( swap )
+                                       Environment.CurrentDirectory = assemblyDirectory;
+
+                               return AppDomain.CurrentDomain.Load(TrimPathAndExtension(assemblyName));
+                       }
+                       finally
+                       {
+                               if ( swap )
+                                       Environment.CurrentDirectory = currentDirectory;
+                       }
+
+
                }
 
-               private TestSuite BuildFromNameSpace(string nameSpace)
+               private TestSuite BuildFromNameSpace( string nameSpace, int assemblyKey )
                {
                        if( nameSpace == null || nameSpace  == "" ) return rootSuite;
                        TestSuite suite = (TestSuite)suites[nameSpace];
                        if(suite!=null) return suite;
+
                        int index = nameSpace.LastIndexOf(".");
-                       if(index==-1)
+                       string prefix = string.Format( "[{0}]", assemblyKey );
+                       if( index == -1 )
                        {
-                               suite = new TestSuite(nameSpace);
+                               suite = new TestSuite( nameSpace, assemblyKey );
                                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);
+                       else
+                       {
+                               string parentNameSpace = nameSpace.Substring( 0,index );
+                               TestSuite parent = BuildFromNameSpace( parentNameSpace, assemblyKey );
+                               string suiteName = nameSpace.Substring( index+1 );
+                               suite = new TestSuite( parentNameSpace, suiteName, assemblyKey );
+                               parent.Add( suite );
+                               suites[nameSpace] = suite;
+                       }
+
                        return suite;
                }
 
-               public TestSuite Build(string assemblyName)
+               public TestSuite Build(string projectName, IList assemblies)
+               {
+                       RootTestSuite rootSuite = new RootTestSuite( projectName );
+
+                       int assemblyKey = 0;
+                       foreach(string assembly in assemblies)
+                       {
+
+                               TestSuite suite = Build( assembly, assemblyKey++ );
+                               rootSuite.Add( suite );
+                       }
+
+                       return rootSuite;
+               }
+
+               public TestSuite Build( string assemblyName )
+               {
+                       return Build( assemblyName, 0 );
+               }
+
+               private TestSuite Build( string assemblyName, int assemblyKey )
                {
                        TestSuiteBuilder builder = new TestSuiteBuilder();
 
-                       Assembly assembly = Load(assemblyName);
+                       Assembly assembly = Load( assemblyName );
 
-                       builder.rootSuite = new TestSuite(assemblyName);
+                       builder.rootSuite = new AssemblyTestSuite( assemblyName, assemblyKey );
                        int testFixtureCount = 0;
                        Type[] testTypes = assembly.GetExportedTypes();
                        foreach(Type testType in testTypes)
                        {
+                               ////////////////////////////////////////////////////////////////////////
+                               // Use the second if statement to allow including Suites in the
+                               // tree of tests. This causes a problem when the same test is added
+                               // in multiple suites so we need to either fix it or prevent it.
+                               //
+                               // See also the block of code to uncomment in TestSUite.cs
+                               ////////////////////////////////////////////////////////////////////////
+
                                if(IsTestFixture(testType))
+                               //if(IsTestFixture(testType) || IsTestSuiteProperty(testType))
                                {
                                        testFixtureCount++;
                                        string namespaces = testType.Namespace;
-                                       TestSuite suite = builder.BuildFromNameSpace(namespaces);
+                                       TestSuite suite = builder.BuildFromNameSpace( namespaces, assemblyKey );
 
                                        try
                                        {
-                                               object fixture = BuildTestFixture(testType);
+                                               object fixture = BuildTestFixture( testType );
                                                suite.Add(fixture);
                                        }
                                        catch(InvalidTestFixtureException exception)
@@ -112,13 +163,17 @@ namespace NUnit.Core
                        }
 
                        if(testFixtureCount == 0)
-                               throw new NoTestFixturesException(assemblyName + " has no TestFixtures");
+                       {
+                               //throw new NoTestFixturesException(assemblyName + " has no TestFixtures");
+                               builder.rootSuite.ShouldRun = false;
+                               builder.rootSuite.IgnoreReason = "Has no TestFixtures";
+                       }
 
                        return builder.rootSuite;
                }
 
 
-               public TestSuite Build(string testName, string assemblyName)
+               public TestSuite Build(string assemblyName, string testName )
                {
                        TestSuite suite = null;
 
@@ -142,6 +197,35 @@ namespace NUnit.Core
                        return suite;
                }
 
+               public TestSuite Build( IList assemblies, string testName )
+               {
+                       TestSuite suite = null;
+
+                       foreach(string assemblyName in assemblies)
+                       {
+                               Assembly assembly = Load(assemblyName);
+                               if(assembly != null)
+                               {
+                                       Type testType = assembly.GetType(testName);
+                                       if(testType != null)
+                                       {
+                                               if(IsTestFixture(testType))
+                                               {
+                                                       suite = MakeSuiteFromTestFixtureType(testType);
+                                                       break;
+                                               }
+                                               else if(IsTestSuiteProperty(testType))
+                                               {
+                                                       suite = MakeSuiteFromProperty(testType);
+                                                       break;
+                                               }
+                                       }
+                               }
+                       }
+
+                       return suite;
+               }
+               
                private bool IsTestFixture(Type type)
                {
                        if(type.IsAbstract) return false;
@@ -149,7 +233,7 @@ namespace NUnit.Core
                        return type.IsDefined(typeof(NUnit.Framework.TestFixtureAttribute), true);
                }
 
-               public object BuildTestFixture(Type fixtureType)
+               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");
index 37143393cd84a90d0dddd3353c77a7ba1fe29803..5f870b2f2bf2fe72b935415bd5bdeca28843abd7 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
@@ -42,7 +42,7 @@ namespace NUnit.Core
                private ArrayList results = new ArrayList();
                private string message;
                
-               public TestSuiteResult(Test test, string name) : base(test, name)
+               public TestSuiteResult(ITest test, string name) : base(test, name)
                {
                        Executed = false;
                }
@@ -74,6 +74,22 @@ namespace NUnit.Core
                        }
                }
 
+               public override bool AllTestsExecuted
+               {
+                       get
+                       {
+                               if (!this.Executed)
+                                       return false;
+
+                               foreach( TestResult testResult in results )
+                               {
+                                       if ( !testResult.AllTestsExecuted )
+                                               return false;
+                               }
+                               return true;
+                       }
+               }
+
                public override void NotRun(string message)
                {
                        this.Executed = false;
@@ -86,12 +102,6 @@ namespace NUnit.Core
                        get { return message; }
                }
 
-               public override string StackTrace
-               {
-                       get { return null; }
-               }
-
-
                public IList Results
                {
                        get { return results; }
@@ -99,7 +109,7 @@ namespace NUnit.Core
 
                public override void Accept(ResultVisitor visitor) 
                {
-                       visitor.visit(this);
+                       visitor.Visit(this);
                }
        }
 }
index 670c70ab7c944ba96d8cddf2550f99fca19e2c3a..991d21305290dfe15c1d863750cb493ab6a8913e 100755 (executable)
-<?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
+<?xml version="1.0" encoding="utf-8" ?>
+<root>
+       <!-- 
+            Microsoft ResX Schema 
+        
+            Version 1.3
+                
+            The primary goals of this format is to allow a simple XML format 
+            that is mostly human readable. The generation and parsing of the 
+            various data types are done through the TypeConverter classes 
+            associated with the data types.
+        
+            Example:
+        
+                ... ado.net/XML headers & schema ...
+                <resheader name="resmimetype">text/microsoft-resx</resheader>
+                <resheader name="version">1.3</resheader>
+                <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+                <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+                <data name="Name1">this is my long string</data>
+                <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+                <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+                    [base64 mime encoded serialized .NET Framework object]
+                </data>
+                <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+                    [base64 mime encoded string representing a byte array form of the .NET Framework object]
+                </data>
+        
+            There are any number of "resheader" rows that contain simple 
+            name/value pairs.
+            
+            Each data row contains a name, and value. The row also contains a 
+            type or mimetype. Type corresponds to a .NET class that support 
+            text/value conversion through the TypeConverter architecture. 
+            Classes that don't support this are serialized and stored with the 
+            mimetype set.
+                     
+            The mimetype is used for serialized objects, and tells the 
+            ResXResourceReader how to depersist the object. This is currently not 
+            extensible. For a given mimetype the value must be set accordingly:
+        
+            Note - application/x-microsoft.net.object.binary.base64 is the format 
+                   that the ResXResourceWriter will generate, however the reader can 
+                   read any of the formats listed below.
+        
+            mimetype: application/x-microsoft.net.object.binary.base64
+            value   : The object must be serialized with 
+                    : System.Serialization.Formatters.Binary.BinaryFormatter
+                    : and then encoded with base64 encoding.
+        
+            mimetype: application/x-microsoft.net.object.soap.base64
+            value   : The object must be serialized with 
+                    : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+                    : and then encoded with base64 encoding.
+            mimetype: application/x-microsoft.net.object.bytearray.base64
+            value   : The object must be serialized into a byte array 
+                    : using a System.ComponentModel.TypeConverter
+                    : and then encoded with base64 encoding.
+        -->
+       <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+               <xsd:element name="root" msdata:IsDataSet="true">
+                       <xsd:complexType>
+                               <xsd:choice maxOccurs="unbounded">
+                                       <xsd:element name="data">
+                                               <xsd:complexType>
+                                                       <xsd:sequence>
+                                                               <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                                                               <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+                                                       </xsd:sequence>
+                                                       <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+                                                       <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+                                                       <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+                                               </xsd:complexType>
+                                       </xsd:element>
+                                       <xsd:element name="resheader">
+                                               <xsd:complexType>
+                                                       <xsd:sequence>
+                                                               <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                                                       </xsd:sequence>
+                                                       <xsd:attribute name="name" type="xsd:string" use="required" />
+                                               </xsd:complexType>
+                                       </xsd:element>
+                               </xsd:choice>
+                       </xsd:complexType>
+               </xsd:element>
+       </xsd:schema>
+       <resheader name="resmimetype">
+               <value>text/microsoft-resx</value>
+       </resheader>
+       <resheader name="version">
+               <value>1.3</value>
+       </resheader>
+       <resheader name="reader">
+               <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+       </resheader>
+       <resheader name="writer">
+               <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+       </resheader>
+       <data name="Summary.xslt">
+               <value>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
+&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
+&lt;xsl:output method='text'/&gt;
+
+&lt;xsl:template match="/"&gt;
+       &lt;xsl:apply-templates/&gt;
+&lt;/xsl:template&gt;
+
+&lt;xsl:template match="test-results"&gt;
+&lt;xsl:text&gt;Tests run: &lt;/xsl:text&gt;
+&lt;xsl:value-of select="@total"/&gt;
+&lt;xsl:text&gt;, Failures: &lt;/xsl:text&gt;
+&lt;xsl:value-of select="@failures"/&gt;
+&lt;xsl:text&gt;, Not run: &lt;/xsl:text&gt;
+&lt;xsl:value-of select="@not-run"/&gt;
+&lt;xsl:text&gt;, Time: &lt;/xsl:text&gt;
+&lt;xsl:value-of select="test-suite/@time"/&gt;
+&lt;xsl:text&gt; seconds
+&lt;/xsl:text&gt;
+&lt;xsl:text&gt;
+&lt;/xsl:text&gt;
+
+&lt;xsl:if test="//test-case[failure]"&gt;&lt;xsl:text&gt;Failures:
+&lt;/xsl:text&gt;&lt;/xsl:if&gt;
+&lt;xsl:apply-templates select="//test-case[failure]"/&gt;
+&lt;xsl:if test="//test-case[@executed='False']"&gt;&lt;xsl:text&gt;Tests not run:
+&lt;/xsl:text&gt;&lt;/xsl:if&gt;
+&lt;xsl:apply-templates select="//test-case[@executed='False']"/&gt;
+&lt;xsl:text disable-output-escaping='yes'&gt;&amp;#xD;&amp;#xA;&lt;/xsl:text&gt;
+&lt;/xsl:template&gt;
+
+&lt;xsl:template match="test-case"&gt;
+       &lt;xsl:value-of select="position()"/&gt;&lt;xsl:text&gt;) &lt;/xsl:text&gt;
+       &lt;xsl:value-of select="@name"/&gt;
+       &lt;xsl:text&gt; : &lt;/xsl:text&gt;
+       &lt;xsl:value-of select="child::node()/message"/&gt;
+&lt;xsl:text disable-output-escaping='yes'&gt;&amp;#xD;&amp;#xA;&lt;/xsl:text&gt;
+       &lt;xsl:if test="failure"&gt;
+               &lt;xsl:value-of select="failure/stack-trace"/&gt;
+&lt;xsl:text&gt;
+&lt;/xsl:text&gt;
+       &lt;/xsl:if&gt;
+&lt;/xsl:template&gt;
+
+&lt;/xsl:stylesheet&gt;
+
+  </value>
+       </data>
 </root>
\ No newline at end of file
index 960153238e9bab40beb9607b71daca5a2feeb6d5..75250baa074d142057e0c9523d07f4283f40f1df 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
index 6faa781375a82513a9e9357fe2a03af28d070093..8409314e2d7352570f97651576de76253c36e2db 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
@@ -41,18 +41,26 @@ namespace NUnit.Core
        public class XmlResultVisitor : ResultVisitor
        {
                private XmlTextWriter xmlWriter;
+               private TextWriter writer;
+               private MemoryStream memoryStream;
 
                public XmlResultVisitor(string fileName, TestResult result)
+               {
+                       xmlWriter = new XmlTextWriter( new StreamWriter(fileName, false, System.Text.Encoding.UTF8) );
+                       Initialize(result);
+               }
+
+               public XmlResultVisitor( TextWriter writer, TestResult result )
+               {
+                       this.memoryStream = new MemoryStream();
+                       this.writer = writer;
+                       this.xmlWriter = new XmlTextWriter( new StreamWriter( memoryStream, System.Text.Encoding.UTF8 ) );
+                       Initialize( result );
+               }
+
+               private void Initialize(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);
@@ -68,13 +76,16 @@ namespace NUnit.Core
                        DateTime now = DateTime.Now;
                        xmlWriter.WriteAttributeString("date", now.ToShortDateString());
                        xmlWriter.WriteAttributeString("time", now.ToShortTimeString());
-
                }
 
-               public void visit(TestCaseResult caseResult) 
+               public void Visit(TestCaseResult caseResult) 
                {
                        xmlWriter.WriteStartElement("test-case");
                        xmlWriter.WriteAttributeString("name",caseResult.Name);
+
+                       if(caseResult.Description != null)
+                               xmlWriter.WriteAttributeString("description", caseResult.Description);
+
                        xmlWriter.WriteAttributeString("executed", caseResult.Executed.ToString());
                        if(caseResult.Executed)
                        {
@@ -90,12 +101,12 @@ namespace NUnit.Core
                                                xmlWriter.WriteStartElement("error");
                                
                                        xmlWriter.WriteStartElement("message");
-                                       xmlWriter.WriteCData(caseResult.Message);
+                                       xmlWriter.WriteCData( EncodeCData( caseResult.Message ) );
                                        xmlWriter.WriteEndElement();
                                
                                        xmlWriter.WriteStartElement("stack-trace");
                                        if(caseResult.StackTrace != null)
-                                               xmlWriter.WriteCData(StackTraceFilter.Filter(caseResult.StackTrace));
+                                               xmlWriter.WriteCData( EncodeCData( StackTraceFilter.Filter( caseResult.StackTrace ) ) );
                                        xmlWriter.WriteEndElement();
                                
                                        xmlWriter.WriteEndElement();
@@ -114,10 +125,21 @@ namespace NUnit.Core
                        xmlWriter.WriteEndElement();
                }
 
-               public void visit(TestSuiteResult suiteResult) 
+               private string EncodeCData( string text )
+               {
+                       if ( text.IndexOf( "]]>" ) < 0 )
+                               return text;
+
+                       return text.Replace( "]]>", "]]&gt;" );
+               }
+
+               public void Visit(TestSuiteResult suiteResult) 
                {
                        xmlWriter.WriteStartElement("test-suite");
                        xmlWriter.WriteAttributeString("name",suiteResult.Name);
+                       if(suiteResult.Description != null)
+                               xmlWriter.WriteAttributeString("description", suiteResult.Description);
+
                        xmlWriter.WriteAttributeString("success", suiteResult.IsSuccess.ToString());
                        xmlWriter.WriteAttributeString("time", suiteResult.Time.ToString());
             
@@ -133,11 +155,27 @@ namespace NUnit.Core
 
                public void Write()
                {
-                       xmlWriter.WriteEndElement();
+                       try 
+                       {
+                               xmlWriter.WriteEndElement();
+                               xmlWriter.WriteEndDocument();
+                               xmlWriter.Flush();
+
+                               if ( memoryStream != null && writer != null )
+                               {
+                                       memoryStream.Position = 0;
+                                       using ( StreamReader rdr = new StreamReader( memoryStream ) )
+                                       {
+                                               writer.Write( rdr.ReadToEnd() );
+                                       }
+                               }
 
-                       xmlWriter.WriteEndDocument();
-                       xmlWriter.Flush();
-                       xmlWriter.Close();
+                               xmlWriter.Close();
+                       } 
+                       finally 
+                       {
+                               //writer.Close();
+                       }
                }
        }
 }
index 9500831c1708f4e1f9e6ab15ca7f15091d89ff16..28930eb9a8416fefcc8b34c4bcba49ebe8a92db9 100755 (executable)
@@ -1,8 +1,8 @@
 <VisualStudioProject>
     <CSHARP
         ProjectType = "Local"
-        ProductVersion = "7.0.9466"
-        SchemaVersion = "1.0"
+        ProductVersion = "7.10.3077"
+        SchemaVersion = "2.0"
         ProjectGuid = "{83DD7E12-A705-4DBA-9D71-09C8973D9382}"
     >
         <Build>
                 DefaultTargetSchema = "IE50"
                 DelaySign = "false"
                 OutputType = "Library"
+                PreBuildEvent = ""
+                PostBuildEvent = ""
                 RootNamespace = "NUnit.Framework"
+                RunPostBuildEvent = "OnBuildSuccess"
                 StartupObject = ""
             >
                 <Config
                     CheckForOverflowUnderflow = "false"
                     ConfigurationOverrideFile = ""
                     DefineConstants = "DEBUG;TRACE;NUNIT_LEAKAGE_TEST"
-                    DocumentationFile = ""
+                    DocumentationFile = "bin\Debug\nunit.framework.xml"
                     DebugSymbols = "true"
                     FileAlignment = "4096"
                     IncrementalBuild = "true"
+                    NoStdLib = "false"
+                    NoWarn = ""
                     Optimize = "false"
                     OutputPath = "bin\Debug\"
                     RegisterForComInterop = "false"
                     CheckForOverflowUnderflow = "false"
                     ConfigurationOverrideFile = ""
                     DefineConstants = "TRACE;StronglyNamedAssembly"
-                    DocumentationFile = ""
+                    DocumentationFile = "bin\Release\nunit.framework.xml"
                     DebugSymbols = "false"
                     FileAlignment = "4096"
                     IncrementalBuild = "false"
+                    NoStdLib = "false"
+                    NoWarn = ""
                     Optimize = "true"
                     OutputPath = "bin\Release\"
                     RegisterForComInterop = "false"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
+                <File
+                    RelPath = "Assert.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
                 <File
                     RelPath = "Assertion.cs"
                     SubType = "Code"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
+                <File
+                    RelPath = "ITest.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
                 <File
                     RelPath = "LongLivingMarshalByRefObject.cs"
                     SubType = "Code"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
+                <File
+                    RelPath = "RootTestSuite.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
                 <File
                     RelPath = "SetUpAttribute.cs"
                     SubType = "Code"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
+                <File
+                    RelPath = "StringTextWriter.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
                 <File
                     RelPath = "SuiteAttribute.cs"
                     SubType = "Code"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
+                <File
+                    RelPath = "TestAssembly.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
                 <File
                     RelPath = "TestAttribute.cs"
                     SubType = "Code"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
-                <File
-                    RelPath = "TestInfo.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
                 <File
                     RelPath = "TestResult.cs"
                     SubType = "Code"
index c60475180cfe5ec278d616c0fad5867b7f46528b..91098ac18f49f533d115855967429ece16545f65 100755 (executable)
@@ -1,3 +1,32 @@
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' 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-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' 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.Reflection;
 using System.Runtime.CompilerServices;
 
@@ -11,7 +40,7 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("NUnit")]
-[assembly: AssemblyCopyright("Copyright (C) 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov. \nCopyright (C) 2000-2002 Philip Craig.\nAll Rights Reserved.")]
+[assembly: AssemblyCopyright("Copyright (C) 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole.\r\nCopyright (C) 2000-2003 Philip Craig.\r\nAll Rights Reserved.")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]                
 
@@ -26,7 +55,7 @@ using System.Runtime.CompilerServices;
 // 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")]
+[assembly: AssemblyVersion("2.1.4.0")]
 
 //
 // In order to sign your assembly you must specify a key to use. Refer to the 
index a772e71ef422c9f3a340394db82a459d7984bba2..45ebf69b7c727fc0cb75484e8e8a00f86c6ff303 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
 '
 ' 2. Altered source versions must be plainly marked as such, and must not be 
 ' misrepresented as being the original software.
@@ -30,6 +30,8 @@
 namespace NUnit.Console
 {
        using System;
+       using System.Collections;
+       using System.Collections.Specialized;
        using System.IO;
        using System.Reflection;
        using System.Xml;
@@ -37,6 +39,8 @@ namespace NUnit.Console
        using System.Xml.XPath;
        using System.Resources;
        using System.Text;
+       using System.Text.RegularExpressions;
+       using System.Diagnostics;
        using NUnit.Core;
        using NUnit.Util;
        
@@ -46,10 +50,12 @@ namespace NUnit.Console
        /// </summary>
        public class ConsoleUi
        {
-               private NUnit.Framework.TestDomain testDomain;
-               private string outputFile;
+               private NUnit.Core.TestDomain testDomain;
                private XmlTextReader transformReader;
+               private bool silent;
+               private string xmlOutput;
 
+               [STAThread]
                public static int Main(string[] args)
                {
                        int returnCode = 0;
@@ -64,58 +70,68 @@ namespace NUnit.Console
                        }
                        else if(parser.NoArgs) 
                        {
-                               Console.Error.WriteLine("\nfatal error: no inputs specified");
+                               Console.Error.WriteLine("fatal error: no inputs specified");
                                parser.Help();
                        }
                        else if(!parser.Validate())
                        {
-                               Console.Error.WriteLine("\nfatal error: invalid arguments");
+                               Console.Error.WriteLine("fatal error: invalid arguments");
                                parser.Help();
                                returnCode = 2;
                        }
                        else
                        {
-                               ConsoleWriter outStream = new ConsoleWriter(Console.Out);
-                               ConsoleWriter errorStream = new ConsoleWriter(Console.Error);
-                               NUnit.Framework.TestDomain domain = new NUnit.Framework.TestDomain(outStream, errorStream);
+                               NUnit.Core.TestDomain domain = new NUnit.Core.TestDomain();
 
-                               Test test = MakeTestFromCommandLine(domain, parser);
                                try
                                {
+                                       Test test = MakeTestFromCommandLine(domain, parser);
+
                                        if(test == null)
                                        {
-                                               Console.Error.WriteLine("\nfatal error: invalid assembly {0}", parser.Assembly);
+                                               Console.Error.WriteLine("fatal error: invalid assembly {0}", parser.Parameters[0]);
                                                returnCode = 2;
                                        }
                                        else
                                        {
-                                               Directory.SetCurrentDirectory(new FileInfo(parser.Assembly).DirectoryName);
+                                               Directory.SetCurrentDirectory(new FileInfo((string)parser.Parameters[0]).DirectoryName);
                                                string xmlResult = "TestResult.xml";
                                                if(parser.IsXml)
                                                        xmlResult = parser.xml;
-
+                               
                                                XmlTextReader reader = GetTransformReader(parser);
                                                if(reader != null)
                                                {
-                                                       ConsoleUi consoleUi = new ConsoleUi(domain, xmlResult, reader);
+                                                       ConsoleUi consoleUi = new ConsoleUi(domain, reader, parser.xmlConsole);
                                                        returnCode = consoleUi.Execute();
-                                                       if(parser.wait)
+
+                                                       if (parser.xmlConsole)
+                                                               Console.WriteLine(consoleUi.XmlOutput);
+                                                       using (StreamWriter writer = new StreamWriter(xmlResult)) 
                                                        {
-                                                               Console.Out.WriteLine("Hit <enter> key to continue");
-                                                               Console.ReadLine();
+                                                               writer.Write(consoleUi.XmlOutput);
                                                        }
                                                }
                                                else
                                                        returnCode = 3;
                                        }
                                }
+                               catch( Exception ex )
+                               {
+                                       Console.WriteLine( "Unhandled Exception: {0}", ex.ToString() );
+                               }
                                finally
                                {
                                        domain.Unload();
+
+                                       if(parser.wait)
+                                       {
+                                               Console.Out.WriteLine("\nHit <enter> key to continue");
+                                               Console.ReadLine();
+                                       }
                                }
                        }
 
-
                        return returnCode;
                }
 
@@ -135,7 +151,7 @@ namespace NUnit.Console
                                FileInfo xsltInfo = new FileInfo(parser.transform);
                                if(!xsltInfo.Exists)
                                {
-                                       Console.Error.WriteLine("\nTransform file: {0} does not exist", xsltInfo.FullName);
+                                       Console.Error.WriteLine("Transform file: {0} does not exist", xsltInfo.FullName);
                                        reader = null;
                                }
                                else
@@ -160,26 +176,35 @@ namespace NUnit.Console
 
                        Console.WriteLine(String.Format("{0} version {1}", productAttr.Product, version.ToString(3)));
                        Console.WriteLine(copyrightAttr.Copyright);
+                       Console.WriteLine();
                }
 
-               private static Test MakeTestFromCommandLine(NUnit.Framework.TestDomain testDomain, 
+               private static Test MakeTestFromCommandLine(NUnit.Core.TestDomain testDomain, 
                        ConsoleOptions parser)
                {
-                       Test test = null;
-
-                       if(!DoesFileExist(parser.Assembly)) return null; 
+                       if(!DoAssembliesExist(parser.Parameters)) return null; 
                        
-                       if(parser.IsAssembly)
-                       {
-                               test = testDomain.Load(parser.Assembly);
-                               if(test == null) Console.WriteLine("\nfatal error: assembly ({0}) is invalid", parser.Assembly);
-                       }
-                       else if(parser.IsFixture)
+                       NUnitProject project;
+
+                       if ( parser.IsTestProject )
                        {
-                               test = testDomain.Load(parser.fixture, parser.Assembly);
-                               if(test == null) Console.WriteLine("\nfatal error: fixture ({0}) in assembly ({1}) is invalid", parser.fixture, parser.Assembly);
+                               project = NUnitProject.LoadProject( (string)parser.Parameters[0] );
+                               string configName = (string) parser.config;
+                               if ( configName != null )
+                                       project.SetActiveConfig( configName );
                        }
-                       return test;
+                       else
+                               project = NUnitProject.FromAssemblies( (string[])parser.Parameters.ToArray( typeof( string ) ) );
+
+                       return project.LoadTest( testDomain, parser.fixture );
+               }
+
+               private static bool DoAssembliesExist(IList files)
+               {
+                       bool exist = true; 
+                       foreach(string fileName in files)
+                               exist &= DoesFileExist(fileName);
+                       return exist;
                }
 
                private static bool DoesFileExist(string fileName)
@@ -188,33 +213,43 @@ namespace NUnit.Console
                        return fileInfo.Exists;
                }
 
-               private static void WriteHelp(TextWriter writer)
+               public ConsoleUi(NUnit.Core.TestDomain testDomain, XmlTextReader reader, bool silent)
                {
-                       writer.WriteLine("\n\n         NUnit console options\n");
-                       writer.WriteLine("/assembly:<assembly name>                            Assembly to test");
-                       writer.WriteLine("/fixture:<class name> /assembly:<assembly name>      Fixture or Suite to run");
-                       writer.WriteLine("\n\n         XML formatting options");
-                       writer.WriteLine("/xml:<file>                 XML result file to generate");
-                       writer.WriteLine("/transform:<file>           XSL transform file");
+                       this.testDomain = testDomain;
+                       transformReader = reader;
+                       this.silent = silent;
                }
 
-               public ConsoleUi(NUnit.Framework.TestDomain testDomain, string xmlFile, XmlTextReader reader)
+               public string XmlOutput
                {
-                       this.testDomain = testDomain;
-                       outputFile = xmlFile;
-                       transformReader = reader;
+                       get { return xmlOutput; }
                }
 
                public int Execute()
                {
-                       EventCollector collector = new EventCollector();
-                       TestResult result = testDomain.Run(collector);
+                       EventListener collector = null;
+                       if (silent)
+                               collector = new NullListener();
+                       else
+                               collector = new EventCollector();
+                       ConsoleWriter outStream = new ConsoleWriter(Console.Out);
+                       ConsoleWriter errorStream = new ConsoleWriter(Console.Error);
+                       
+                       string savedDirectory = Environment.CurrentDirectory;
+                       TestResult result = testDomain.Run(collector, outStream, errorStream);
+                       Directory.SetCurrentDirectory( savedDirectory );
+                       
+                       Console.WriteLine();
 
-                       Console.WriteLine("\n");
-                       XmlResultVisitor resultVisitor = new XmlResultVisitor(outputFile, result);
+                       StringBuilder builder = new StringBuilder();
+                       XmlResultVisitor resultVisitor = new XmlResultVisitor(new StringWriter( builder ), result);
                        result.Accept(resultVisitor);
                        resultVisitor.Write();
-                       CreateSummaryDocument();
+
+                       xmlOutput = builder.ToString();
+
+                       if (!silent)
+                               CreateSummaryDocument();
 
                        int resultCode = 0;
                        if(result.IsFailure)
@@ -224,7 +259,7 @@ namespace NUnit.Console
 
                private void CreateSummaryDocument()
                {
-                       XPathDocument originalXPathDocument = new XPathDocument (outputFile);
+                       XPathDocument originalXPathDocument = new XPathDocument(new StringReader(xmlOutput));
                        XslTransform summaryXslTransform = new XslTransform();
                        summaryXslTransform.Load(transformReader);
                        
@@ -233,17 +268,38 @@ namespace NUnit.Console
 
                private class EventCollector : LongLivingMarshalByRefObject, EventListener
                {
+                       private int level;
+                       private int testRunCount;
+                       private int testIgnoreCount;
+                       private int failureCount;
+                       StringCollection messages;
+               
+                       private bool debugger = false;
+
+                       public EventCollector()
+                       {
+                               debugger = Debugger.IsAttached;
+                               level = 0;
+                       }
+
                        public void TestFinished(TestCaseResult testResult)
                        {
                                if(testResult.Executed)
                                {
+                                       testRunCount++;
                                        if(testResult.IsFailure)
                                        {       
+                                               failureCount++;
                                                Console.Write("F");
+                                               if ( debugger )
+                                                       messages.Add( ParseTestCaseResult( testResult ) );
                                        }
                                }
                                else
+                               {
+                                       testIgnoreCount++;
                                        Console.Write("N");
+                               }
                        }
 
                        public void TestStarted(TestCase testCase)
@@ -251,9 +307,68 @@ namespace NUnit.Console
                                Console.Write(".");
                        }
 
-                       public void SuiteStarted(TestSuite suite) {}
-                       public void SuiteFinished(TestSuiteResult result) {}
-               }
+                       public void SuiteStarted(TestSuite suite) 
+                       {
+                               if ( debugger && level++ == 0 )
+                               {
+                                       messages = new StringCollection();
+                                       testRunCount = 0;
+                                       testIgnoreCount = 0;
+                                       failureCount = 0;
+                                       Debug.WriteLine( "################################ UNIT TESTS ################################" );
+                                       Debug.WriteLine( "Running tests in '" + suite.FullName + "'..." );
+                               }
+                       }
+
+                       public void SuiteFinished(TestSuiteResult suiteResult) 
+                       {
+                               if ( debugger && --level == 0 ) 
+                               {
+                                       Debug.WriteLine( "############################################################################" );
+
+                                       if (messages.Count == 0) 
+                                       {
+                                               Debug.WriteLine( "##############                 S U C C E S S               #################" );
+                                       }
+                                       else 
+                                       {
+                                               Debug.WriteLine( "##############                F A I L U R E S              #################" );
+                                               
+                                               foreach ( string s in messages ) 
+                                               {
+                                                       Debug.WriteLine(s);
+                                               }
+                                       }
+
+                                       Debug.WriteLine( "############################################################################" );
+                                       Debug.WriteLine( "Executed tests : " + testRunCount );
+                                       Debug.WriteLine( "Ignored tests  : " + testIgnoreCount );
+                                       Debug.WriteLine( "Failed tests   : " + failureCount );
+                                       Debug.WriteLine( "Total time     : " + suiteResult.Time + " seconds" );
+                                       Debug.WriteLine( "############################################################################");
+                               }
+                       }
 
+                       private string ParseTestCaseResult( TestCaseResult result ) 
+                       {
+                               string[] trace = result.StackTrace.Split( System.Environment.NewLine.ToCharArray() );
+                       
+                               foreach (string s in trace) 
+                               {
+                                       if ( s.IndexOf( result.Test.FullName ) >= 0 ) 
+                                       {
+                                               string link = Regex.Replace( s.Trim(), @"at " + result.Test.FullName + @"\(\) in (.*):line (.*)", "$1($2)");
+
+                                               string message = string.Format("{1}: {0}", 
+                                                       result.Message.Replace(System.Environment.NewLine, "; "), 
+                                                       result.Test.FullName).Trim(' ', ':');
+                                       
+                                               return string.Format("{0}: {1}", link, message);
+                                       }
+                               }
+
+                               return result.Message;
+                       }
+               }
        }
 }
index cfbf2d31055562cc38ddf703f6ab695a1a5b4308..1beea7d7c51ef466e677fad593412a1c65a7f0bb 100755 (executable)
@@ -1,8 +1,8 @@
 <VisualStudioProject>
     <CSHARP
         ProjectType = "Local"
-        ProductVersion = "7.0.9466"
-        SchemaVersion = "1.0"
+        ProductVersion = "7.10.3077"
+        SchemaVersion = "2.0"
         ProjectGuid = "{9367EC89-6A38-42BA-9607-0DC288E4BC3A}"
     >
         <Build>
                 DefaultTargetSchema = "IE50"
                 DelaySign = "false"
                 OutputType = "Exe"
+                PreBuildEvent = ""
+                PostBuildEvent = 'copy "$(ProjectDir)nunit-console.exe.1.1.config" "$(TargetDir)nunit-console.exe.config"'
                 RootNamespace = "nunit_console"
+                RunPostBuildEvent = "OnBuildSuccess"
                 StartupObject = ""
             >
                 <Config
@@ -30,6 +33,8 @@
                     DebugSymbols = "true"
                     FileAlignment = "4096"
                     IncrementalBuild = "true"
+                    NoStdLib = "false"
+                    NoWarn = ""
                     Optimize = "false"
                     OutputPath = "bin\Debug\"
                     RegisterForComInterop = "false"
@@ -48,6 +53,8 @@
                     DebugSymbols = "false"
                     FileAlignment = "4096"
                     IncrementalBuild = "false"
+                    NoStdLib = "false"
+                    NoWarn = ""
                     Optimize = "true"
                     OutputPath = "bin\Release\"
                     RegisterForComInterop = "false"
         </Build>
         <Files>
             <Include>
-                <File
-                    RelPath = "app.config"
-                    BuildAction = "None"
-                />
                 <File
                     RelPath = "AssemblyInfo.cs"
                     SubType = "Code"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
+                <File
+                    RelPath = "nunit-console.exe.1.0.config"
+                    BuildAction = "None"
+                />
+                <File
+                    RelPath = "nunit-console.exe.1.1.config"
+                    BuildAction = "None"
+                />
             </Include>
         </Files>
     </CSHARP>
index 323cdb4750ef80f21d168070efa5919c0c8fe614..b970c87440c55dd17d97c19825ff739f5087affe 100755 (executable)
@@ -1,3 +1,32 @@
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
+/************************************************************************************
+'
+' Copyright  2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' 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-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' 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.Reflection;
 using System.Runtime.CompilerServices;
 
@@ -26,7 +55,7 @@ using System.Runtime.CompilerServices;
 // 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")]
+[assembly: AssemblyVersion("2.1.4.0")]
 
 //
 // In order to sign your assembly you must specify a key to use. Refer to the 
index df341dcab37ed3379f9abcd73e1c4677336e1efc..ae6967b72e66ec855482efa2a3aeb093d1495de0 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright  2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright  2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' 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.
 '***********************************************************************************/
 #endregion
 
-
 using System;
 using System.IO;
 using System.Text;
 using System.Timers;
+using System.Collections;
+using NUnit.Core;
 
 namespace NUnit.Util
 {
        /// <summary>
-       /// AssemblyWatcher keeps track of a single assembly to see if
-       /// it has changed. It incorporates a delayed notification
+       /// AssemblyWatcher keeps track of one or more assemblies to 
+       /// see if they have changed. It incorporates a delayed notification
        /// and uses a standard event to notify any interested parties
        /// about the change. The path to the assembly is provided as
        /// an argument to the event handler so that one routine can
@@ -45,54 +46,60 @@ namespace NUnit.Util
        /// </summary>
        public class AssemblyWatcher
        {
-               FileSystemWatcher fileWatcher;
+               FileSystemWatcher[] fileWatcher;
+               FileInfo[] fileInfo;
+
                protected System.Timers.Timer timer;
-               FileInfo fileInfo;
+               protected string changedAssemblyPath; 
 
                public delegate void AssemblyChangedHandler(String fullPath);
                public event AssemblyChangedHandler AssemblyChangedEvent;
 
-               public AssemblyWatcher(int delay, FileInfo file)
+               public AssemblyWatcher( int delay, string assemblyFileName )
+                       : this( delay, new string[]{ assemblyFileName } ) { }
+
+               public AssemblyWatcher( int delay, IList assemblies )
                {
-                       fileWatcher = new FileSystemWatcher();
-                       fileWatcher.Path = file.DirectoryName;
-                       fileWatcher.Filter = file.Name;
-                       fileWatcher.NotifyFilter = NotifyFilters.Size | NotifyFilters.LastWrite;
-                       fileWatcher.Changed+=new FileSystemEventHandler(OnChanged);
-                       fileWatcher.EnableRaisingEvents = false;
+                       fileInfo = new FileInfo[assemblies.Count];
+                       fileWatcher = new FileSystemWatcher[assemblies.Count];
+
+                       for( int i = 0; i < assemblies.Count; i++ )
+                       {
+                               fileInfo[i] = new FileInfo( (string)assemblies[i] );
+
+                               fileWatcher[i] = new FileSystemWatcher();
+                               fileWatcher[i].Path = fileInfo[i].DirectoryName;
+                               fileWatcher[i].Filter = fileInfo[i].Name;
+                               fileWatcher[i].NotifyFilter = NotifyFilters.Size | NotifyFilters.LastWrite;
+                               fileWatcher[i].Changed+=new FileSystemEventHandler(OnChanged);
+                               fileWatcher[i].EnableRaisingEvents = false;
+                       }
 
-                       fileInfo = file;
-                       
                        timer = new System.Timers.Timer( delay );
                        timer.AutoReset=false;
                        timer.Enabled=false;
                        timer.Elapsed+=new ElapsedEventHandler(OnTimer);
                }
 
-               public string Name
+               public FileInfo GetFileInfo( int index )
                {
-                       get { return fileInfo.Name; }
+                       return fileInfo[index];
                }
 
-               public string DirectoryName
-               {
-                       get { return fileInfo.DirectoryName; }
-               }
-
-               public string FullName
+               public void Start()
                {
-                       get { return fileInfo.FullName; }
+                       EnableWatchers( true );
                }
 
-
-               public void Start()
+               public void Stop()
                {
-                       fileWatcher.EnableRaisingEvents=true;
+                       EnableWatchers( false );
                }
 
-               public void Stop()
+               private void EnableWatchers( bool enable )
                {
-                       fileWatcher.EnableRaisingEvents=false;
+                       foreach( FileSystemWatcher watcher in fileWatcher )
+                               watcher.EnableRaisingEvents = enable;
                }
 
                protected void OnTimer(Object source, ElapsedEventArgs e)
@@ -106,14 +113,13 @@ namespace NUnit.Util
                
                protected void OnChanged(object source, FileSystemEventArgs e)
                {
+                       changedAssemblyPath = e.FullPath;
                        if ( timer != null )
                        {
                                lock(this)
                                {
                                        if(!timer.Enabled)
-                                       {
                                                timer.Enabled=true;
-                                       }
                                        timer.Start();
                                }
                        }
@@ -126,7 +132,7 @@ namespace NUnit.Util
                protected void PublishEvent()
                {
                        if ( AssemblyChangedEvent != null )
-                               AssemblyChangedEvent( fileInfo.FullName );
+                               AssemblyChangedEvent( changedAssemblyPath );
                }
        }
 }
\ No newline at end of file
index c6e44535523e52da02b50b5f634c00661cdfab76..4c76a973b8b3d84a424ac1b3eb3ab73062c8c31b 100755 (executable)
@@ -215,8 +215,7 @@ namespace Codeblast
                protected virtual void SplitOptionAndValue(ref string opt, ref object val)
                {
                        // Look for ":" or "=" separator in the option:
-                       int pos = opt.IndexOf(':');
-                       if (pos < 1) pos = opt.IndexOf('=');
+                       int pos = opt.IndexOfAny( new char[] { ':', '=' } );
                        if (pos < 1) return;
 
                        val = opt.Substring(pos+1);
@@ -276,7 +275,7 @@ namespace Codeblast
                                                helpText.AppendFormat("/{0,-20}{1}", field.Name+valType, att.Description);
                                                if (att.Short != null) 
                                                        helpText.AppendFormat(" (Short format: /{0}{1})", att.Short, valType);
-                                               helpText.Append('\n');
+                                               helpText.Append( Environment.NewLine );
                                        }
                                }
                        }
index 2abe588b8db3cdf005fbde9daf305259c4382022..e1ee4ee8b4653180b74fc250e54dd87f2b398c8c 100755 (executable)
@@ -1,3 +1,32 @@
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
+/************************************************************************************
+'
+' Copyright  2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' 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-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' 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.Util
 {
        using System;
@@ -8,7 +37,7 @@ namespace NUnit.Util
                [Option(Description = "Fixture to test")]
                public string fixture;
 
-               [Option(Description = "Name of Xml output file")]
+               [Option(Description = "Name of XML output file")]
                public string xml;
 
                [Option(Description = "Name of transform file")]
@@ -23,6 +52,12 @@ namespace NUnit.Util
                [Option(Description = "Require input to close console window")]
                public bool wait = false;
 
+               [Option(Description = "Display XML to the console")]
+               public bool xmlConsole;
+
+               [Option(Description = "Project configuration to load")]
+               public string config;
+
                private bool isInvalid = false; 
 
                public ConsoleOptions(String[] args) : base(args) 
@@ -41,25 +76,24 @@ namespace NUnit.Util
 
                        if(IsFixture) return true; 
 
-                       if(ParameterCount == 1) return true; 
+                       if(ParameterCount >= 1) return true; 
 
                        return false;
                }
 
-               public string Assembly
+               public bool IsAssembly 
                {
                        get 
                        {
-                               return (string)Parameters[0];
+                               return ParameterCount >= 1 && !IsFixture;
                        }
                }
 
-
-               public bool IsAssembly 
+               public bool IsTestProject
                {
-                       get 
+                       get
                        {
-                               return ParameterCount == 1 && !IsFixture;
+                               return ParameterCount == 1 && NUnitProject.CanLoadAsProject( (string)Parameters[0] );
                        }
                }
 
@@ -67,7 +101,7 @@ namespace NUnit.Util
                {
                        get 
                        {
-                               return ParameterCount == 1 && 
+                               return ParameterCount >= 1 && 
                                           ((fixture != null) && (fixture.Length > 0));
                        }
                }
@@ -87,5 +121,20 @@ namespace NUnit.Util
                                return (transform != null) && (transform.Length != 0);
                        }
                }
+
+               public override void Help()
+               {
+                       Console.WriteLine();
+                       Console.WriteLine( "NUNIT-CONSOLE [inputfiles] [options]" );
+                       Console.WriteLine();
+                       Console.WriteLine( "Runs a set of NUnit tests from the console." );
+                       Console.WriteLine();
+                       Console.WriteLine( "You may specify one or more assemblies or a single" );
+                       Console.WriteLine( "project file of type .nunit." );
+                       Console.WriteLine();
+                       Console.WriteLine( "Options:" );
+                       base.Help();
+                       Console.WriteLine();
+               }
        }
-}
\ No newline at end of file
+}
index 45f2a2ffa33e1593be10d63662e4de39c535cd00..118fe067f9a749eff9f56310aaa23d57c3854132 100755 (executable)
@@ -1,3 +1,32 @@
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
+/************************************************************************************
+'
+' Copyright  2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' 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-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' 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.Util
 {
        using System;
@@ -10,6 +39,12 @@ namespace NUnit.Util
                [Option(Short="?", Description = "Display help")]
                public bool help = false;
 
+               [Option(Description = "Project configuration to load")]
+               public string config;
+
+               [Option(Description = "Suppress loading of last project")]
+               public bool noload;
+
                public GuiOptions(String[] args) : base(args) 
                {}
 
@@ -34,7 +69,7 @@ namespace NUnit.Util
 
                public bool Validate()
                {
-                       return (NoArgs || ParameterCount == 1) && !isInvalid;
+                       return (NoArgs || ParameterCount <= 1) && !isInvalid;
                }
        }
 }
\ No newline at end of file
index e319123c3011a3b7ef717e6a08b9d16955582036..fd0f9594f84af1e9b18a5e88c9c0d20a5145712c 100644 (file)
@@ -3,6 +3,7 @@ SUBDIRS =
 include ../../build/rules.make
 
 LIBRARY = NUnit.Util.dll
+LOCAL_MCS_FLAGS= -r:NUnit.Framework.dll -r:System.Xml.dll
 NO_TEST = yo
 
 EXTRA_DISTFILES = nunit.util.dll.csproj
index 968c82b28b85e4c0b2316e0b08e631e8e7730949..af34ab25667b16c2d37930cb896e5c7c8a61c0ba 100644 (file)
@@ -1,2 +1,9 @@
+./AssemblyList.cs
+./AssemblyListItem.cs
 ./CommandLineOptions.cs
 ./ConsoleOptions.cs
+./NUnitProject.cs
+./ProjectConfig.cs
+./ProjectConfigCollection.cs
+./ProjectFormatException.cs
+./ProjectPath.cs
index 1812197cefd437d03beb92bc9e3a32b6cdb2fecc..9fec88fa39f4fd8488c5dbbcb83df71b00dcdfef 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright  2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright  2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' 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.
@@ -30,6 +30,9 @@
 namespace NUnit.Util
 {
        using System;
+       using System.IO;
+       using System.Text;
+       using System.Windows.Forms;
        using Microsoft.Win32;
 
        /// <summary>
@@ -38,10 +41,13 @@ namespace NUnit.Util
        /// </summary>
        public class NUnitRegistry
        {
-               private static readonly string KEY = "Software\\Nascent Software\\Nunit\\";
+               private static readonly string KEY = 
+                       @"Software\Nascent Software\Nunit\";
 
                private static bool testMode = false;
-               private static string testKey = "Software\\Nascent Software\\Nunit-Test";
+               private static string testKey = 
+                       @"Software\Nascent Software\Nunit-Test";
+
 
                /// <summary>
                /// Prevent construction of object
@@ -91,7 +97,7 @@ namespace NUnit.Util
                public static void ClearTestKeys()
                {
                        ClearSubKey( Registry.CurrentUser, testKey );
-                       ClearSubKey( Registry.LocalMachine, testKey );
+                       ClearSubKey( Registry.LocalMachine, testKey );  
                }
 
                /// <summary>
index 7eff7073d4a58f0059e41e8a66c5ca98fad635ce..a07c389e02d91f61dc858eb902f8d320dc64351d 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright  2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright  2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' 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.
index 937e8dc0f6a04b4fb2ff0b876fafe91dd6b5a9cf..410249765d98db2d1154cd0ef9799c84e980de1f 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright  2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright  2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' 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.
index 30939c38ea94b87ee467516a541ea02fe5e99ec8..d3e3e3b14ae8d079c9ae250ba488b671162a4bf3 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright  2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright  2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' 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.
index 6a8ae3d58bdedae78a66d44c92827ed29058cfa1..305444b00711404fd9827de24935bb2ee23456fd 100755 (executable)
@@ -1,3 +1,32 @@
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
+/************************************************************************************
+'
+' Copyright  2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' 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-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' 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.Diagnostics;
 using NUnit.Core;
@@ -14,6 +43,24 @@ namespace NUnit.Util
        /// </summary>
        public enum TestAction
        {
+               // Project Loading Events
+               ProjectLoading,
+               ProjectLoaded,
+               ProjectLoadFailed,
+               ProjectUnloading,
+               ProjectUnloaded,
+               ProjectUnloadFailed,
+               // Test Loading Events
+               TestLoading,
+               TestLoaded,
+               TestLoadFailed,
+               TestReloading,
+               TestReloaded,
+               TestReloadFailed,
+               TestUnloading,
+               TestUnloaded,
+               TestUnloadFailed,
+               // Test Running Events
                RunStarting,
                RunFinished,
                SuiteStarting,
@@ -27,96 +74,101 @@ namespace NUnit.Util
        /// </summary>
        public class TestEventArgs : EventArgs
        {
+               #region Instance Variables
+
+               // The action represented by the event
                private TestAction action;
+
+               // The file name for the test
+               private string testFileName;
+               
+               // The top node of a loaded test suite
                private UITestNode test;
+
+               // The result of a test
                private TestResult result;
+               
+               // The exception causing a failure
                private Exception exception;
 
-               /// <summary>
-               /// Helper to distinguish XxxxStarting from XxxxFinished actions
-               /// </summary>
-               /// <param name="action"></param>
-               /// <returns></returns>
-               private static bool IsStartAction( TestAction action )
+               #endregion
+
+               #region Constructors
+
+               public TestEventArgs( TestAction action, 
+                       string testFileName, UITestNode test )
                {
-                       return action == TestAction.RunStarting ||
-                               action == TestAction.SuiteStarting ||
-                               action == TestAction.TestStarting;
+                       this.action = action;
+                       this.testFileName = testFileName;
+                       this.test = test;
+               }
+
+               public TestEventArgs( TestAction action, string testFileName )
+               {
+                       this.action = action;
+                       this.testFileName = testFileName;
+               }
+
+               public TestEventArgs( TestAction action,
+                       string testFileName, Exception exception )
+               {
+                       this.action = action;
+                       this.testFileName = testFileName;
+                       this.exception = exception;
                }
 
-               /// <summary>
-               /// Construct using action and test node
-               /// Used only for XxxxStarting events
-               /// </summary>
                public TestEventArgs( TestAction action, UITestNode test )
                {
                        this.action = action;
                        this.test = test;
-                       this.result = null;
-                       this.exception = null;
-
-                       Debug.Assert( IsStartAction( action ), "Invalid TestAction in Constructor" );
                }
 
-               /// <summary>
-               /// Construct using action and test result
-               /// Used only for XxxxFinished events
-               /// </summary>
                public TestEventArgs( TestAction action, TestResult result )
                {
                        this.action = action;
-                       this.test = null;
                        this.result = result;
-                       this.exception = null;
-
-                       Debug.Assert( !IsStartAction( action ), "Invalid TestAction in Constructor" );
                }
 
-               /// <summary>
-               /// Construct using action and exception
-               /// Used only for RunFinished event
-               /// </summary>
                public TestEventArgs( TestAction action, Exception exception )
                {
                        this.action = action;
-                       this.test = null;
-                       this.result = null;
                        this.exception = exception;
-
-                       Debug.Assert( action == TestAction.RunFinished, "Invalid TestAction in Constructor" );
                }
 
-               /// <summary>
-               /// The action that triggered the event
-               /// </summary>
+               #endregion
+
+               #region Properties
+
                public TestAction Action
                {
                        get { return action; }
                }
 
-               /// <summary>
-               /// Test associated with a starting event
-               /// </summary>
+               public string TestFileName
+               {
+                       get { return testFileName; }
+               }
+
+               public bool IsProjectFile
+               {
+                       get { return NUnitProject.IsProjectFile( testFileName ); }
+               }
+
                public UITestNode Test
                {
                        get { return test; }
                }
 
-               /// <summary>
-               /// Result associated with a finished event
-               /// </summary>
                public TestResult Result
                {
                        get { return result; }
                }
 
-               /// <summary>
-               /// Exception associated with a RunFinished event
-               /// when caused by a system error or user cancelation
-               /// </summary>
                public Exception Exception
                {
                        get { return exception; }
                }
+
+               #endregion
        }
 }
index ba1c174f3800235adbd7b059d4159b4b8d746397..11593e3cd6fe8244e5e63682cba0f7e718d91070 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright  2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright  2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' 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.
index ff2229a5ec68d451a96d66649bd389172146c167..ba1e82505a708fe230e5bf840bdc7440f02fd844 100755 (executable)
@@ -1,8 +1,8 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
 /************************************************************************************
 '
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
+' Copyright  2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' 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 
@@ -16,8 +16,8 @@
 ' 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
+' Portions Copyright  2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' 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.
@@ -38,7 +38,7 @@ namespace NUnit.Util
        /// in the UI, avoiding the remoting issues associated
        /// with holding an actual Test object.
        /// </summary>
-       public class UITestNode : TestInfo
+       public class UITestNode : ITest
        {
                #region Instance Variables
 
@@ -52,6 +52,11 @@ namespace NUnit.Util
                /// </summary>
                private string testName;
 
+               /// <summary>
+               /// Used to distinguish tests in multiple assemblies;
+               /// </summary>
+               private int assemblyKey;
+
                /// <summary>
                /// True if the test should be run
                /// </summary>
@@ -83,12 +88,42 @@ namespace NUnit.Util
                /// object was constructed. Used for deferred 
                /// population of the object.
                /// </summary>
-               private TestInfo testSuite;
+               private ITest testSuite;
+
+               /// <summary>
+               /// The test description
+               /// </summary>
+               private string description;
 
                #endregion
 
                #region Construction and Conversion
 
+               public UITestNode( string suiteName ) : this( suiteName, 0 ) { }
+
+               public UITestNode( string suiteName, int assemblyKey )
+               {
+                       this.fullName = this.testName = suiteName;
+                       this.assemblyKey = assemblyKey;
+                       this.shouldRun = true;
+                       this.isSuite = true;
+                       this.testCaseCount = 0;
+                       this.tests = new ArrayList();
+               }
+
+               public UITestNode( string pathName, string testName ) 
+                       : this( pathName, testName, 0 ) { }
+
+               public UITestNode( string pathName, string testName, int assemblyKey ) 
+               { 
+                       this.fullName = pathName + "." + testName;
+                       this.testName = testName;
+                       this.assemblyKey = assemblyKey;
+                       this.shouldRun = true;
+                       this.isSuite = false;
+                       this.testCaseCount = 1;
+               }
+
                /// <summary>
                /// Construct from a TestInfo interface, which might be
                /// a Test or another UITestNode. Optionally, populate
@@ -96,12 +131,14 @@ namespace NUnit.Util
                /// </summary>
                /// <param name="test">TestInfo interface from which a UITestNode is to be constructed</param>
                /// <param name="populate">True if child array is to be populated</param>
-               public UITestNode ( TestInfo test, bool populate )
+               public UITestNode ( ITest test, bool populate )
                {
                        fullName = test.FullName;
                        testName = test.Name;
+                       assemblyKey = test.AssemblyKey;
                        shouldRun = test.ShouldRun;
                        ignoreReason = test.IgnoreReason;
+                       description = test.Description;
                        
                        if ( test.IsSuite )
                        {
@@ -124,7 +161,7 @@ namespace NUnit.Util
                /// Default construction uses lazy population approach
                /// </summary>
                /// <param name="test"></param>
-               public UITestNode ( TestInfo test ) : this( test, false ) { }
+               public UITestNode ( ITest test ) : this( test, false ) { }
 
                /// <summary>
                /// Populate the arraylist of child Tests recursively.
@@ -159,6 +196,15 @@ namespace NUnit.Util
 
                #region Properties
 
+               /// <summary>
+               /// The test description 
+               /// </summary>
+               public string Description
+               {
+                       get { return description; }
+                       set { description = value; }
+               }
+
                /// <summary>
                /// The reason for ignoring a test
                /// </summary>
@@ -193,6 +239,20 @@ namespace NUnit.Util
                        get { return testName; }
                }
 
+               /// <summary>
+               /// Identifier for assembly containing this test
+               /// </summary>
+               public int AssemblyKey
+               {
+                       get { return assemblyKey; }
+                       set { assemblyKey = value; }
+               }
+
+               public string UniqueName
+               {
+                       get{ return string.Format( "[{0}]{1}", assemblyKey, fullName ); }
+               }
+
                /// <summary>
                /// If the name is a path, this just returns the file part
                /// </summary>
index 0b7aaaa7646dc7d37c7797abb31691b89d811195..6ce3e3cb77ab968e53fc102ce400b788ac8eeada 100755 (executable)
@@ -1,8 +1,8 @@
 <VisualStudioProject>
     <CSHARP
         ProjectType = "Local"
-        ProductVersion = "7.0.9466"
-        SchemaVersion = "1.0"
+        ProductVersion = "7.10.3077"
+        SchemaVersion = "2.0"
         ProjectGuid = "{61CE9CE5-943E-44D4-A381-814DC1406767}"
     >
         <Build>
                 DefaultTargetSchema = "IE50"
                 DelaySign = "false"
                 OutputType = "Library"
+                PreBuildEvent = ""
+                PostBuildEvent = ""
                 RootNamespace = "NUnit.Util"
+                RunPostBuildEvent = "OnBuildSuccess"
                 StartupObject = ""
             >
                 <Config
@@ -30,6 +33,8 @@
                     DebugSymbols = "true"
                     FileAlignment = "4096"
                     IncrementalBuild = "true"
+                    NoStdLib = "false"
+                    NoWarn = ""
                     Optimize = "false"
                     OutputPath = "bin\Debug\"
                     RegisterForComInterop = "false"
@@ -48,6 +53,8 @@
                     DebugSymbols = "false"
                     FileAlignment = "4096"
                     IncrementalBuild = "false"
+                    NoStdLib = "false"
+                    NoWarn = ""
                     Optimize = "true"
                     OutputPath = "bin\Release\"
                     RegisterForComInterop = "false"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
+                <File
+                    RelPath = "AssemblyList.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "AssemblyListItem.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
                 <File
                     RelPath = "AssemblyWatcher.cs"
                     SubType = "Code"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
+                <File
+                    RelPath = "ITestEvents.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "ITestLoader.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
                 <File
                     RelPath = "NUnitGuiSettings.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
+                <File
+                    RelPath = "NUnitProject.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
                 <File
                     RelPath = "NUnitRegistry.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
                 <File
-                    RelPath = "RecentAssemblySettings.cs"
+                    RelPath = "ProjectConfig.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "ProjectConfigCollection.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "ProjectFormatException.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "ProjectPath.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "RecentFileSettings.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "RecentProjectSettings.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
                     BuildAction = "Compile"
                 />
                 <File
-                    RelPath = "TestLoadEventArgs.cs"
+                    RelPath = "TestEventDispatcher.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "TestLoader.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "TestResultItem.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
+                <File
+                    RelPath = "VSProject.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "VSProjectConfig.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "VSProjectConfigCollection.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
             </Include>
         </Files>
     </CSHARP>