2004-05-25 Sebastien Pouliot <sebastien@ximian.com>
authorSebastien Pouliot <sebastien@ximian.com>
Wed, 26 May 2004 00:25:00 +0000 (00:25 -0000)
committerSebastien Pouliot <sebastien@ximian.com>
Wed, 26 May 2004 00:25:00 +0000 (00:25 -0000)
* Removed old files from previous Nunit versions.

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

13 files changed:
mcs/nunit20/util/AssemblyInfo.cs
mcs/nunit20/util/ConsoleOptions.cs
mcs/nunit20/util/FileChangedEventHandler.cs [deleted file]
mcs/nunit20/util/GuiOptions.cs
mcs/nunit20/util/Makefile
mcs/nunit20/util/NUnit.Util.dll.sources
mcs/nunit20/util/NUnitProject.cs
mcs/nunit20/util/ProjectConfig.cs
mcs/nunit20/util/RecentAssemblySettings.cs [deleted file]
mcs/nunit20/util/RecentAssemblyUtil.cs [deleted file]
mcs/nunit20/util/TestEventArgs.cs
mcs/nunit20/util/UITestNode.cs
mcs/nunit20/util/nunit.util.dll.csproj

index 3100f0db6c63aa72a516028b557122d52d143e33..d8a5bf2b625fa2cf66e2a771beda88f8c7967ef7 100755 (executable)
@@ -55,13 +55,36 @@ 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:
 
-#if (NET_2_0)
-       [assembly: AssemblyVersion ("2.1.4.2")]
-#elif (NET_1_1)
-       [assembly: AssemblyVersion ("2.1.4.0")]
+[assembly: AssemblyVersion("2.1.91.0")]
+
+//
+// In order to sign your assembly you must specify a key to use. Refer to the 
+// Microsoft .NET Framework documentation for more information on assembly signing.
+//
+// Use the attributes below to control which key is used for signing. 
+//
+// Notes: 
+//   (*) If no key is specified, the assembly is not signed.
+//   (*) KeyName refers to a key that has been installed in the Crypto Service
+//       Provider (CSP) on your machine. KeyFile refers to a file which contains
+//       a key.
+//   (*) If the KeyFile and the KeyName values are both specified, the 
+//       following processing occurs:
+//       (1) If the KeyName can be found in the CSP, that key is used.
+//       (2) If the KeyName does not exist and the KeyFile does exist, the key 
+//           in the KeyFile is installed into the CSP and used.
+//   (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
+//       When specifying the KeyFile, the location of the KeyFile should be
+//       relative to the project output directory which is
+//       %Project Directory%\obj\<configuration>. For example, if your KeyFile is
+//       located in the project directory, you would specify the AssemblyKeyFile 
+//       attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
+//   (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
+//       documentation for more information on this.
+//
+#if !StronglyNamedAssembly
+[assembly: AssemblyDelaySign(false)]
 #else
-       [assembly: AssemblyVersion ("2.1.4.0")]
+[assembly: AssemblyKeyFile("..\\..\\..\\Nunit.key")]
+[assembly: AssemblyKeyName("")]
 #endif
-
-[assembly: AssemblyDelaySign (false)]
-[assembly: AssemblyKeyFile ("../nunit.key")]
index e1ee4ee8b4653180b74fc250e54dd87f2b398c8c..62e9a47478ce6842c4c3017b272b1da54574b792 100755 (executable)
@@ -58,6 +58,21 @@ namespace NUnit.Util
                [Option(Description = "Project configuration to load")]
                public string config;
 
+               [Option(Short="out", Description = "File to receive test output")]
+               public string output;
+
+               [Option(Description = "File to receive test error output")]
+               public string err;
+
+               [Option(Description = "Label each test in stdOut")]
+               public bool labels = false;
+
+               [Option(Description = "List of categories to include")]
+               public string include;
+
+               [Option(Description = "List of categories to exclude")]
+               public string exclude;
+
                private bool isInvalid = false; 
 
                public ConsoleOptions(String[] args) : base(args) 
@@ -72,6 +87,8 @@ namespace NUnit.Util
                {
                        if(isInvalid) return false; 
 
+                       if(HasInclude && HasExclude) return false;
+
                        if(NoArgs) return true; 
 
                        if(IsFixture) return true; 
@@ -102,7 +119,7 @@ namespace NUnit.Util
                        get 
                        {
                                return ParameterCount >= 1 && 
-                                          ((fixture != null) && (fixture.Length > 0));
+                                       ((fixture != null) && (fixture.Length > 0));
                        }
                }
 
@@ -114,6 +131,22 @@ namespace NUnit.Util
                        }
                }
 
+               public bool isOut
+               {
+                       get 
+                       {
+                               return (output != null) && (output.Length != 0);
+                       }
+               }
+
+               public bool isErr
+               {
+                       get 
+                       {
+                               return (err != null) && (err.Length != 0);
+                       }
+               }
+
                public bool IsTransform 
                {
                        get 
@@ -122,6 +155,44 @@ namespace NUnit.Util
                        }
                }
 
+               public bool HasInclude 
+               {
+                       get 
+                       {
+                               return include != null && include.Length != 0;
+                       }
+               }
+
+               public bool HasExclude 
+               {
+                       get 
+                       {
+                               return exclude != null && exclude.Length != 0;
+                       }
+               }
+
+               public string[] IncludedCategories
+               {
+                       get
+                       {
+                               if (HasInclude)
+                                       return include.Split( new char[] {';', ','});
+
+                               return null;
+                       }
+               }
+
+               public string[] ExcludedCategories
+               {
+                       get
+                       {
+                               if (HasExclude)
+                                       return exclude.Split( new char[] {';', ','});
+
+                               return null;
+                       }
+               }
+
                public override void Help()
                {
                        Console.WriteLine();
@@ -137,4 +208,4 @@ namespace NUnit.Util
                        Console.WriteLine();
                }
        }
-}
+}
\ No newline at end of file
diff --git a/mcs/nunit20/util/FileChangedEventHandler.cs b/mcs/nunit20/util/FileChangedEventHandler.cs
deleted file mode 100755 (executable)
index e1d4ab3..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
-/************************************************************************************
-'
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
-'
-' This software is provided 'as-is', without any express or implied warranty. In no 
-' event will the authors be held liable for any damages arising from the use of this 
-' software.
-' 
-' Permission is granted to anyone to use this software for any purpose, including 
-' commercial applications, and to alter it and redistribute it freely, subject to the 
-' following restrictions:
-'
-' 1. The origin of this software must not be misrepresented; you must not claim that 
-' you wrote the original software. If you use this software in a product, an 
-' acknowledgment (see the following) in the product documentation is required.
-'
-' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
-' or Copyright © 2000-2002 Philip A. Craig
-'
-' 2. Altered source versions must be plainly marked as such, and must not be 
-' misrepresented as being the original software.
-'
-' 3. This notice may not be removed or altered from any source distribution.
-'
-'***********************************************************************************/
-#endregion
-
-using System;
-
-namespace NUnit.Util
-{
-       public interface FileChangedEventHandler
-       {
-               void OnChanged(String fullPath);
-       }
-}
index 118fe067f9a749eff9f56310aaa23d57c3854132..4728eb695583b94f36413c6e95faf4543513c4d7 100755 (executable)
@@ -45,6 +45,12 @@ namespace NUnit.Util
                [Option(Description = "Suppress loading of last project")]
                public bool noload;
 
+               [Option(Description = "Automatically run the loaded project")]
+               public bool run;
+
+               [Option(Description = "Fixture to test")]
+               public string fixture;
+
                public GuiOptions(String[] args) : base(args) 
                {}
 
index fd0f9594f84af1e9b18a5e88c9c0d20a5145712c..220cc69c396ed3aec3b8b69f848f81a4bb5cb9b5 100644 (file)
@@ -2,10 +2,16 @@ thisdir = nunit20/util
 SUBDIRS = 
 include ../../build/rules.make
 
-LIBRARY = NUnit.Util.dll
-LOCAL_MCS_FLAGS= -r:NUnit.Framework.dll -r:System.Xml.dll
+LIBRARY = nunit.util.dll
+LOCAL_MCS_FLAGS= \
+       /resource:Transform.resources,NUnit.Util.Transform.resources \
+       -r:nunit.framework.dll -r:nunit.core.dll -r:System.dll \
+       -r:System.Xml.dll /d:MONO /d:StronglyNamedAssembly
 NO_TEST = yo
 
-EXTRA_DISTFILES = nunit.util.dll.csproj
+EXTRA_DISTFILES = \
+       nunit.util.dll.csproj   \
+       Transform.resources     \
+       Transform.resx          \
 
 include ../../build/library.make
index 3aef34956ad103759e0a85b7085deb0d2d37476b..32ac8f2e07dafc16f023da7c7cc29bf5f1c5e4eb 100644 (file)
@@ -1,10 +1,30 @@
 ./AssemblyInfo.cs
 ./AssemblyList.cs
 ./AssemblyListItem.cs
+./AssemblyWatcher.cs
 ./CommandLineOptions.cs
 ./ConsoleOptions.cs
+./ConsoleWriter.cs
+./ITestEvents.cs
+./ITestLoader.cs
 ./NUnitProject.cs
 ./ProjectConfig.cs
 ./ProjectConfigCollection.cs
 ./ProjectFormatException.cs
 ./ProjectPath.cs
+./ResultSummarizer.cs
+./SettingsGroup.cs
+./SettingsStorage.cs
+./StackTraceFilter.cs
+./SummaryVisitor.cs
+./TestDomain.cs
+./TestEventArgs.cs
+./TestEventDispatcher.cs
+./TestExceptionHandler.cs
+./TestLoader.cs
+./UIHelper.cs
+./UITestNode.cs
+./VSProjectConfigCollection.cs
+./VSProjectConfig.cs
+./VSProject.cs
+./XmlResultVisitor.cs
index 7e3e893e0f8d1f1c13706f78e1bfe2975671c1e9..5f2edd5faaf43ba0a567d51936b42b472af48127 100644 (file)
@@ -33,7 +33,6 @@ using System.Xml;
 using System.Xml.Schema;
 using System.IO;
 using System.Threading;
-using NUnit.Framework;
 using NUnit.Core;
 
 namespace NUnit.Util
@@ -136,7 +135,9 @@ namespace NUnit.Util
                // True if it's ours or one we can load
                public static bool CanLoadAsProject( string path )
                {
-                       return false;
+                       return  IsProjectFile( path ) ||
+                                       VSProject.IsProjectFile( path ) ||
+                                       VSProject.IsSolutionFile( path );
                }
 
                public static string GenerateProjectName()
@@ -173,6 +174,10 @@ namespace NUnit.Util
                                project.Load();
                                return project;
                        }
+                       else if ( VSProject.IsProjectFile( path ) )
+                               return NUnitProject.FromVSProject( path );
+                       else if ( VSProject.IsSolutionFile( path ) )
+                               return NUnitProject.FromVSSolution( path );
                        else
                                return NUnitProject.FromAssembly( path );
                        
@@ -239,6 +244,18 @@ namespace NUnit.Util
                        return project;
                }
 
+               public static NUnitProject FromVSProject( string vsProjectPath )
+               {
+                       NUnitProject project = new NUnitProject( Path.GetFullPath( vsProjectPath ) );
+
+                       VSProject vsProject = new VSProject( vsProjectPath );
+                       project.Add( vsProject );
+
+                       project.isDirty = false;
+
+                       return project;
+               }
+
                public static NUnitProject FromVSSolution( string solutionPath )
                {
                        NUnitProject project = new NUnitProject( Path.GetFullPath( solutionPath ) );
@@ -257,6 +274,8 @@ namespace NUnit.Util
                                        string[] parts = line.Split( delims );
                                        string vsProjectPath = Path.Combine( solutionDirectory, parts[2].Trim(trimchars) );
                                        
+                                       if ( VSProject.IsProjectFile( vsProjectPath ) )
+                                               project.Add( new VSProject( vsProjectPath ) );
                                }
 
                                line = reader.ReadLine();
@@ -426,6 +445,22 @@ namespace NUnit.Util
                        }
                }
 
+               public void Add( VSProject vsProject )
+               {
+                       foreach( VSProjectConfig vsConfig in vsProject.Configs )
+                       {
+                               string name = vsConfig.Name;
+
+                               if ( !this.Configs.Contains( name ) )
+                                       this.Configs.Add( name );
+
+                               ProjectConfig config = this.Configs[name];
+
+                               foreach ( string assembly in vsConfig.Assemblies )
+                                       config.Assemblies.Add( assembly );
+                       }
+               }
+
                public void Load()
                {
                        XmlTextReader reader = new XmlTextReader( projectPath );
@@ -572,30 +607,6 @@ namespace NUnit.Util
                        Save();
                }
 
-               /// <summary>
-               /// Load tests for this project into a test domain
-               /// </summary>
-               public Test LoadTest( TestDomain testDomain )
-               {
-                       return LoadTest( testDomain, null );
-               }
-
-               /// <summary>
-               /// Load tests for this project or for a particular fixture 
-               /// in the project into a test domain.
-               /// </summary>
-               public Test LoadTest( TestDomain testDomain, string testFixture )
-               {
-                       if ( IsAssemblyWrapper )
-                       {
-                               return testDomain.LoadAssembly( ActiveConfig.Assemblies[0].FullPath, testFixture );
-                       }
-                       else
-                       {
-                               return testDomain.LoadAssemblies( ProjectPath, ActiveConfig.BasePath, ActiveConfig.ConfigurationFilePath, ActiveConfig.PrivateBinPath, ActiveConfig.TestAssemblies, testFixture );
-                       }
-               }
-
                #endregion
        }
 }
index 9f6b235dc413d6d373732979ef174013888638b2..aac3f733f4d3bea41d8d5b852836260488c23d79 100644 (file)
@@ -281,39 +281,39 @@ namespace NUnit.Util
                }
 
                /// <summary>
-               /// Return an ArrayList with the absolute paths of all assemblies
+               /// Return a string array with the absolute paths of all assemblies
                /// </summary>
-               public IList AbsolutePaths
+               public string[] AbsolutePaths
                {
                        get
                        {
                                ArrayList paths = new ArrayList();
                                foreach( AssemblyListItem assembly in assemblies )
                                        paths.Add( assembly.FullPath );
-                               return paths;
+                               return (string[])paths.ToArray( typeof(string) );
                        }
                }
 
                /// <summary>
-               /// Return an ArrayList with the relative paths of all
+               /// Return a string array with the relative paths of all
                /// assemblies from the configuration BasePath.
                /// </summary>
-               public IList RelativePaths
+               public string[] RelativePaths
                {
                        get
                        {
                                ArrayList paths = new ArrayList();
                                foreach( AssemblyListItem assembly in Assemblies )
                                        paths.Add( ProjectPath.RelativePath( BasePath, assembly.FullPath ) );
-                               return paths;
+                               return (string[])paths.ToArray( typeof(string) );
                        }
                }
 
                /// <summary>
-               /// Return an ArrayList with the absolute paths of all
+               /// Return a string array with the absolute paths of all
                /// assemblies that have tests
                /// </summary>
-               public IList TestAssemblies
+               public string[] TestAssemblies
                {
                        get
                        {
@@ -321,7 +321,7 @@ namespace NUnit.Util
                                foreach( AssemblyListItem assembly in Assemblies )
                                        if ( assembly.HasTests )
                                                paths.Add( assembly.FullPath );
-                               return paths;
+                               return (string[])paths.ToArray( typeof(string) );
                        }
                }
 
diff --git a/mcs/nunit20/util/RecentAssemblySettings.cs b/mcs/nunit20/util/RecentAssemblySettings.cs
deleted file mode 100755 (executable)
index 2341182..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-#region Copyright (c) 2002, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Philip A. Craig
-/************************************************************************************
-'
-' Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
-' Copyright © 2000-2002 Philip A. Craig
-'
-' This software is provided 'as-is', without any express or implied warranty. In no 
-' event will the authors be held liable for any damages arising from the use of this 
-' software.
-' 
-' Permission is granted to anyone to use this software for any purpose, including 
-' commercial applications, and to alter it and redistribute it freely, subject to the 
-' following restrictions:
-'
-' 1. The origin of this software must not be misrepresented; you must not claim that 
-' you wrote the original software. If you use this software in a product, an 
-' acknowledgment (see the following) in the product documentation is required.
-'
-' Portions Copyright © 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov 
-' or Copyright © 2000-2002 Philip A. Craig
-'
-' 2. Altered source versions must be plainly marked as such, and must not be 
-' misrepresented as being the original software.
-'
-' 3. This notice may not be removed or altered from any source distribution.
-'
-'***********************************************************************************/
-#endregion
-
-using System;
-using System.Collections;
-
-namespace NUnit.Util
-{
-       /// <summary>
-       /// RecentAssemblySettings holds settings for recent assemblies
-       /// </summary>
-       public class RecentAssemblySettings : SettingsGroup
-       {
-               private static readonly string NAME = "Recent-Assemblies";
-               
-               private static string[] valueNames = {  "RecentAssembly1", 
-                                                                                               "RecentAssembly2", 
-                                                                                               "RecentAssembly3", 
-                                                                                               "RecentAssembly4", 
-                                                                                               "RecentAssembly5" };
-
-               private IList assemblyEntries;
-
-               public RecentAssemblySettings( ) : base ( NAME, UserSettings.GetStorageImpl( NAME ) )
-               {
-                       LoadAssemblies();
-               }
-
-               public RecentAssemblySettings( SettingsStorage storage ) : base( NAME, storage ) 
-               {
-                       LoadAssemblies();
-               }
-
-               public RecentAssemblySettings( SettingsGroup parent ) : base( NAME, parent ) 
-               { 
-                       LoadAssemblies();
-               }
-
-               private void LoadAssemblies()
-               {
-                       assemblyEntries = new ArrayList();
-                       foreach( string valueName in valueNames )
-                       {
-                               string assemblyName = LoadStringSetting(valueName);
-                               if(assemblyName != null)
-                                       assemblyEntries.Add(assemblyName);
-                       }
-               }
-
-               public override void Clear()
-               {
-                       base.Clear();
-                       assemblyEntries = new ArrayList();
-               }
-
-               public IList GetAssemblies()
-               {
-                       return assemblyEntries;
-               }
-               
-               public string RecentAssembly
-               {
-                       get 
-                       { 
-                               if(assemblyEntries.Count > 0)
-                                       return (string)assemblyEntries[0];
-
-                               return null;
-                       }
-                       set
-                       {
-                               int index = assemblyEntries.IndexOf(value);
-
-                               if(index == 0) return;
-
-                               if(index != -1)
-                               {
-                                       assemblyEntries.RemoveAt(index);
-                               }
-
-                               assemblyEntries.Insert(0, value);
-                               if(assemblyEntries.Count > valueNames.Length)
-                                       assemblyEntries.RemoveAt(valueNames.Length);
-
-                               SaveSettings();                 
-                       }
-               }
-
-               public void Remove(string assemblyName)
-               {
-                       assemblyEntries.Remove(assemblyName);
-                       SaveSettings();
-               }
-
-               private void SaveSettings()
-               {
-                       for ( int index = 0; 
-                                 index < valueNames.Length;
-                                 index++)
-                       {
-                               if ( index < assemblyEntries.Count )
-                                       SaveSetting( valueNames[index], assemblyEntries[index] );
-                               else
-                                       RemoveSetting( valueNames[index] );
-                       }
-               }
-       }
-}
diff --git a/mcs/nunit20/util/RecentAssemblyUtil.cs b/mcs/nunit20/util/RecentAssemblyUtil.cs
deleted file mode 100755 (executable)
index e0e4c9d..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/********************************************************************************************************************
-'
-' Copyright (c) 2002, James Newkirk, Michael C. Two, Alexei Vorontsov, Philip Craig
-'
-' Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 
-' documentation files (the "Software"), to deal in the Software without restriction, including without limitation 
-' the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
-' to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-'
-' The above copyright notice and this permission notice shall be included in all copies or substantial portions 
-' of the Software.
-'
-' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
-' THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-' AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-' CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-' DEALINGS IN THE SOFTWARE.
-'
-'*******************************************************************************************************************/
-namespace NUnit.Util
-{
-       using System;
-       using System.Collections;
-       using Microsoft.Win32;
-
-       /// <summary>
-       /// Summary description for RecentAssembly.
-       /// </summary>
-       public class RecentAssemblyUtil
-       {
-               private RegistryKey key;
-               private static string[] valueNames = { "RecentAssembly1", 
-                                                                                          "RecentAssembly2", 
-                                                                                          "RecentAssembly3", 
-                                                                                          "RecentAssembly4", 
-                                                                                          "RecentAssembly5" };
-               private string subKey;
-
-               private IList assemblyEntries;
-
-               public RecentAssemblyUtil(string subKey)
-               {
-                       this.subKey = subKey;
-                       key = NUnitRegistry.CurrentUser.CreateSubKey(subKey);
-                       assemblyEntries = new ArrayList();
-                       for(int index = 0; index < valueNames.Length; index++)
-                       {
-                               string valueName = (string)key.GetValue(valueNames[index]);
-                               if(valueName != null)
-                                       assemblyEntries.Add(valueName);
-                       }
-               }
-
-               public void Clear()
-               {
-                       NUnitRegistry.CurrentUser.DeleteSubKeyTree(subKey);
-                       assemblyEntries = new ArrayList();
-               }
-
-               public string RecentAssembly
-               {
-                       get 
-                       { 
-                               if(assemblyEntries.Count > 0)
-                                       return (string)assemblyEntries[0];
-
-                               return null;
-                       }
-                       set
-                       {
-                               int index = assemblyEntries.IndexOf(value);
-
-                               if(index == 0) return;
-
-                               if(index != -1)
-                               {
-                                       assemblyEntries.RemoveAt(index);
-                               }
-
-                               assemblyEntries.Insert(0, value);
-                               if(assemblyEntries.Count > valueNames.Length)
-                                       assemblyEntries.RemoveAt(valueNames.Length);
-
-                               SaveToRegistry();                       
-                       }
-               }
-
-               public IList GetAssemblies()
-               {
-                       return assemblyEntries;
-               }
-
-               public void Remove(string assemblyName)
-               {
-                       assemblyEntries.Remove(assemblyName);
-                       SaveToRegistry();
-               }
-
-               private void SaveToRegistry()
-               {
-                       for(int index = 0; 
-                               index < valueNames.Length;
-                               index++)
-                       {
-                               if ( index < assemblyEntries.Count )
-                                       key.SetValue(valueNames[index], assemblyEntries[index]);
-                               else
-                                       key.DeleteValue(valueNames[index], false);
-                       }
-               }
-       }
-}
index 305444b00711404fd9827de24935bb2ee23456fd..4bca9d328e3141cd94f2bc3e90f664c509586624 100755 (executable)
@@ -1,92 +1,34 @@
-#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;
 
 namespace NUnit.Util
 {
        /// <summary>
-       /// The delegate for all events related to running tests
+       /// The delegate for all events related to loading test projects
        /// </summary>
-       public delegate void TestEventHandler ( object sender, TestEventArgs args );
+       public delegate void TestProjectEventHandler ( object sender, TestProjectEventArgs args );
 
-       /// <summary>
-       /// Enumeration used to distiguish test events
-       /// </summary>
-       public enum TestAction
+       public enum TestProjectAction
        {
-               // 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,
-               SuiteFinished,
-               TestStarting,
-               TestFinished
        }
-       
+
        /// <summary>
-       /// Argument used for all test events
+       /// Summary description for TestProjectEventArgs.
        /// </summary>
-       public class TestEventArgs : EventArgs
+       public class TestProjectEventArgs : EventArgs
        {
                #region Instance Variables
 
                // The action represented by the event
-               private TestAction action;
+               private TestProjectAction 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 project name
+               private string projectName;
                
                // The exception causing a failure
                private Exception exception;
@@ -95,43 +37,17 @@ namespace NUnit.Util
 
                #region Constructors
 
-               public TestEventArgs( TestAction action, 
-                       string testFileName, UITestNode test )
-               {
-                       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;
-               }
-
-               public TestEventArgs( TestAction action, UITestNode test )
-               {
-                       this.action = action;
-                       this.test = test;
-               }
-
-               public TestEventArgs( TestAction action, TestResult result )
+               public TestProjectEventArgs( TestProjectAction action, string projectName )
                {
                        this.action = action;
-                       this.result = result;
+                       this.projectName = projectName;
                }
 
-               public TestEventArgs( TestAction action, Exception exception )
+               public TestProjectEventArgs( TestProjectAction action,
+                       string projectName, Exception exception )
                {
                        this.action = action;
+                       this.projectName = projectName;
                        this.exception = exception;
                }
 
@@ -139,29 +55,14 @@ namespace NUnit.Util
 
                #region Properties
 
-               public TestAction Action
+               public TestProjectAction Action
                {
                        get { return action; }
                }
 
-               public string TestFileName
-               {
-                       get { return testFileName; }
-               }
-
-               public bool IsProjectFile
-               {
-                       get { return NUnitProject.IsProjectFile( testFileName ); }
-               }
-
-               public UITestNode Test
-               {
-                       get { return test; }
-               }
-
-               public TestResult Result
+               public string ProjectName
                {
-                       get { return result; }
+                       get { return projectName; }
                }
 
                public Exception Exception
index ba1e82505a708fe230e5bf840bdc7440f02fd844..9b1f4d6481ee1f8c2a45fe06c9ea5e07e960471f 100755 (executable)
@@ -95,34 +95,13 @@ namespace NUnit.Util
                /// </summary>
                private string description;
 
-               #endregion
-
-               #region Construction and Conversion
+               private ArrayList categories = new ArrayList();
 
-               public UITestNode( string suiteName ) : this( suiteName, 0 ) { }
+               private bool isExplicit;
 
-               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 ) { }
+               #endregion
 
-               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;
-               }
+               #region Construction and Conversion
 
                /// <summary>
                /// Construct from a TestInfo interface, which might be
@@ -139,6 +118,15 @@ namespace NUnit.Util
                        shouldRun = test.ShouldRun;
                        ignoreReason = test.IgnoreReason;
                        description = test.Description;
+                       isExplicit = test.IsExplicit;
+
+                       if (test.Categories != null) 
+                       {
+                               categories.AddRange(test.Categories);
+                       }
+
+                       if ( test is UITestNode )
+                               testCaseCount = 0;
                        
                        if ( test.IsSuite )
                        {
@@ -171,11 +159,11 @@ namespace NUnit.Util
                {
                        if ( !Populated )
                        {
-                               foreach( Test test in testSuite.Tests )
+                               foreach( ITest test in testSuite.Tests )
                                {
                                        UITestNode node = new UITestNode( test, true );
                                        tests.Add( node );
-                                       testCaseCount += node.CountTestCases;
+                                       testCaseCount += node.CountTestCases();
                                }
 
                                testSuite = null;
@@ -268,19 +256,44 @@ namespace NUnit.Util
                        }
                }
 
+               public bool IsExplicit
+               {
+                       get { return isExplicit; }
+                       set { isExplicit = value; }
+               }
+
+               public IList Categories 
+               {
+                       get { return categories; }
+               }
+
+               public bool HasCategory( string name )
+               {
+                       return categories != null && categories.Contains( name );
+               }
+
+               public bool HasCategory( IList names )
+               {
+                       if ( categories == null )
+                               return false;
+
+                       foreach( string name in names )
+                               if ( categories.Contains( name ) )
+                                       return true;
+
+                       return false;
+               }
+
                /// <summary>
                /// Count of test cases in this test. If the suite
                /// has never been populated, it will be done now.
                /// </summary>
-               public int CountTestCases
+               public int CountTestCases()
                { 
-                       get 
-                       { 
-                               if ( !Populated )
-                                       PopulateTests();
+                       if ( !Populated )
+                               PopulateTests();
 
-                               return testCaseCount; 
-                       }
+                       return testCaseCount; 
                }
 
                /// <summary>
index 6ce3e3cb77ab968e53fc102ce400b788ac8eeada..012a3ba0de4cae7f9d2468f654ff1ecd4e84999a 100755 (executable)
                     AssemblyName = "System.Xml"
                     HintPath = "..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
                 />
-                <Reference
-                    Name = "nunit.framework.dll"
-                    Project = "{83DD7E12-A705-4DBA-9D71-09C8973D9382}"
-                    Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
-                />
                 <Reference
                     Name = "System.Windows.Forms"
                     AssemblyName = "System.Windows.Forms"
                     AssemblyName = "System.Drawing"
                     HintPath = "..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Drawing.dll"
                 />
+                <Reference
+                    Name = "nunit.core.dll"
+                    Project = "{EBD43A7F-AFCA-4281-BB53-5CDD91F966A3}"
+                    Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+                />
+                <Reference
+                    Name = "nunit.framework.dll"
+                    Project = "{83DD7E12-A705-4DBA-9D71-09C8973D9382}"
+                    Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+                />
             </References>
         </Build>
         <Files>
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
+                <File
+                    RelPath = "ConsoleWriter.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
                 <File
                     RelPath = "FormSettings.cs"
                     SubType = "Code"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
+                <File
+                    RelPath = "ResultSummarizer.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
                 <File
                     RelPath = "SettingsGroup.cs"
                     SubType = "Code"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
+                <File
+                    RelPath = "StackTraceFilter.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "SummaryVisitor.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "TestDomain.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
                 <File
                     RelPath = "TestEventArgs.cs"
                     SubType = "Code"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
+                <File
+                    RelPath = "TestExceptionHandler.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
                 <File
                     RelPath = "TestLoader.cs"
                     SubType = "Code"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
+                <File
+                    RelPath = "Transform.resx"
+                    BuildAction = "EmbeddedResource"
+                />
                 <File
                     RelPath = "UIHelper.cs"
                     SubType = "Code"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
+                <File
+                    RelPath = "XmlResultVisitor.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
             </Include>
         </Files>
     </CSHARP>